@@ -257,3 +257,13 | |||
|
257 | 257 | |
|
258 | 258 | return var_lines |
|
259 | 259 | |
|
260 | def cmd_iso(self): | |
|
261 | var_Rpath_ppath=self.var_Rpath+"/ppath" | |
|
262 | var_Rpath_iso=self.var_Rpath+"/iso" | |
|
263 | #comando para la creacion del archivo.iso | |
|
264 | file_dat=var_Rpath_ppath+"/"+self.var_Elabel+"_"+i2s(self.var_disc_n)+".dat" | |
|
265 | file_iso=var_Rpath_iso+"/"+i2s(self.var_disc_n)+".iso" | |
|
266 | var_cmd = 'genisoimage -hide-joliet-trans-tbl -joliet-long -r ' | |
|
267 | var_cmd += ' -A '+self.var_Elabel+' -V '+self.var_Elabel | |
|
268 | var_cmd += ' -graft-points -path-list '+ file_dat+' -o '+file_iso | |
|
269 | return var_cmd |
@@ -53,6 +53,8 | |||
|
53 | 53 | #----------------------------------- expulsa los dispositivos de grabacion -------------------------------------------- |
|
54 | 54 | |
|
55 | 55 | def eject_devices(self): |
|
56 | self.txtInfo.append("Ejecting recording devices") | |
|
57 | return | |
|
56 | 58 | for var_dev in self.var_devices: |
|
57 | 59 | var_cmd = 'eject ' + var_dev |
|
58 | 60 | commands.getstatusoutput(var_cmd) |
@@ -129,6 +131,10 | |||
|
129 | 131 | self.var_Discs = int(lines[8]) #8 |
|
130 | 132 | # var_StartDay = int(lines[6]) #9 |
|
131 | 133 | # var_StopDay = int(lines[7]) #10 |
|
134 | ################################ | |
|
135 | self.var_Copys = self.txtCopys.value() #5 | |
|
136 | ################################ | |
|
137 | ||
|
132 | 138 | var_file.close() |
|
133 | 139 | |
|
134 | 140 | |
@@ -145,6 +151,27 | |||
|
145 | 151 | self.var_lstDcapacity = self.lstDcapacity.currentIndex() #6 |
|
146 | 152 | self.var_Dcapacity = self.txtDcapacity.value() #7 |
|
147 | 153 | self.var_Discs = self.var_Discs #8 |
|
154 | ||
|
155 | ||
|
156 | #-------------------------- crea burning.conf ----------------------------- | |
|
157 | ||
|
158 | def make_burning_conf(self): | |
|
159 | var_file = open("burning.conf","w") | |
|
160 | var_n_burned_discs = ( ( (self.var_disc_n - 1) * self.var_Copys) + self.var_copy_n -1 ) | |
|
161 | var_file.write(str(var_n_burned_discs)+"\n") #0 Numero de discos ya grabados | |
|
162 | var_file.write(str(self.var_disc_n)+"\n") #1 Disco actual para grabar | |
|
163 | var_file.write(str(self.var_copy_n)+"\n") #2 Numero de copia actual para grabar | |
|
164 | var_file.close() | |
|
165 | ||
|
166 | #----------------------------------------------------- carga burning.conf --------------------------------------------------------------- | |
|
167 | ||
|
168 | def get_burning_conf(self): | |
|
169 | var_file = open("burning.conf","r") | |
|
170 | lines = var_file.readlines() | |
|
171 | self.var_burned_discs = int(lines[0]) #0 | |
|
172 | self.var_disc_n = int(lines[1]) | |
|
173 | self.var_copy_n = int(lines[2]) | |
|
174 | var_file.close() | |
|
148 | 175 | |
|
149 | 176 | #---------------------------------------------- Habilitacion y deshabilitacion de items ------------------------------------------------------- |
|
150 | 177 |
@@ -1,7 +1,7 | |||
|
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
|
2 | 2 | <!DOCTYPE Project SYSTEM "Project-4.6.dtd"> |
|
3 | 3 | <!-- eric4 project file for project jro_backup_manager --> |
|
4 |
<!-- Saved: 2010-05-24, |
|
|
4 | <!-- Saved: 2010-05-24, 15:03:39 --> | |
|
5 | 5 | <!-- Copyright (C) 2010 , --> |
|
6 | 6 | <Project version="4.6"> |
|
7 | 7 | <Language>en</Language> |
@@ -21,15 +21,11 | |||
|
21 | 21 | <Source>functions/functions.py</Source> |
|
22 | 22 | <Source>functions/functions2.py</Source> |
|
23 | 23 | <Source>functions/func_doc.py</Source> |
|
24 | <Source>ui/Ui_About2.py</Source> | |
|
25 | <Source>ui/Ui_Parameters2.py</Source> | |
|
26 | 24 | <Source>ui/Ui_About.py</Source> |
|
27 | 25 | <Source>ui/Ui_Parameters.py</Source> |
|
28 | 26 | </Sources> |
|
29 | 27 | <Forms> |
|
30 | 28 | <Form>ui/MainWindow.ui</Form> |
|
31 | <Form>ui/About2.ui</Form> | |
|
32 | <Form>ui/Parameters2.ui</Form> | |
|
33 | 29 | <Form>ui/About.ui</Form> |
|
34 | 30 | <Form>ui/Parameters.ui</Form> |
|
35 | 31 | </Forms> |
@@ -39,6 +39,7 | |||
|
39 | 39 | self.var_Copys = 0 #Numero de copias |
|
40 | 40 | self.var_disc_n = 0 |
|
41 | 41 | self.var_copy_n = 0 |
|
42 | self.var_burned_discs = 0 | |
|
42 | 43 | |
|
43 | 44 | self.var_list=[] |
|
44 | 45 | self.var_sublist=[] |
@@ -52,8 +53,8 | |||
|
52 | 53 | |
|
53 | 54 | #Revisa si existe el archivo de confirguracion |
|
54 | 55 | if os.path.isfile("parameters.conf"): |
|
56 | functions2.get_parameters_conf(self) | |
|
55 | 57 | self.txtInfo.append("Parameters were loaded from configuration file") |
|
56 | functions2.get_parameters_conf(self) | |
|
57 | 58 | self.txtInfo.append("Total number of discs for recording: "+str(self.var_Discs * self.var_Copys)) |
|
58 | 59 | |
|
59 | 60 | else: |
@@ -68,7 +69,18 | |||
|
68 | 69 | |
|
69 | 70 | if os.path.isfile("parameters.conf"): |
|
70 | 71 | functions2.enabled_items1(True, self) #Se bloquean los parametros de configuracion |
|
71 | ||
|
72 | ||
|
73 | if os.path.isfile("burning.conf"): | |
|
74 | functions2.get_burning_conf(self) | |
|
75 | self.txtInfo.append("Current disc: "+str(self.var_disc_n)) | |
|
76 | self.txtInfo.append("Current copy: "+str(self.var_copy_n)) | |
|
77 | self.btnStartburn.setText("Continue") | |
|
78 | ||
|
79 | self.txtDeviceA.setText("/dev/scd0") | |
|
80 | self.txtDeviceB.setText("/dev/scd1") | |
|
81 | self.txtDeviceC.setText("/dev/scd2") | |
|
82 | self.txtDeviceD.setText("/dev/scd3") | |
|
83 | ||
|
72 | 84 | self.connect(self.actionChange_Parameters, QtCore.SIGNAL("triggered()"), self.changeParameters) |
|
73 | 85 | self.connect(self.actionAbout, QtCore.SIGNAL("triggered()"), self.about) |
|
74 | 86 | |
@@ -111,11 +123,22 | |||
|
111 | 123 | self.txtInfo.insertPlainText("stdout: " + QtCore.QString(self.var_process.readAllStandardOutput())) |
|
112 | 124 | |
|
113 | 125 | def readError(self): |
|
114 | self.txtInfo.setText("stderr: " + QtCore.QString(self.var_process.readAllStandardError())) | |
|
126 | self.txtInfo.insertPlainText("stderr: " + QtCore.QString(self.var_process.readAllStandardError())) | |
|
115 | 127 | |
|
116 | 128 | def finished(self): |
|
117 |
self.txtInfo. |
|
|
118 | if self.var_disc_n <= self.var_Discs and self.bool_state_burning: | |
|
129 | self.txtInfo.insertPlainText("process completed"+QtCore.QString(self.var_process.exitCode())+"\n") | |
|
130 | ||
|
131 | ||
|
132 | if self.var_process.exitCode() != 0: | |
|
133 | self.txtInfo.append("ERROR") | |
|
134 | ||
|
135 | if self.bool_state_burning: | |
|
136 | if self.var_step == 0: | |
|
137 | self.var_step = 1 #Se ira al paso de la grabacion en la siguiente llamada | |
|
138 | ||
|
139 | elif self.var_step == 1: | |
|
140 | self.var_copy_n += 1 | |
|
141 | ||
|
119 | 142 | self.burning() |
|
120 | 143 | |
|
121 | 144 | |
@@ -128,7 +151,7 | |||
|
128 | 151 | self.txtInfo.setText("stderr check: " + QtCore.QString(self.var_process_check.readAllStandardError())) |
|
129 | 152 | |
|
130 | 153 | def finished_check(self): |
|
131 |
self.txtInfo.append("proces |
|
|
154 | self.txtInfo.append("check process completed "+QtCore.QString(self.var_process_check.exitCode())+"\n") | |
|
132 | 155 | |
|
133 | 156 | |
|
134 | 157 | #----------------------------------------------------- Obtencion de la ruta de los datos --------------------------------------------------------------- |
@@ -323,8 +346,14 | |||
|
323 | 346 | """ |
|
324 | 347 | Permite que se puedan cambiar los parametros |
|
325 | 348 | """ |
|
349 | if os.path.isfile("parameters.conf"): | |
|
350 | os.remove("parameters.conf") | |
|
351 | if os.path.isfile("burning.conf"): | |
|
352 | os.remove("burning.conf") | |
|
353 | ||
|
326 | 354 | functions2.enabled_items1(False, self) |
|
327 | os.remove("parameters.conf") | |
|
355 | self.btnStartburn.setText("Start Burn") | |
|
356 | ||
|
328 | 357 | |
|
329 | 358 | |
|
330 | 359 | #----------------------------------------------------- Iniciar proceso de grabacion --------------------------------------------------------------- |
@@ -334,74 +363,82 | |||
|
334 | 363 | """ |
|
335 | 364 | Se inicia el proceso de grabacion |
|
336 | 365 | """ |
|
337 | ||
|
366 | self.txtInfo.append("BUTTON: on_btnStartburn_clicked") | |
|
367 | #Verifica que exista algun dispositivo de grabacion seleccionado | |
|
368 | if not(functions2.selected_devices(self)): | |
|
369 | self.txtInfo.append("There is no recording device selected") | |
|
370 | return | |
|
371 | ||
|
372 | # #Lista los dispositivos de grabacion a usar | |
|
373 | # for dev in self.var_devices: | |
|
374 | # self.txtInfo.append("recording device :"+dev) | |
|
375 | ||
|
376 | #Si se ingresaron los DVDs en blanco | |
|
338 | 377 | if self.blank_discs == True: |
|
339 | 378 | self.btnStartburn.setEnabled(False) |
|
340 | 379 | self.burning() |
|
341 | 380 | return |
|
342 | ||
|
343 | #Verifica que exista algun dispositivo de grabacion seleccionado | |
|
344 | if not(functions2.selected_devices(self)): | |
|
345 | self.txtInfo.append("There is no recording device selected") | |
|
381 | ||
|
382 | #Si se cargo los parametros de burning.conf | |
|
383 | if self.var_burned_discs != 0: | |
|
384 | self.txtInfo.append("BURNED DISC: "+str(self.var_burned_discs)) | |
|
385 | self.var_step = 0 | |
|
386 | self.bool_state_burning = True | |
|
387 | self.blank_discs = False | |
|
388 | functions2.enabled_items2(True, self) | |
|
389 | self.burning() | |
|
346 | 390 | return |
|
347 | ||
|
348 | #Lista los dispositivos de grabacion a usar | |
|
349 | for dev in self.var_devices: | |
|
350 | self.txtInfo.append("recording device :"+dev) | |
|
351 | 391 | |
|
352 | 392 | #Asigna las variables con los valores iniciales |
|
353 |
self.var_disc_n = |
|
|
354 |
self.var_copy_n = |
|
|
393 | self.var_disc_n = 1 # numero de disco actual para grabacion | |
|
394 | self.var_copy_n = 1 | |
|
395 | self.var_burned_discs = 0 #numero de discos grabados | |
|
355 | 396 | self.var_step = 0 |
|
356 | 397 | self.bool_state_burning = True |
|
357 | 398 | self.blank_discs = False |
|
358 | ||
|
359 | 399 | functions2.enabled_items2(True, self) |
|
360 | 400 | self.burning() |
|
361 | 401 | |
|
402 | ||
|
362 | 403 | def burning(self): |
|
363 | 404 | |
|
364 | 405 | var_Rpath_ppath=self.var_Rpath+"/ppath" |
|
365 | 406 | var_Rpath_iso=self.var_Rpath+"/iso" |
|
407 | ||
|
408 | #Si ya se grabaron todas las copias del disco | |
|
409 | if self.var_copy_n > self.var_Copys: | |
|
410 | #borra la imagen.iso del numero de disco anterior | |
|
411 | file_iso=var_Rpath_iso+"/"+functions.i2s(self.var_disc_n)+".iso" | |
|
412 | self.txtInfo.append("Deleting iso file") | |
|
413 | # os.remove(file_iso) | |
|
414 | self.var_copy_n = 1 | |
|
415 | self.var_disc_n += 1 # aumenta numero de disco actual para grabacion | |
|
416 | self.var_step = 0 | |
|
417 | ||
|
418 | #Si ya se grabaron todos los discos | |
|
419 | if self.var_disc_n > self.var_Discs: | |
|
420 | self.bool_state_burning = False | |
|
421 | self.txtInfo.append("Recording process is complete") | |
|
422 | functions2.eject_devices(self) # Expulsa las bandejas de los dispostivos de grabacion | |
|
423 | return | |
|
424 | ||
|
425 | self.txtInfo.append("\n"+str(self.var_disc_n)+" "+str(self.var_copy_n)+" "+str(self.var_step)) | |
|
366 | 426 | |
|
367 | 427 | #Creacion del archivo.iso para la grabacion |
|
368 | 428 | if self.var_step == 0: |
|
369 | #borra la imagen.iso del numero de disco anterior | |
|
370 | if self.var_disc_n > 0: | |
|
371 | file_iso=var_Rpath_iso+"/"+functions.i2s(self.var_disc_n)+".iso" | |
|
372 | # os.remove(file_iso) | |
|
373 | ||
|
374 | self.var_disc_n += 1 # aumenta numero de disco actual para grabacion | |
|
375 | self.var_copy_n = 0 # Resetea el numero actual de la copia | |
|
376 | ||
|
377 | #Si ya se grabaron todos los discos | |
|
378 | if self.var_disc_n > self.var_Discs: | |
|
379 | self.bool_state_burning = False | |
|
380 | self.txtInfo.append("Recording process is complete") | |
|
381 | # functions2.eject_devices(self) # Expulsa las bandejas de los dispostivos de grabacion | |
|
382 | ||
|
383 | return | |
|
384 | ||
|
385 | self.txtInfo.append("########## DISCO NUMERO: "+str(self.var_disc_n)+"##########") | |
|
386 | self.txtInfo.append("--------Creando el iso del disco numero: "+str(self.var_disc_n)) | |
|
387 | ||
|
388 | #comando para la creacion del archivo.iso | |
|
389 | file_dat=var_Rpath_ppath+"/"+self.var_Elabel+"_"+functions.i2s(self.var_disc_n)+".dat" | |
|
390 | file_iso=var_Rpath_iso+"/"+functions.i2s(self.var_disc_n)+".iso" | |
|
391 | var_cmd = 'genisoimage -hide-joliet-trans-tbl -joliet-long -r ' | |
|
392 | var_cmd += ' -A '+self.var_Elabel+' -V '+self.var_Elabel | |
|
393 | var_cmd += ' -graft-points -path-list '+ file_dat+' -o '+file_iso | |
|
394 | self.var_step = 1 #Se ira al paso de la grabacion en la siguiente llamada | |
|
429 | self.txtInfo.append("########## Disc number: "+str(self.var_disc_n)+"##########") | |
|
430 | self.txtInfo.append("---------Creating iso file number: "+str(self.var_disc_n)) | |
|
431 | var_cmd = functions.cmd_iso(self) | |
|
395 | 432 | |
|
396 | 433 | #Grabacion de los DVDs |
|
397 | 434 | elif self.var_step == 1: |
|
398 | self.var_copy_n += 1 # numero de copia actual | |
|
399 | var_index = ( ( (self.var_disc_n - 1) * self.var_Copys) + (self.var_copy_n - 1) ) % len(self.var_devices) | |
|
435 | ||
|
436 | functions2.make_burning_conf(self) | |
|
437 | ||
|
438 | var_index = ( ( (self.var_disc_n - 1) * self.var_Copys) + (self.var_copy_n - 1) - self.var_burned_discs ) % len(self.var_devices) | |
|
400 | 439 | |
|
401 | 440 | if var_index == 0 and self.blank_discs == False: |
|
402 | self.txtInfo.append("EXPULSANDO BANDEJAS") | |
|
403 | self.var_copy_n -= 1 #El numero de copia se regresa al estado anterior | |
|
404 | # functions2.eject_devices(self) # Expulsa las bandejas de los dispostivos de grabacion | |
|
441 | functions2.eject_devices(self) # Expulsa las bandejas de los dispostivos de grabacion | |
|
405 | 442 | self.blank_discs = True |
|
406 | 443 | self.btnStartburn.setText("Continue") |
|
407 | 444 | self.btnStartburn.setEnabled(True) |
@@ -410,16 +447,13 | |||
|
410 | 447 | self.blank_discs = False |
|
411 | 448 | |
|
412 | 449 | self.txtInfo.append("Grabando la copia numero: "+str(self.var_copy_n)) |
|
413 | #Si esta es la ultima copia se pasara al siguiente disco en la siguiente llamada a la funcion | |
|
414 | if self.var_copy_n == self.var_Copys: | |
|
415 | self.var_step = 0 | |
|
416 | 450 | |
|
417 | 451 | var_dev_tmp = self.var_devices[var_index] |
|
418 | 452 | file_iso=var_Rpath_iso+"/"+functions.i2s(self.var_disc_n)+".iso" |
|
419 | 453 | var_cmd = "wodim -v dev="+var_dev_tmp+" speed=16 "+ file_iso |
|
420 | 454 | |
|
421 |
self.var_process.start(' |
|
|
422 | self.txtInfo.append("CMD: "+var_cmd) | |
|
455 | self.var_process.start('echo "comando"') | |
|
456 | # self.txtInfo.append("CMD: "+var_cmd) | |
|
423 | 457 | |
|
424 | 458 | # self.txtInfo.append("creando iso") |
|
425 | 459 | # self.var_process.start(var_cmd) |
@@ -437,7 +471,6 | |||
|
437 | 471 | # self.var_process.kill() #Mata el proceso, no es la forma adecuada, solo usar si terminate() no funciona |
|
438 | 472 | self.txtInfo.append("Stopped recording") |
|
439 | 473 | functions2.enabled_items2(False, self) |
|
440 | self.btnStartburn.setText("Start Burn") | |
|
441 | 474 | |
|
442 | 475 | |
|
443 | 476 | #----------------------------------------------------- Testeo de las unidades de grabacion --------------------------------------------------------------- |
@@ -481,4 +514,4 | |||
|
481 | 514 | """ |
|
482 | 515 | Slot documentation goes here. |
|
483 | 516 | """ |
|
484 | pass | |
|
517 | pass |
General Comments 0
You need to be logged in to leave comments.
Login now