##// END OF EJS Templates
segun diagrama 2da parte ...
ralonso -
r77:78
parent child
Show More
@@ -256,7 +256,8
256 var_lines.append("\n")
256 var_lines.append("\n")
257
257
258 return var_lines
258 return var_lines
259
259
260 #---------------------------------------comandos para el proceso de grabacion ------------------------------------------
260 def cmd_iso(self):
261 def cmd_iso(self):
261 var_Rpath_ppath=self.var_Rpath+"/ppath"
262 var_Rpath_ppath=self.var_Rpath+"/ppath"
262 var_Rpath_iso=self.var_Rpath+"/iso"
263 var_Rpath_iso=self.var_Rpath+"/iso"
@@ -268,14 +269,53
268 var_cmd += ' -graft-points -path-list '+ file_dat+' -o '+file_iso
269 var_cmd += ' -graft-points -path-list '+ file_dat+' -o '+file_iso
269 return var_cmd
270 return var_cmd
270
271
271
272 def cmd_burn(self):
272 def next_var_disc(self, error = False):
273 var_Rpath_iso=self.var_Rpath+"/iso"
273 pass
274 file_iso=var_Rpath_iso+"/"+functions.i2s(self.var_disc_n)+".iso"
274 # if self.var_copy_n < self.var_Copys:
275
275 # self.var_copy_n += 1
276 var_index = ( ( (self.var_disc_n - 1) * self.var_Copys) + (self.var_copy_n - 1) - self.var_burned_discs ) % len(self.var_devices)
276 # self.var_step == 1:
277 var_dev_tmp = self.var_devices[var_index]
277 #
278
278 # if self.var_disc_n < self.var_Discs:
279 var_cmd = "wodim -v dev="+var_dev_tmp+" speed=16 "+ file_iso
279
280 return var_cmd
280 pass
281
281
282 def remove_iso(self):
283 var_Rpath_iso=self.var_Rpath+"/iso"
284 file_iso=var_Rpath_iso+"/"+functions.i2s(self.var_disc_n)+".iso"
285
286 self.txtInfo.append("Deleting iso file: "+functions.i2s(self.var_disc_n)+".iso")
287
288 if os.path.isfile(file_iso):
289 os.remove(file_iso)
290
291 #Si es el ultimo disco se termina el proceso
292 def is_last_disc_and_copy(self):
293 if self.var_disc_n == self.var_Discs and self.var_copy_n == self.var_Copys:
294 self.function_final()
295 else:
296 next_disc(self)
297
298 #Define cual es el siguiente disco a grabar y que paso seguir
299 def next_disc(self, error = False):
300 if self.var_copy_n == self.var_Copys:
301 self.var_disc_n += 1
302 self.var_copy_n = 1
303 self.var_step = 0
304
305 else:
306 self.var_copy_n += 1
307 self.var_step = 1
308
309 var_index = ( ( (self.var_disc_n - 1) * self.var_Copys) + (self.var_copy_n - 1) - self.var_burned_discs ) % len(self.var_devices)
310
311 self.txtInfo.append("NEXT DISC: "+str(self.var_disc_n)+" COPY: "+str(self.var_copy_n)
312 +" INDEX: "+str(var_index)+" STEP: "+str(self.var_step))
313 self.txtInfo.append("\n")
314
315 if var_index == 0 :
316 self.function_eject()
317
318 elif self.var_step == 0:
319 self.function_iso()
320 elif self.var_step == 1:
321 self.function_burn()
@@ -52,8 +52,6
52 #----------------------------------- expulsa los dispositivos de grabacion --------------------------------------------
52 #----------------------------------- expulsa los dispositivos de grabacion --------------------------------------------
53
53
54 def eject_devices(self):
54 def eject_devices(self):
55 self.txtInfo.append("Ejecting recording devices")
56 return
57 for var_dev in self.var_devices:
55 for var_dev in self.var_devices:
58 var_cmd = 'eject ' + var_dev
56 var_cmd = 'eject ' + var_dev
59 commands.getstatusoutput(var_cmd)
57 commands.getstatusoutput(var_cmd)
@@ -32,6 +32,8
32
32
33 def setupUi2(self):
33 def setupUi2(self):
34
34
35 self.var_real = False
36
35 # Reconocimiento de los dispositivos de grabacion
37 # Reconocimiento de los dispositivos de grabacion
36 # functions2.detect_devices(self) #busca los dispositivos de grabacion
38 # functions2.detect_devices(self) #busca los dispositivos de grabacion
37 ####################################
39 ####################################
@@ -44,7 +46,8
44 self.var_disc_n = 0 # disco actual
46 self.var_disc_n = 0 # disco actual
45 self.var_copy_n = 0 # copia actual
47 self.var_copy_n = 0 # copia actual
46 self.var_burned_discs = 0 #numero de discos ya grabados
48 self.var_burned_discs = 0 #numero de discos ya grabados
47
49
50 self.bool_first_iso = False
48 self.var_step = 0 # numero de paso en el proceso
51 self.var_step = 0 # numero de paso en el proceso
49 self.bool_state_burning = False #si es True se puede grabar
52 self.bool_state_burning = False #si es True se puede grabar
50 self.blank_discs = False # Si es true significa que se acaban de ingresar discos en blanco
53 self.blank_discs = False # Si es true significa que se acaban de ingresar discos en blanco
@@ -56,6 +59,7
56 #Revisa si existe el archivo de confirguracion y lo carga
59 #Revisa si existe el archivo de confirguracion y lo carga
57 if os.path.isfile("parameters.conf"):
60 if os.path.isfile("parameters.conf"):
58 functions2.get_parameters_conf(self)
61 functions2.get_parameters_conf(self)
62 self.bool_first_iso = True
59 self.txtInfo.append("Parameters were loaded from configuration file")
63 self.txtInfo.append("Parameters were loaded from configuration file")
60 self.txtInfo.append("Total number of discs for recording: "+str(self.var_Discs * self.var_Copys))
64 self.txtInfo.append("Total number of discs for recording: "+str(self.var_Discs * self.var_Copys))
61
65
@@ -112,6 +116,8
112 self.var_copy_n = dlgui.txtCopy.value()
116 self.var_copy_n = dlgui.txtCopy.value()
113 self.txtInfo.append("Changed parameters")
117 self.txtInfo.append("Changed parameters")
114 self.var_burned_discs = ( ( (self.var_disc_n - 1) * self.var_Copys) + self.var_copy_n -1 )
118 self.var_burned_discs = ( ( (self.var_disc_n - 1) * self.var_Copys) + self.var_copy_n -1 )
119 self.bool_first_iso = True
120
115
121
116
122
117 def about(self):
123 def about(self):
@@ -333,7 +339,10
333
339
334 #Se bloquean los parametros de configuracion
340 #Se bloquean los parametros de configuracion
335 functions2.enabled_items1(True, self)
341 functions2.enabled_items1(True, self)
336
342 self.var_disc_n = 1
343 self.var_copy_n = 1
344 self.bool_first_iso = True
345 self.var_burned_discs = 0 #numero de discos grabados
337
346
338
347
339 #----------------------------------------------------- Permite reiniciar la configuracion ---------------------------------------------------------------
348 #----------------------------------------------------- Permite reiniciar la configuracion ---------------------------------------------------------------
@@ -352,6 +361,7
352 self.btnStartburn.setText("Start Burn")
361 self.btnStartburn.setText("Start Burn")
353
362
354
363
364
355 #==============================================================================
365 #==============================================================================
356 # Acciones de los procesos
366 # Acciones de los procesos
357 #==============================================================================
367 #==============================================================================
@@ -371,15 +381,15
371 return
381 return
372
382
373 if self.process_iso.exitCode() == 0:
383 if self.process_iso.exitCode() == 0:
374 self.txtInfo.append("Iso file"+function.i2s(self.var_disc_n)+" created successfully \n")
384 self.txtInfo.append("------Iso file: "+functions.i2s(self.var_disc_n)+" created successfully")
375 self.var_step = 1
385 self.var_step = 1
376 self.function_burn()
386 self.function_burn()
377
387
378 else:
388 else:
379 self.txtInfo.append("Error creating iso file "+function.i2s(self.var_disc_n)
389 self.txtInfo.append("#####Error creating iso file "+function.i2s(self.var_disc_n)
380 +" , code "+QtCore.QString(self.process_iso.exitCode()))
390 +" , code "+QtCore.QString(self.process_iso.exitCode()))
381 self.txtInfo.append("Please check the data \n")
391 self.txtInfo.append("Please check the data")
382
392 self.txtInfo.append("FATAL ERROR")
383 #----------------------------------------------------- Funciones del proceso de grabado ---------------------------------------------------------------
393 #----------------------------------------------------- Funciones del proceso de grabado ---------------------------------------------------------------
384
394
385 def readOuput_burn(self):
395 def readOuput_burn(self):
@@ -390,26 +400,26
390
400
391 def finished_burn(self):
401 def finished_burn(self):
392 self.txtProgress.clear()
402 self.txtProgress.clear()
393
403
404 #Si se paro el proceso manualmente se termina
394 if not(self.bool_state_burning):
405 if not(self.bool_state_burning):
395 return
406 return
407
408 functions2.make_burning_conf(self) # Si el proceso no ha sido detenido manualmente
409 #crea el archivo burning.conf para el seguimiento de los discos grabados
396
410
397 if self.process_burn.exitCode() == 0:
411 if self.process_burn.exitCode() == 0:
398 self.txtInfo.append("Complete recording, disc: "+self.var_disc_n+" copy: "+self.var_copy_n)
412 self.txtInfo.append("-----Complete recording, disc: "+str(self.var_disc_n)+" copy: "+str(self.var_copy_n))
399 functions2.update_message(1, "COMPLETED", self)
413 functions2.update_message(1, "COMPLETED", self)
400 self.var_step = 2
414 self.var_step = 2
401 self.function_check()
415 self.function_check()
402
416
403 else:
417 else:
404 self.txtInfo.append("Error recording, disc: "+function.i2s(self.var_disc_n)+" copy: "
418 self.txtInfo.append("#######Error recording, disc: "+function.i2s(self.var_disc_n)+" copy: "
405 +function.i2s(self.var_copy_n)+", code "+QtCore.QString(self.process_burn.exitCode()))
419 +function.i2s(self.var_copy_n)+", code "+QtCore.QString(self.process_burn.exitCode()))
406 functions2.update_message(1, "ERROR", self)
420 functions2.update_message(1, "ERROR", self)
407
421
408 functions.next_var_disc(self, True)
422 functions.is_last_disc_and_copy(self)
409 if self.var_step == 0:
410 self.function_iso()
411 elif self.var_step == 1:
412 self.function_burn()
413
423
414
424
415 #----------------------------------------------------- Funciones del proceso de verificacion ---------------------------------------------------------------
425 #----------------------------------------------------- Funciones del proceso de verificacion ---------------------------------------------------------------
@@ -427,15 +437,15
427 return
437 return
428
438
429 if self.process_check.exitCode() == 0:
439 if self.process_check.exitCode() == 0:
430 self.txtInfo.append("Complete checking, disc: "+self.var_disc_n+" copy: "+self.var_copy_n)
440 self.txtInfo.append("--------Complete checking, disc: "+str(self.var_disc_n)+" copy: "+str(self.var_copy_n))
431 functions2.update_message(2, "CHECKED", self)
441 functions2.update_message(2, "CHECKED", self)
432
442
433 else:
443 else:
434 self.txtInfo.append("Error checking, disc: "+function.i2s(self.var_disc_n)+" copy: "
444 self.txtInfo.append("#######Error checking, disc: "+function.i2s(self.var_disc_n)+" copy: "
435 +function.i2s(self.var_copy_n)+", code "+QtCore.QString(self.process_check.exitCode()))
445 +function.i2s(self.var_copy_n)+", code "+QtCore.QString(self.process_check.exitCode()))
436 functions2.update_message(2, "ERROR", self)
446 functions2.update_message(2, "ERROR", self)
437
447
438 self.function_check()
448 functions.is_last_disc_and_copy(self)
439
449
440
450
441
451
@@ -450,105 +460,102
450 """
460 """
451 Se inicia el proceso de grabacion
461 Se inicia el proceso de grabacion
452 """
462 """
453 self.txtInfo.append("BUTTON: on_btnStartburn_clicked")
454
455 #Verifica que exista algun dispositivo de grabacion seleccionado
463 #Verifica que exista algun dispositivo de grabacion seleccionado
456 if not(functions2.selected_devices(self)):
464 if not(functions2.selected_devices(self)):
457 self.txtInfo.append("There is no recording device selected")
465 self.txtInfo.append("There is no recording device selected")
458 return
466 return
459
467
460 # #Lista los dispositivos de grabacion a usar
468 # #Lista los dispositivos de grabacion a usar
461 # for dev in self.var_devices:
469 # for dev in self.var_devices:
462 # self.txtInfo.append("recording device :"+dev)
470 # self.txtInfo.append("recording device :"+dev)
463
471
464 #Si se ingresaron los DVDs en blanco
472 self.bool_state_burning = True
465 if self.blank_discs == True:
473 functions2.enabled_items2(True, self)
466 self.btnStartburn.setEnabled(False)
474
467 self.burning()
475 if self.bool_first_iso == True:
476 self.txtInfo.append("BUTTON: on_btnStartburn_clicked")
477 self.var_step = 4
478 self.function_eject()
468 return
479 return
469
480
470 #Si se cargo los parametros de burning.conf
481 if self.var_step == 0:
471 if self.var_burned_discs != 0:
482 self.function_iso()
472 self.txtInfo.append("BURNED DISC: "+str(self.var_burned_discs))
473 self.var_step = 0
474 self.bool_state_burning = True
475 self.blank_discs = False
476 functions2.enabled_items2(True, self)
477 self.burning()
478 return
483 return
479
484
480 #Asigna las variables con los valores iniciales
485 if self.var_step == 1:
481 self.var_disc_n = 1 # numero de disco actual para grabacion
486 self.function_burn()
482 self.var_copy_n = 1
487 return
483 self.var_burned_discs = 0 #numero de discos grabados
488
484 self.var_step = 0
485 self.bool_state_burning = True
486 self.blank_discs = False
487 functions2.enabled_items2(True, self)
488 self.burning()
489
490 #----------------------------------------------------- Funcion para el grabado ---------------------------------------------------------------
489 #----------------------------------------------------- Funcion para el grabado ---------------------------------------------------------------
491
490
492 def burning(self):
491 def function_iso(self):
493
494 var_Rpath_ppath=self.var_Rpath+"/ppath"
495 var_Rpath_iso=self.var_Rpath+"/iso"
496
497 #Si ya se grabaron todas las copias del disco
498 if self.var_copy_n > self.var_Copys:
499 #borra la imagen.iso del numero de disco anterior
500 file_iso=var_Rpath_iso+"/"+functions.i2s(self.var_disc_n)+".iso"
501 # self.txtInfo.append("Deleting iso file")
502 # os.remove(file_iso)
503 self.var_copy_n = 1
504 self.var_disc_n += 1 # aumenta numero de disco actual para grabacion
505 self.var_step = 0
506
507 #Si ya se grabaron todos los discos
508 if self.var_disc_n > self.var_Discs:
509 self.bool_state_burning = False
510 self.txtInfo.append("Recording process is complete")
511 functions2.eject_devices(self) # Expulsa las bandejas de los dispostivos de grabacion
512 self.on_btnRestart_clicked()
513 self.btnStopburn.setEnabled(False)
514 return
515
516 # self.txtInfo.append("\n"+str(self.var_disc_n)+" "+str(self.var_copy_n)+" "+str(self.var_step))
517
518 #Creacion del archivo.iso para la grabacion
492 #Creacion del archivo.iso para la grabacion
519 if self.var_step == 0:
493 if self.var_step == 0:
520 self.txtInfo.append("########## Disc number: "+str(self.var_disc_n)+"##########")
494 self.txtInfo.append("########## Disc number: "+str(self.var_disc_n)+"##########")
521 self.txtInfo.append("---------Creating iso file number: "+str(self.var_disc_n))
495 self.txtInfo.append("------Creating iso file number: "+str(self.var_disc_n))
522 var_cmd = functions.cmd_iso(self)
496
523
497 if self.var_real == True:
498 var_cmd = functions.cmd_iso(self)
499 else:
500 self.txtInfo.append('**function_iso')
501 var_cmd="echo 'function_iso'"
502
503 self.process_iso.start(var_cmd)
504
505 def function_burn(self):
524 #Grabacion de los DVDs
506 #Grabacion de los DVDs
525 elif self.var_step == 1:
507 if self.var_step == 1:
526
508 self.txtInfo.append("------Recording disc: "+str(self.var_copy_n)+", copy:"+str(self.var_copy_n))
527 functions2.make_burning_conf(self)
528
529 var_index = ( ( (self.var_disc_n - 1) * self.var_Copys) + (self.var_copy_n - 1) - self.var_burned_discs ) % len(self.var_devices)
530 # self.txtInfo.append("INDEX: "+str(var_index))
531 if var_index == 0 and self.blank_discs == False:
532 functions2.eject_devices(self) # Expulsa las bandejas de los dispostivos de grabacion
533 self.blank_discs = True
534 self.btnStartburn.setText("Continue")
535 self.btnStartburn.setEnabled(True)
536 return
537
538 self.blank_discs = False
539
540 self.txtInfo.append("recording disc:"+str(self.var_copy_n)+", copy:"+str(self.var_copy_n))
541 functions2.update_message(1, "BURNING", self)
509 functions2.update_message(1, "BURNING", self)
542
510
543 var_dev_tmp = self.var_devices[var_index]
511 if self.var_real == True:
544 file_iso=var_Rpath_iso+"/"+functions.i2s(self.var_disc_n)+".iso"
512 var_cmd = functions.cmd_burn(self)
545 var_cmd = "wodim -v dev="+var_dev_tmp+" speed=16 "+ file_iso
513 else:
546
514 self.txtInfo.append('**function_burn')
547 self.var_process.start('echo "comando"')
515 var_cmd="echo 'function_burn'"
548 # self.txtInfo.append("CMD: "+var_cmd)
516
549
517 self.process_burn.start(var_cmd)
550 # self.txtInfo.append("creando iso")
518
551 # self.var_process.start(var_cmd)
519 def function_check(self):
520 #Verificacion de los discos
521 if self.var_step == 2:
522 self.txtInfo.append("-----------checking disc:"+str(self.var_copy_n)+", copy:"+str(self.var_copy_n))
523 functions2.update_message(2, "CHECKING", self)
524
525 if self.var_real == True:
526 var_cmd = functions.cmd_check(self)
527 else:
528 self.txtInfo.append('**function_check')
529 var_cmd="echo 'function_check'"
530
531 self.process_check.start(var_cmd)
532
533 #OK
534 def function_eject(self):
535 self.txtInfo.append("Ejecting recording devices")
536 self.txtInfo.append("Please insert blank discs")
537
538 if self.var_real == True:
539 functions2.eject_devices(self) # Expulsa las bandejas de los dispostivos de grabacion
540 else:
541 self.txtInfo.append("**functions2.eject_devices")
542
543 self.btnStartburn.setText("Continue")
544 self.btnStartburn.setEnabled(True)
545
546 if self.bool_first_iso == True:
547 self.bool_first_iso = False
548 self.var_step = 0
549
550 elif self.var_copy_n == 1:
551 self.var_step = 0
552
553 else:
554 self.var_step = 1
555
556 def function_final(self):
557 self.txtInfo.append("Recording process is complete")
558
552
559
553
560
554 #----------------------------------------------------- Detener proceso de grabacion ---------------------------------------------------------------
561 #----------------------------------------------------- Detener proceso de grabacion ---------------------------------------------------------------
@@ -569,7 +576,9
569 self.process_check.terminate()
576 self.process_check.terminate()
570
577
571 self.txtInfo.append("Stopped recording")
578 self.txtInfo.append("Stopped recording")
572 functions2.enabled_items2(False, self)
579 functions2.enabled_items2(False, self)
580 self.bool_first_iso = True
581
573
582
574
583
575 #==============================================================================
584 #==============================================================================
@@ -6,7 +6,7
6 <rect>
6 <rect>
7 <x>0</x>
7 <x>0</x>
8 <y>0</y>
8 <y>0</y>
9 <width>621</width>
9 <width>824</width>
10 <height>717</height>
10 <height>717</height>
11 </rect>
11 </rect>
12 </property>
12 </property>
@@ -1266,8 +1266,8
1266 <rect>
1266 <rect>
1267 <x>0</x>
1267 <x>0</x>
1268 <y>0</y>
1268 <y>0</y>
1269 <width>621</width>
1269 <width>824</width>
1270 <height>21</height>
1270 <height>25</height>
1271 </rect>
1271 </rect>
1272 </property>
1272 </property>
1273 <widget class="QMenu" name="menuFile">
1273 <widget class="QMenu" name="menuFile">
General Comments 0
You need to be logged in to leave comments. Login now