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