##// END OF EJS Templates
#antes de cambios en el gui
ralonso -
r89:90
parent child
Show More
@@ -1,786 +1,789
1 1 # -*- coding: utf-8 -*-
2 2
3 3 """
4 4 Module implementing MainWindow.
5 5 """
6 6
7 7 from PyQt4.QtGui import QMainWindow
8 8 from PyQt4.QtCore import pyqtSignature
9 9 from PyQt4 import QtCore
10 10 from Ui_MainWindow import Ui_MainWindow
11 11 from Ui_Parameters import Ui_Parameters
12 12 from Ui_About import Ui_About
13 13 from PyQt4 import QtGui
14 14 from subprocess import *
15 15 import sys
16 16 import os
17 17 #import subprocess
18 18 import time
19 19 import commands
20 20 from functions import functions
21 21 from functions import functions2
22 22
23 23 class MainWindow(QMainWindow, Ui_MainWindow):
24 24 """
25 25 Class documentation goes here.
26 26 """
27 27
28 28 def __init__(self, parent = None):
29 29 QMainWindow.__init__(self, parent)
30 30 self.setupUi(self)
31 31 self.setupUi2()
32 32
33 33 def setupUi2(self):
34 34
35 35 self.txtInfo.append("cambio 1")
36 36
37 37 self.allTrue = False
38 38
39 39 if self.allTrue == True:
40 40 self.var_real_principal = True
41 41 self.var_real_detect_devices = True
42 42 self.var_real_iso = True
43 43 self.var_real_burn = True
44 44 self.var_real_check = True
45 45 self.var_real_eject = True
46 46 self.var_real_manual_check = True
47 47 self.var_real_show_cmd = True
48 48
49 49 else:
50 50 self.var_real_principal = False
51 51 self.var_real_detect_devices = False
52 52 self.var_real_iso = False
53 53 self.var_real_burn = False
54 54 self.var_real_check = False
55 55 self.var_real_eject = False
56 56 self.var_real_manual_check = True
57 57 self.var_real_show_cmd = True
58 58
59 59 if self.var_real_detect_devices == True:
60 60 # Reconocimiento de los dispositivos de grabacion
61 61 functions2.detect_devices(self)
62 62 else:
63 63 functions2.set_devices_test(self)
64 64
65 65 #Inicialiazacion de variables
66 66 self.var_Discs = 0 #Numero de discos del proyecto
67 67 self.var_Copys = 0 #Numero de copias
68 68 self.var_disc_n = 0 # disco actual
69 69 self.var_copy_n = 0 # copia actual
70 70 self.var_burned_discs = 0 #numero de discos ya grabados
71 71
72 72 self.bool_first_iso = False
73 73 self.var_step = 0 # numero de paso en el proceso
74 74 self.bool_state_burning = False #si es True se puede grabar
75 75 self.blank_discs = False # Si es true significa que se acaban de ingresar discos en blanco
76 76
77 77 self.var_list=[] # Lista de DOYs
78 78 self.var_sublist=[] # Sub-lista de DOYs seleccionados
79 79 self.var_devices=[] #Lista de dispositivos seleccionados
80 80
81 81 #Revisa si existe el archivo de confirguracion y lo carga
82 82 if os.path.isfile("parameters.conf"):
83 83 functions2.get_parameters_conf(self)
84 84 self.bool_first_iso = True
85 85 self.txtInfo.append("Parameters were loaded from configuration file")
86 86 self.txtInfo.append("Total number of discs for recording: "+str(self.var_Discs * self.var_Copys))
87 87
88 88 elif self.var_real_principal == False:
89 89 functions2.set_parameters_test(self) #Establece ciertos parametros, para pruebas
90 90
91 91 functions2.set_vars(self) #Carga las variables de la clase con los parametros seleccionados
92 92
93 93 self.statusDpath = functions.dir_exists(self.var_Dpath, self)
94 94 self.statusRpath = functions.dir_exists(self.var_Rpath, self)
95 95 functions.load_days(self)
96 96
97 97 if os.path.isfile("parameters.conf"):
98 98 functions2.enabled_items1(True, self) #Se bloquean los parametros de configuracion
99 99
100 100 if os.path.isfile("burning.conf"):
101 101 functions2.get_burning_conf(self)
102 102 self.txtInfo.append("Current disc: "+str(self.var_disc_n))
103 103 self.txtInfo.append("Current copy: "+str(self.var_copy_n))
104 104 self.txtInfo.append("Burned discs: "+str(self.var_burned_discs))
105 105 self.btnStartburn.setText("Continue")
106 106 self.actionChange_Parameters.setEnabled(False)
107 107
108 108 self.connect(self.actionChange_Parameters, QtCore.SIGNAL("triggered()"), self.changeParameters)
109 109 self.connect(self.actionAbout, QtCore.SIGNAL("triggered()"), self.about)
110 110
111 111 self.process_iso = QtCore.QProcess()
112 112 self.connect(self.process_iso, QtCore.SIGNAL('readyReadStandardOutput()'), self.readOuput_iso)
113 113 self.connect(self.process_iso, QtCore.SIGNAL('readyReadStandardError()'), self.readError_iso)
114 114 self.connect(self.process_iso, QtCore.SIGNAL('finished(int,QProcess::ExitStatus)'), self.finished_iso)
115 115
116 116 self.process_burn = QtCore.QProcess()
117 117 self.connect(self.process_burn, QtCore.SIGNAL('readyReadStandardOutput()'), self.readOuput_burn)
118 118 self.connect(self.process_burn, QtCore.SIGNAL('readyReadStandardError()'), self.readError_burn)
119 119 self.connect(self.process_burn, QtCore.SIGNAL('finished(int,QProcess::ExitStatus)'), self.finished_burn)
120 120
121 121 self.process_check = QtCore.QProcess()
122 122 self.connect(self.process_check, QtCore.SIGNAL('readyReadStandardOutput()'), self.readOuput_check)
123 123 self.connect(self.process_check, QtCore.SIGNAL('readyReadStandardError()'), self.readError_check)
124 124 self.connect(self.process_check, QtCore.SIGNAL('finished(int,QProcess::ExitStatus)'), self.finished_check)
125 125
126 126 self.process_manual_check = QtCore.QProcess()
127 127 self.connect(self.process_manual_check, QtCore.SIGNAL('readyReadStandardOutput()'), self.readOuput_manual_check)
128 128 self.connect(self.process_manual_check, QtCore.SIGNAL('readyReadStandardError()'), self.readError_manual_check)
129 129 self.connect(self.process_manual_check, QtCore.SIGNAL('finished(int,QProcess::ExitStatus)'), self.finished_manual_check)
130 130
131 131 def changeParameters(self):
132 132 dlg=QtGui.QDialog()
133 133 dlgui=Ui_Parameters()
134 134 dlgui.setupUi(dlg)
135 135 if (dlg.exec_() == QtGui.QDialog.Accepted):
136 136 if dlgui.txtDisc.value() > self.var_Discs or dlgui.txtCopy.value() > dlgui.txtNcopys.value():
137 137 self.txtInfo.append("Wrong parameters")
138 138 else:
139 139 self.var_Copys = dlgui.txtNcopys.value()
140 140 self.var_disc_n = dlgui.txtDisc.value()
141 141 self.var_copy_n = dlgui.txtCopy.value()
142 142 self.txtInfo.append("Changed parameters")
143 143 self.var_burned_discs = ( ( (self.var_disc_n - 1) * self.var_Copys) + self.var_copy_n -1 )
144 144 self.bool_first_iso = True
145 145 self.txtInfo.append("Current disc: "+str(self.var_disc_n))
146 146 self.txtInfo.append("Current copy: "+str(self.var_copy_n))
147 147 self.txtInfo.append("Nro Copys: "+str(self.var_Copys))
148 148 functions2.make_parameters_conf(self)
149 149 self.txtCopys.setValue(self.var_Copys) #Actualizo mananualmente el valor Copys
150 150
151 151
152 152
153 153 def about(self):
154 154 dlg_about=QtGui.QDialog()
155 155 dlgui_about=Ui_About()
156 156 dlgui_about.setupUi(dlg_about)
157 157 dlg_about.exec_()
158 158
159 159
160 160 #==============================================================================
161 161 # Manejo de los eventos
162 162 #==============================================================================
163 163
164 164 #----------------------------------------------------- Obtencion de la ruta de los datos ---------------------------------------------------------------
165 165
166 166 @pyqtSignature("")
167 167 def on_btnDpath_clicked(self):
168 168 """
169 169 Permite seleccionar graficamente el direcorio de los datos a grabar
170 170 """
171 171 self.var_Dpath= str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly))
172 172 self.txtDpath.setText(self.var_Dpath)
173 173 self.statusDpath = functions.dir_exists(self.var_Dpath, self)
174 174 functions.load_days(self)
175 175
176 176
177 177 @pyqtSignature("")
178 178 def on_txtDpath_editingFinished(self):
179 179 """
180 180 Carga la ruta editada y verifica que sea correcta y carga la lista de dias
181 181 """
182 182 self.var_Dpath=str(self.txtDpath.text()) #Se carga la variable con la ruta recien editada
183 183 self.statusDpath = functions.dir_exists(self.var_Dpath, self)
184 184 functions.load_days(self)
185 185
186 186
187 187 #----------------------------------------------------- Obtencion de las ruta del proyecto ---------------------------------------------------------------
188 188
189 189 @pyqtSignature("")
190 190 def on_btnRpath_clicked(self):
191 191 """
192 192 Permite seleccionar graficamente el direcorio del proyecto
193 193 """
194 194 self.var_Rpath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly))
195 195 self.txtRpath.setText(self.var_Rpath)
196 196 self.statusRpath = functions.dir_exists(self.var_Rpath, self)
197 197
198 198
199 199 @pyqtSignature("")
200 200 def on_txtRpath_editingFinished(self):
201 201 """
202 202 Valida la ruta del proyecto
203 203 """
204 204 self.var_Rpath = str(self.txtRpath.text()) #Se carga la variable con la ruta recien editada
205 205 self.statusRpath = functions.dir_exists(self.var_Rpath, self)
206 206
207 207
208 208 #----------------------------------------------------- Tipo de datos ---------------------------------------------------------------
209 209
210 210 @pyqtSignature("int")
211 211 def on_lstDtype_activated(self, index):
212 212 """
213 213 Permite elegir entre los tipos de archivos
214 214 """
215 215 self.txtDtype.setReadOnly(True)
216 216 if index == 0:
217 217 self.var_Dtype ='r'
218 218 elif index == 1:
219 219 self.var_Dtype ='pdata'
220 220 elif index == 2:
221 221 self.var_Dtype ='sswma'
222 222 else :
223 223 self.var_Dtype =''
224 224 self.txtDtype.setReadOnly(False)
225 225
226 226 self.txtDtype.setText(self.var_Dtype)
227 227 functions.load_days(self) #llamada a funcion
228 228
229 229 @pyqtSignature("")
230 230 def on_txtDtype_editingFinished(self):
231 231 self.var_Dtype=str(self.txtDtype.text())
232 232 functions.load_days(self) #llamada a funcion
233 233
234 234
235 235 #----------------------------------------------------- Etiqueta ---------------------------------------------------------------
236 236
237 237 @pyqtSignature("")
238 238 def on_txtElabel_editingFinished(self):
239 239 self.var_Elabel = str(self.txtElabel.text())
240 240
241 241 #----------------------------------------------------- Numero de copias ---------------------------------------------------------------
242 242 @pyqtSignature("")
243 243 def on_txtCopys_editingFinished(self):
244 244 self.var_Copys = self.txtCopys.value()
245 245
246 246 #----------------------------------------------------- Seleccion del rango de fechas ---------------------------------------------------------------
247 247
248 248 @pyqtSignature("int") #CLOSED
249 249 def on_lstStartDay_activated(self, index):
250 250 """
251 251 Cambia la lista de opciones en lstStopDay
252 252 """
253 253 var_StopDay_index=self.lstStopDay.count() - self.lstStopDay.currentIndex()
254 254 self.lstStopDay.clear()
255 255
256 256 for i in self.var_list[index:]:
257 257 self.lstStopDay.addItem(i)
258 258
259 259 self.lstStopDay.setCurrentIndex(self.lstStopDay.count() - var_StopDay_index)
260 260
261 261 functions.get_sub_list(self)
262 262
263 263
264 264 @pyqtSignature("int") #CLOSED
265 265 def on_lstStopDay_activated(self, index):
266 266 """
267 267 Cambia la lista de opciones en lstStartDay
268 268 """
269 269 var_StartDay_index=self.lstStartDay.currentIndex()
270 270 var_end_index = self.lstStopDay.count() - index
271 271 self.lstStartDay.clear()
272 272
273 273 for i in self.var_list[:len(self.var_list) - var_end_index + 1]:
274 274 self.lstStartDay.addItem(i)
275 275
276 276 self.lstStartDay.setCurrentIndex(var_StartDay_index)
277 277
278 278 functions.get_sub_list(self)
279 279
280 280
281 281 #----------------------------------------------------- Capacidad del dispositivo de grabacion ---------------------------------------------------------------
282 282
283 283 @pyqtSignature("")
284 284 def on_txtDcapacity_editingFinished(self):
285 285 self.var_Dcapacity = self.txtDcapacity.value()
286 286
287 287
288 288 @pyqtSignature("int") #CLOSED
289 289 def on_lstDcapacity_activated(self, index):
290 290 """
291 291 Permite elegir el tamaΓ±o del disco
292 292 """
293 293 if index == 0:
294 294 var_size=25.0
295 295 elif index == 1:
296 296 var_size=8.5
297 297 elif index == 2:
298 298 var_size=4.7
299 299 elif index == 3:
300 300 var_size=0.7
301 301
302 302 if index != 4:
303 303 self.txtDcapacity.setValue(var_size*10**9/1024**2)
304 304 self.txtDcapacity.setReadOnly(True)
305 305 else:
306 306 self.txtDcapacity.setValue(100.0)
307 307 self.txtDcapacity.setReadOnly(False)
308 308
309 309 self.var_lstDcapacity = self.lstDcapacity.currentIndex()
310 310 self.var_Dcapacity = self.txtDcapacity.value()
311 311
312 312 #----------------------------------------------------- Testeo de las unidades de grabacion ---------------------------------------------------------------
313 313
314 314 @pyqtSignature("")
315 315 def on_btnTdevA_clicked(self):
316 316 var_dev = str(self.txtDeviceA.text())
317 317 var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev
318 318 commands.getstatusoutput(var_cmd)
319 319
320 320 @pyqtSignature("")
321 321 def on_btnTdevB_clicked(self):
322 322 var_dev = str(self.txtDeviceB.text())
323 323 var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev
324 324 commands.getstatusoutput(var_cmd)
325 325
326 326 @pyqtSignature("")
327 327 def on_btnTdevC_clicked(self):
328 328 var_dev = str(self.txtDeviceC.text())
329 329 var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev
330 330 commands.getstatusoutput(var_cmd)
331 331
332 332 @pyqtSignature("")
333 333 def on_btnTdevD_clicked(self):
334 334 var_dev = str(self.txtDeviceD.text())
335 335 var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev
336 336 commands.getstatusoutput(var_cmd)
337 337
338 338
339 339 #==============================================================================
340 340 # Botones para la generacion de los archivos de configuracion
341 341 #==============================================================================
342 342
343 343 #----------------------------------------------------- Generacion de la configuracion usando los parametros ---------------------------------------------------------------
344 344
345 345 @pyqtSignature("")
346 346 def on_btnGbkp_clicked(self):
347 347 """
348 348 Generacion de archivos de configuracion usando los parametros
349 349 """
350 350
351 351 if functions.validate_parameters(self) == False:
352 352 return
353 353
354 354 #Crea las carpetas en la ruta del proyecto y verifica que se crearon correctamente
355 355 list_dirs=['gpath','iso','ppath', 'tmpdata']
356 356 bool_make_dirs = functions.make_dirs(list_dirs, self)
357 357 if bool_make_dirs == False:
358 358 return
359 359
360 360 var_files_list = functions.list_files(self) #Se obtiene la lista de archivos a grabar
361 361
362 362 self.var_Discs = functions.make_files_dat(var_files_list, self) #Se crean los archivos .dat
363 363
364 364 functions.make_files_print(self) # Se crean los archivos .print
365 365
366 366 functions2.make_parameters_conf(self) # se crea el archivo parameters.conf
367 367
368 368 self.txtInfo.append("Total number of discs for recording: "+str(self.var_Discs * self.var_Copys))
369 369
370 370 #Se bloquean los parametros de configuracion
371 371 functions2.enabled_items1(True, self)
372 372 self.var_disc_n = 1
373 373 self.var_copy_n = 1
374 374 self.bool_first_iso = True
375 375 self.var_burned_discs = 0 #numero de discos grabados
376 376
377 377
378 378 #----------------------------------------------------- Permite reiniciar la configuracion ---------------------------------------------------------------
379 379
380 380 @pyqtSignature("")
381 381 def on_btnRestart_clicked(self):
382 382 """
383 383 Permite que se puedan cambiar los parametros
384 384 """
385 385 if os.path.isfile("parameters.conf"):
386 386 os.remove("parameters.conf")
387 387 if os.path.isfile("burning.conf"):
388 388 os.remove("burning.conf")
389 389
390 390 functions2.enabled_items1(False, self)
391 391 self.btnStartburn.setText("Start Burn")
392 392 self.txtInfo.clear()
393 393
394 394
395 395
396 396 #==============================================================================
397 397 # Acciones de los procesos
398 398 #==============================================================================
399 399
400 400 #------------------------------------------------ Funciones del proceso de creacion del iso ------------------------------------------------------
401 401
402 402 def readOuput_iso(self):
403 403 self.txtProgress.setText("stdout iso: " + QtCore.QString(self.process_iso.readAllStandardOutput()))
404 404
405 405 def readError_iso(self):
406 406 self.txtProgress.setText("stderr iso: " + QtCore.QString(self.process_iso.readAllStandardError()))
407 407
408 408 def finished_iso(self):
409 409 self.txtProgress.clear()
410 410
411 411 if not(self.bool_state_burning):
412 412 return
413 413
414 414 if self.process_iso.exitCode() == 0:
415 415 self.txtInfo.append("------Iso file: "+functions.i2s(self.var_disc_n)+" created successfully\n")
416 416 self.var_step = 1
417 417 self.function_burn()
418 418
419 419 else:
420 420 self.txtInfo.append("#####Error creating iso file "+functions.i2s(self.var_disc_n)
421 421 +" , code "+QtCore.QString(self.process_iso.exitCode()))
422 422 self.txtInfo.append("Please check the data")
423 423 self.txtInfo.append("FATAL ERROR")
424 424
425 425 #----------------------------------------------------- Funciones del proceso de grabado ---------------------------------------------------------------
426 426
427 427 def readOuput_burn(self):
428 428 self.txtProgress.setText("stdout burn: " + QtCore.QString(self.process_burn.readAllStandardOutput()))
429 429
430 430 def readError_burn(self):
431 431 self.txtProgress.setText("stderr burn: " + QtCore.QString(self.process_burn.readAllStandardError()))
432 432
433 433 def finished_burn(self):
434 434 self.txtProgress.clear()
435 435
436 436 #Si se paro el proceso manualmente se termina
437 437 if not(self.bool_state_burning):
438 438 return
439 439
440 440 if self.process_burn.exitCode() == 0:
441 441 self.txtInfo.append("-----Complete recording, disc: "+str(self.var_disc_n)+" copy: "+str(self.var_copy_n))
442 442 functions2.update_message(1, "COMPLETED", self)
443 443 self.var_step = 2
444 444 self.function_check()
445 445
446 446 else:
447 447 self.txtInfo.append("#######Error recording, disc: "+functions.i2s(self.var_disc_n)+" copy: "
448 448 +functions.i2s(self.var_copy_n)+", code "+QtCore.QString(self.process_burn.exitCode()))
449 449 functions2.update_message(1, "ERROR", self)
450 450
451 451 functions.is_last_disc_and_copy(self)
452 452
453 453
454 454 #----------------------------------------------------- Funciones del proceso de verificacion ---------------------------------------------------------------
455 455
456 456 def readOuput_check(self):
457 457 self.txtProgress.setText("stdout check: " + QtCore.QString(self.process_check.readAllStandardOutput()))
458 458
459 459 def readError_check(self):
460 460 self.txtProgress.setText("stderr check: " + QtCore.QString(self.process_check.readAllStandardError()))
461 461
462 462 def finished_check(self):
463 463 self.txtProgress.clear()
464 464
465 465 if not(self.bool_state_burning):
466 466 return
467 467
468 468 if self.process_check.exitCode() == 0:
469 469 self.txtInfo.append("--------Complete checking, disc: "+str(self.var_disc_n)+" copy: "+str(self.var_copy_n))
470 470 functions2.update_message(2, "CHECKED", self)
471 471
472 472 else:
473 473 self.txtInfo.append("#######Error checking, disc: "+functions.i2s(self.var_disc_n)+" copy: "
474 474 +functions.i2s(self.var_copy_n)+", code "+QtCore.QString(self.process_check.exitCode()))
475 475 functions2.update_message(2, "ERROR", self)
476 476
477 477 #borrar el contenido de tmpdata
478 478 var_tmpdata=self.var_Rpath+"/tmpdata"
479 479
480 480 bool_return = functions.remove_dir(var_tmpdata, self)
481 481 if not(bool_return):
482 482 self.txtInfo.append("Error deleting directory: "+var_tmpdata)
483 483 self.bool_state_burning = False
484 484 return
485 485
486 486 bool_return = functions.make_dir(var_tmpdata, self)
487 487 if not(bool_return):
488 488 self.txtInfo.append("Error creating directory:"+ var_tmpdata)
489 489 self.bool_state_burning = False
490 490 return
491 491
492 492 functions.is_last_disc_and_copy(self)
493 493
494 494 #----------------------------------------------------- Funciones del proceso de verificacion manual ---------------------------------------------------------------
495 495
496 496 def readOuput_manual_check(self):
497 497 self.txtProgress.setText("stdout check: " + QtCore.QString(self.process_manual_check.readAllStandardOutput()))
498 498
499 499 def readError_manual_check(self):
500 500 self.txtProgress.setText("stderr check: " + QtCore.QString(self.process_manual_check.readAllStandardError()))
501 501
502 502 def finished_manual_check(self):
503 503 self.txtProgress.clear()
504 504
505 505 if not(self.bool_state_manual_check):
506 506 return
507 507
508 508 if self.process_manual_check.exitCode() == 0:
509 509 self.txtInfo.append("--------Complete checking, disc: "+str(self.var_n_check_dirs + 1))
510 510 functions2.update_message(2, "CHECKED", self, index=self.var_n_check_dirs)
511 511
512 512 else:
513 513 self.txtInfo.append("#######Error checking, disc: "+str(self.var_n_check_dirs + 1)
514 514 +", code "+QtCore.QString(self.process_manual_check.exitCode()))
515 515 functions2.update_message(2, "ERROR", self, index=self.var_n_check_dirs)
516 516
517 517 #borrar el contenido de tmpdata
518 518 var_tmpdata=self.var_TDpath+"/tmpdata"
519 519
520 520 bool_return = functions.remove_dir(var_tmpdata, self)
521 521 if not(bool_return):
522 522 self.txtInfo.append("Error deleting directory: "+var_tmpdata)
523 523 self.bool_state_manual_check = False
524 524 return
525 525
526 526 self.var_n_check_dirs +=1
527 527
528 528 if self.var_n_check_dirs >= len(self.list_check_dirs) :
529 529 self.bool_state_manual_check = False
530 530 self.function_manual_check_final()
531 531 return
532 532
533 533 self.function_manual_check()
534 534
535 535
536 536 #==============================================================================
537 537 # Botones para el proceso de grabacion
538 538 #==============================================================================
539 539
540 540 #----------------------------------------------------- Iniciar proceso de grabacion ---------------------------------------------------------------
541 541
542 542 @pyqtSignature("")
543 543 def on_btnStartburn_clicked(self):
544 544 """
545 545 Se inicia el proceso de grabacion
546 546 """
547 547 #Verifica que exista algun dispositivo de grabacion seleccionado
548 548 if not(functions2.selected_devices(self)):
549 549 self.txtInfo.append("There is no recording device selected")
550 550 return
551 551
552 552 # #Lista los dispositivos de grabacion a usar
553 553 # for dev in self.var_devices:
554 554 # self.txtInfo.append("recording device :"+dev)
555 555
556 556 self.bool_state_burning = True
557 557 functions2.enabled_items2(True, self)
558 558
559 559 if self.bool_first_iso == True:
560 560 self.txtInfo.append("BUTTON: on_btnStartburn_clicked")
561 561 self.var_step = 4
562 562 self.function_eject()
563 563 return
564 564
565 565 if self.var_step == 0:
566 566 self.function_iso()
567 567 return
568 568
569 569 if self.var_step == 1:
570 570 self.function_burn()
571 571 return
572 572
573 573 #----------------------------------------------------- Funcion para el grabado ---------------------------------------------------------------
574 574
575 575 def function_iso(self):
576 576 #Creacion del archivo.iso para la grabacion
577 577 if self.var_step == 0:
578 578 self.txtInfo.append("########## Disc number: "+str(self.var_disc_n)+"##########")
579 579 self.txtInfo.append("------Creating iso file number: "+str(self.var_disc_n))
580 580
581 581 var_cmd = functions.cmd_iso(self)
582 582
583 583 if self.var_real_show_cmd == True:
584 584 self.txtInfo.append("CMD: "+var_cmd)
585 585
586 586 if self.var_real_iso == False:
587 587 self.txtInfo.append('**function_iso')
588 588 var_cmd="echo 'function_iso'"
589 589
590 590 self.process_iso.start(var_cmd)
591 591
592 592 def function_burn(self):
593 593 #Grabacion de los DVDs
594 594
595 595 if self.var_step == 1:
596 596 self.txtInfo.append("------Recording disc: "+str(self.var_disc_n)+", copy:"+str(self.var_copy_n))
597 597 functions2.update_message(1, "BURNING", self)
598 598
599 599 var_cmd = functions.cmd_burn(self)
600 600
601 601 if self.var_real_show_cmd == True:
602 602 self.txtInfo.append("CMD: "+var_cmd)
603 603
604 604 if self.var_real_burn == False:
605 605 self.txtInfo.append('**function_burn')
606 606 var_cmd="echo 'function_burn'"
607 607
608 608 self.process_burn.start(var_cmd)
609 609
610 610 def function_check(self):
611 611 #Verificacion de los discos
612 612 if self.var_step == 2:
613 613 self.txtInfo.append("-----------checking disc:"+str(self.var_disc_n)+", copy:"+str(self.var_copy_n))
614 614
615 615 functions2.eject_one_device(self)
616 616 functions2.eject_t_one_device(self)
617 617 self.txtInfo.append("Waiting ...")
618 618 time .sleep(20)
619 619
620 620 functions2.update_message(2, "CHECKING", self)
621 621
622 622 dev_sr = functions2.get_dev_sr(self)
623 623 var_cmd = functions.cmd_check(dev_sr, self)
624 624
625 625 if self.var_real_show_cmd == True:
626 626 self.txtInfo.append("CMD: "+var_cmd)
627 627
628 628 if self.var_real_check == False:
629 629 self.txtInfo.append('**function_check')
630 630 var_cmd="echo 'function_check'"
631 631
632 632 self.process_check.start(var_cmd)
633 633
634 634 #OK
635 635 def function_eject(self):
636 636 self.txtInfo.append("Ejecting recording devices")
637 637 self.txtInfo.append("Please insert blank discs")
638 638
639 639 if self.var_real_eject == True:
640 640 functions2.eject_devices(self) # Expulsa las bandejas de los dispostivos de grabacion
641 641 else:
642 642 self.txtInfo.append("**functions2.eject_devices")
643 643
644 644 self.btnStartburn.setText("Continue")
645 645 self.btnStartburn.setEnabled(True)
646 646
647 647 if self.bool_first_iso == True:
648 648 self.bool_first_iso = False
649 649 self.var_step = 0
650 650
651 651 elif self.var_copy_n == 1:
652 652 self.var_step = 0
653 653
654 654 else:
655 655 self.var_step = 1
656 656
657 657 def function_final(self):
658 658 self.txtInfo.append("Recording process is complete")
659 659 if os.path.isfile("parameters.conf"):
660 660 os.remove("parameters.conf")
661 661 if os.path.isfile("burning.conf"):
662 662 os.remove("burning.conf")
663 663
664 664 functions2.eject_devices(self) # Expulsa las bandejas de los dispostivos de grabacion
665 665
666 666
667 667
668 668
669 669 #----------------------------------------------------- Detener proceso de grabacion ---------------------------------------------------------------
670 670
671 671 @pyqtSignature("")
672 672 def on_btnStopburn_clicked(self):
673 673 """
674 674 Slot documentation goes here.
675 675 """
676 676 self.bool_state_burning = False
677 677
678 678 if self.var_step == 0:
679 679 self.process_iso.terminate() #Termina el proceso, si puede
680 680 # self.process_iso.kill() #Mata el proceso, no es la forma adecuada, solo usar si terminate() no funciona
681 681 elif self.var_step == 1:
682 682 self.process_burn.terminate()
683 683 elif self.var_step == 2:
684 684 self.process_check.terminate()
685 685
686 686 self.txtInfo.append("Stopped recording")
687 687 functions2.enabled_items2(False, self)
688 688 self.bool_first_iso = True
689 689
690 690
691 691
692 692 #==============================================================================
693 693 # Proceso verificacion manual
694 694 #==============================================================================
695 695
696 696
697 697 #----------------------------------------------------- Proceso de verificaion manual ---------------------------------------------------------------
698 698
699 699
700 700 @pyqtSignature("")
701 701 def on_btnTDpath_clicked(self):
702 702 """
703 703 Slot documentation goes here.
704 704 """
705 705 self.var_TDpath= str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly))
706 706 self.txtTDpath.setText(self.var_TDpath)
707 707 self.statusTDpath = functions.dir_exists(self.var_TDpath, self)
708 708 if self.statusTDpath:
709 709 self.btnCHstart.setEnabled(True)
710 710
711 711
712 712 @pyqtSignature("")
713 713 def on_btnCHstart_clicked(self):
714 714 """
715 715 Slot documentation goes here.
716 716 """
717 717
718 718 if self.btnCHstart.text() == "STOP":
719 719 self.btnCHstart.setText("START") #Cambio el texto del boton
720 720 self.bool_state_manual_check = False
721 721 self.process_manual_check.terminate()
722 722
723 723 #borrar el contenido de tmpdata
724 724 var_tmpdata=self.var_TDpath+"/tmpdata"
725 725 bool_return = functions.remove_dir(var_tmpdata, self)
726 726 if not(bool_return):
727 727 self.txtInfo.append("Error deleting directory: "+var_tmpdata)
728 728
729 729 return
730 730
731 731
732 732 list_dirs = functions2.mounted_devices()
733 733 if list_dirs == "FATAL ERROR":
734 734 self.txtInfo.append("ERROR")
735 735 return
736 736
737 737 for i in list_dirs:
738 738 self.txtInfo.append(i)
739 739
740 740 self.list_check_dirs = list_dirs #contiene los directorios donde estan montados los discos a verificar
741 741 self.var_n_check_dirs = 0
742 742 self.bool_state_manual_check = True
743 743
744 744 self.btnTDpath.setEnabled(False) #Deshabilito el boton que permite cambiar la ruta de verificacion
745 745 self.btnCHstart.setText("STOP") #Cambio el texto del boton
746 746
747 747 self.function_manual_check()
748 748
749 749
750 750 def function_manual_check(self):
751 751
752 752 #Verificacion de los discos
753 753 if self.bool_state_manual_check == True:
754 754
755 755 self.txtInfo.append("-----------manually checking disc: "+str(self.var_n_check_dirs + 1)
756 756 +" directory: "+self.list_check_dirs[self.var_n_check_dirs])
757 757
758 758 functions2.update_message(2, "CHECKING", self, index=self.var_n_check_dirs)
759 759
760 760 #Crea la carpeta tmpdata dentro de la ruta elegida
761 761 var_tmpdata=self.var_TDpath+"/tmpdata"
762 762 bool_return = functions.make_dir(var_tmpdata, self)
763 763 if not(bool_return):
764 764 self.txtInfo.append("Error creating directory:"+ var_tmpdata)
765 765 self.bool_state_burning = False
766 766 return
767 767
768 768 var_data_dir = self.list_check_dirs[self.var_n_check_dirs] #Carpeta donde esta montado el disco actual
769 769
770 770 var_cmd = functions.cmd_manual_check(var_data_dir, var_tmpdata)
771 771
772 772 if self.var_real_show_cmd == True:
773 773 self.txtInfo.append("CMD: "+var_cmd)
774 774
775 775 if self.var_real_manual_check == False:
776 776 self.txtInfo.append('**function_manual_check')
777 777 var_cmd="echo 'function_manual_check'"
778 778
779 779 self.process_manual_check.start(var_cmd)
780 780
781 781
782 782 def function_manual_check_final(self):
783 783 self.txtInfo.append("Manual check process is complete")
784 784 self.btnCHstart.setText("START") #Cambio el texto del boton
785 functions2.eject_devices_2(self) # Expulsa las bandejas de los dispostivos de grabacion
786
785 for var_mount_point in self.list_check_dirs:
786 var_cmd = 'eject ' + var_mount_point
787 commands.getstatusoutput(var_cmd)
788
789
General Comments 0
You need to be logged in to leave comments. Login now