##// END OF EJS Templates
falta expulsion bandejas...
ralonso -
r61:62
parent child
Show More
@@ -1,397 +1,402
1 1 # -*- coding: utf-8 -*- No newline at end of file
2 2 No newline at end of file
3 3 """ No newline at end of file
4 4 Module implementing MainWindow. No newline at end of file
5 5 """ No newline at end of file
6 6 No newline at end of file
7 7 from PyQt4.QtGui import QMainWindow No newline at end of file
8 8 from PyQt4.QtCore import pyqtSignature No newline at end of file
9 9 from PyQt4 import QtCore No newline at end of file
10 10 from Ui_MainWindow import Ui_MainWindow No newline at end of file
11 11 from PyQt4 import QtGui No newline at end of file
12 12 from subprocess import * No newline at end of file
13 13 import sys No newline at end of file
14 14 import os No newline at end of file
15 15 #import subprocess No newline at end of file
16 16 import commands No newline at end of file
17 17 from functions import functions No newline at end of file
18 18 from functions import functions2 No newline at end of file
19 19 No newline at end of file
20 20 class MainWindow(QMainWindow, Ui_MainWindow): No newline at end of file
21 21 """ No newline at end of file
22 22 Class documentation goes here. No newline at end of file
23 23 """ No newline at end of file
24 24 No newline at end of file
25 25 def __init__(self, parent = None): No newline at end of file
26 26 QMainWindow.__init__(self, parent) No newline at end of file
27 27 self.setupUi(self) No newline at end of file
28 28 self.setupUi2() No newline at end of file
29 29 #sys.stdout = self #redirige salida estandar No newline at end of file
30 30 No newline at end of file
31 31 def setupUi2(self): No newline at end of file
32 32
33 No newline at end of file
33 functions2.detect_devices(self) #busca los dispositivos de grabacion No newline at end of file
34 34 No newline at end of file
35 35 self.var_Discs = 0 #Numero de discos del proyecto No newline at end of file
36 36 self.var_Copys = 0 #Numero de copias No newline at end of file
37 37 self.var_disc_n = 0 No newline at end of file
38 38 self.var_copy_n = 0 No newline at end of file
39 39 No newline at end of file
40 40 self.var_list=[] No newline at end of file
41 41 self.var_sublist=[] No newline at end of file
42 42 No newline at end of file
43 43 self.var_devices=[] No newline at end of file
44 44 No newline at end of file
45 45 self.var_step = 0 No newline at end of file
46 46 self.bool_state_burning = False No newline at end of file
47 47 No newline at end of file
48 48 No newline at end of file
49 49 #Revisa si existe el archivo de confirguracion No newline at end of file
50 50 if os.path.isfile("parameters.conf"): No newline at end of file
51 51 self.txtInfo.append("Archivo de configuracion encontrado") No newline at end of file
52 52 functions2.get_parameters_conf(self) No newline at end of file
53 53 self.txtInfo.append("El proyecto es de "+str(self.var_Discs)+" discos") No newline at end of file
54 54 else: No newline at end of file
55 55 self.txtInfo.append("Elija los parametros de configuracion") No newline at end of file
56 56 functions2.set_parameters_test(self) #Establece ciertos parametros, para pruebas No newline at end of file
57 57 No newline at end of file
58 58 functions2.set_vars(self) #Carga las variables de la clase con los parametros seleccionados No newline at end of file
59 59 No newline at end of file
60 60 self.statusDpath = functions.dir_exists(self.var_Dpath, self) No newline at end of file
61 61 self.statusRpath = functions.dir_exists(self.var_Rpath, self) No newline at end of file
62 62 functions.load_days(self) No newline at end of file
63 63 No newline at end of file
64 64 if os.path.isfile("parameters.conf"): No newline at end of file
65 65 functions2.enabled_items1(True, self) #Se bloquean los parametros de configuracion No newline at end of file
66 66 No newline at end of file
67 67 No newline at end of file
68 68 self.var_process = QtCore.QProcess() No newline at end of file
69 69 self.connect(self.var_process, QtCore.SIGNAL('readyReadStandardOutput()'), self.readOuput) No newline at end of file
70 70 self.connect(self.var_process, QtCore.SIGNAL('readyReadStandardError()'), self.readError) No newline at end of file
71 71 self.connect(self.var_process, QtCore.SIGNAL('finished(int,QProcess::ExitStatus)'), self.finished) No newline at end of file
72 72 No newline at end of file
73 73 No newline at end of file
74 74 def write(self, txt): No newline at end of file
75 75 self.txtInfo.append(str(txt)) No newline at end of file
76 76 No newline at end of file
77 77 No newline at end of file
78 78 #----------------------------------------------------- Funciones del proceso --------------------------------------------------------------- No newline at end of file
79 79 No newline at end of file
80 80 def readOuput(self): No newline at end of file
81 81 self.txtSburn.insertPlainText("stdout: " + QtCore.QString(self.var_process.readAllStandardOutput())) No newline at end of file
82 82 No newline at end of file
83 83 def readError(self): No newline at end of file
84 84 self.txtSburn.insertPlainText("stderr: " + QtCore.QString(self.var_process.readAllStandardError())) No newline at end of file
85 85 No newline at end of file
86 86 def finished(self):
87 No newline at end of file
87 self.txtInfo.append("proceso terminado finished() "+QtCore.QString(self.var_process.exitCode())) No newline at end of file
88 88 if self.var_disc_n <= self.var_Discs and self.bool_state_burning: No newline at end of file
89 89 self.burning() No newline at end of file
90 90 No newline at end of file
91 91 No newline at end of file
92 92 #----------------------------------------------------- Obtencion de la ruta de los datos --------------------------------------------------------------- No newline at end of file
93 93 No newline at end of file
94 94 @pyqtSignature("") No newline at end of file
95 95 def on_btnDpath_clicked(self): No newline at end of file
96 96 """ No newline at end of file
97 97 Permite seleccionar graficamente el direcorio de los datos a grabar No newline at end of file
98 98 """ No newline at end of file
99 99 self.var_Dpath= str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) No newline at end of file
100 100 self.txtDpath.setText(self.var_Dpath) No newline at end of file
101 101 self.statusDpath = functions.dir_exists(self.var_Dpath, self) No newline at end of file
102 102 functions.load_days(self) No newline at end of file
103 103 No newline at end of file
104 104 No newline at end of file
105 105 @pyqtSignature("") No newline at end of file
106 106 def on_txtDpath_editingFinished(self): No newline at end of file
107 107 """ No newline at end of file
108 108 Carga la ruta editada y verifica que sea correcta y carga la lista de dias No newline at end of file
109 109 """ No newline at end of file
110 110 self.var_Dpath=str(self.txtDpath.text()) #Se carga la variable con la ruta recien editada No newline at end of file
111 111 self.statusDpath = functions.dir_exists(self.var_Dpath, self) No newline at end of file
112 112 functions.load_days(self) No newline at end of file
113 113 No newline at end of file
114 114 No newline at end of file
115 115 #----------------------------------------------------- Obtencion de las ruta del proyecto --------------------------------------------------------------- No newline at end of file
116 116 No newline at end of file
117 117 @pyqtSignature("") No newline at end of file
118 118 def on_btnRpath_clicked(self): No newline at end of file
119 119 """ No newline at end of file
120 120 Permite seleccionar graficamente el direcorio del proyecto No newline at end of file
121 121 """ No newline at end of file
122 122 self.var_Rpath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) No newline at end of file
123 123 self.txtRpath.setText(self.var_Rpath) No newline at end of file
124 124 self.statusRpath = functions.dir_exists(self.var_Rpath, self) No newline at end of file
125 125 No newline at end of file
126 126 No newline at end of file
127 127 @pyqtSignature("") No newline at end of file
128 128 def on_txtRpath_editingFinished(self): No newline at end of file
129 129 """ No newline at end of file
130 130 Valida la ruta del proyecto No newline at end of file
131 131 """ No newline at end of file
132 132 self.var_Rpath = str(self.txtRpath.text()) #Se carga la variable con la ruta recien editada No newline at end of file
133 133 self.statusRpath = functions.dir_exists(self.var_Rpath, self) No newline at end of file
134 134 No newline at end of file
135 135 No newline at end of file
136 136 #----------------------------------------------------- Tipo de datos --------------------------------------------------------------- No newline at end of file
137 137 No newline at end of file
138 138 @pyqtSignature("int") No newline at end of file
139 139 def on_lstDtype_activated(self, index): No newline at end of file
140 140 """ No newline at end of file
141 141 Permite elegir entre los tipos de archivos No newline at end of file
142 142 """ No newline at end of file
143 143 self.txtDtype.setReadOnly(True) No newline at end of file
144 144 if index == 0: No newline at end of file
145 145 self.var_Dtype ='r' No newline at end of file
146 146 elif index == 1: No newline at end of file
147 147 self.var_Dtype ='pdata' No newline at end of file
148 148 elif index == 2: No newline at end of file
149 149 self.var_Dtype ='sswma' No newline at end of file
150 150 else : No newline at end of file
151 151 self.var_Dtype ='' No newline at end of file
152 152 self.txtDtype.setReadOnly(False) No newline at end of file
153 153 No newline at end of file
154 154 self.txtDtype.setText(self.var_Dtype) No newline at end of file
155 155 functions.load_days(self) #llamada a funcion No newline at end of file
156 156 No newline at end of file
157 157 @pyqtSignature("") No newline at end of file
158 158 def on_txtDtype_editingFinished(self): No newline at end of file
159 159 self.var_Dtype=str(self.txtDtype.text()) No newline at end of file
160 160 functions.load_days(self) #llamada a funcion No newline at end of file
161 161 No newline at end of file
162 162 No newline at end of file
163 163 #----------------------------------------------------- Etiqueta --------------------------------------------------------------- No newline at end of file
164 164 No newline at end of file
165 165 @pyqtSignature("") No newline at end of file
166 166 def on_txtElabel_editingFinished(self): No newline at end of file
167 167 self.var_Elabel = str(self.txtElabel.text()) No newline at end of file
168 168 No newline at end of file
169 169 #----------------------------------------------------- Numero de copias --------------------------------------------------------------- No newline at end of file
170 170 @pyqtSignature("") No newline at end of file
171 171 def on_txtCopys_editingFinished(self): No newline at end of file
172 172 self.var_Copys = self.txtCopys.value() No newline at end of file
173 173 No newline at end of file
174 174 #----------------------------------------------------- Seleccion del rango de fechas --------------------------------------------------------------- No newline at end of file
175 175 No newline at end of file
176 176 @pyqtSignature("int") #CLOSED No newline at end of file
177 177 def on_lstStartDay_activated(self, index): No newline at end of file
178 178 """ No newline at end of file
179 179 Cambia la lista de opciones en lstStopDay No newline at end of file
180 180 """ No newline at end of file
181 181 var_StopDay_index=self.lstStopDay.count() - self.lstStopDay.currentIndex() No newline at end of file
182 182 self.lstStopDay.clear() No newline at end of file
183 183 No newline at end of file
184 184 for i in self.var_list[index:]: No newline at end of file
185 185 self.lstStopDay.addItem(i) No newline at end of file
186 186 No newline at end of file
187 187 self.lstStopDay.setCurrentIndex(self.lstStopDay.count() - var_StopDay_index) No newline at end of file
188 188 No newline at end of file
189 189 functions.get_sub_list(self) No newline at end of file
190 190 No newline at end of file
191 191 No newline at end of file
192 192 @pyqtSignature("int") #CLOSED No newline at end of file
193 193 def on_lstStopDay_activated(self, index): No newline at end of file
194 194 """ No newline at end of file
195 195 Cambia la lista de opciones en lstStartDay No newline at end of file
196 196 """ No newline at end of file
197 197 var_StartDay_index=self.lstStartDay.currentIndex() No newline at end of file
198 198 var_end_index = self.lstStopDay.count() - index No newline at end of file
199 199 self.lstStartDay.clear() No newline at end of file
200 200 No newline at end of file
201 201 for i in self.var_list[:len(self.var_list) - var_end_index + 1]: No newline at end of file
202 202 self.lstStartDay.addItem(i) No newline at end of file
203 203 No newline at end of file
204 204 self.lstStartDay.setCurrentIndex(var_StartDay_index) No newline at end of file
205 205 No newline at end of file
206 206 functions.get_sub_list(self) No newline at end of file
207 207 No newline at end of file
208 208 No newline at end of file
209 209 #----------------------------------------------------- Capacidad del dispositivo de grabacion --------------------------------------------------------------- No newline at end of file
210 210 No newline at end of file
211 211 @pyqtSignature("") No newline at end of file
212 212 def on_txtDcapacity_editingFinished(self): No newline at end of file
213 213 self.var_Dcapacity = self.txtDcapacity.value() No newline at end of file
214 214 No newline at end of file
215 215 No newline at end of file
216 216 @pyqtSignature("int") #CLOSED No newline at end of file
217 217 def on_lstDcapacity_activated(self, index): No newline at end of file
218 218 """ No newline at end of file
219 219 Permite elegir el tamaΓ±o del disco No newline at end of file
220 220 """ No newline at end of file
221 221 if index == 0: No newline at end of file
222 222 var_size=25.0 No newline at end of file
223 223 elif index == 1: No newline at end of file
224 224 var_size=8.5 No newline at end of file
225 225 elif index == 2: No newline at end of file
226 226 var_size=4.7 No newline at end of file
227 227 elif index == 3: No newline at end of file
228 228 var_size=0.7 No newline at end of file
229 229 No newline at end of file
230 230 if index != 4: No newline at end of file
231 231 self.txtDcapacity.setValue(var_size*10**9/1024**2) No newline at end of file
232 232 self.txtDcapacity.setReadOnly(True) No newline at end of file
233 233 else: No newline at end of file
234 234 self.txtDcapacity.setValue(100.0) No newline at end of file
235 235 self.txtDcapacity.setReadOnly(False) No newline at end of file
236 236 No newline at end of file
237 237 self.var_lstDcapacity = self.lstDcapacity.currentIndex() No newline at end of file
238 238 self.var_Dcapacity = self.txtDcapacity.value() No newline at end of file
239 239 No newline at end of file
240 240 No newline at end of file
241 241 #============================================================================== No newline at end of file
242 242 # Botones para la generacion de los archivos de configuracion y el proceso de grabacion No newline at end of file
243 243 #============================================================================== No newline at end of file
244 244 No newline at end of file
245 245 #----------------------------------------------------- Generacion de la configuracion usando los parametros --------------------------------------------------------------- No newline at end of file
246 246 No newline at end of file
247 247 @pyqtSignature("") No newline at end of file
248 248 def on_btnGbkp_clicked(self): No newline at end of file
249 249 """ No newline at end of file
250 250 Generacion de archivos de configuracion usando los parametros No newline at end of file
251 251 """ No newline at end of file
252 252 No newline at end of file
253 253 if functions.validate_parameters(self) == False: No newline at end of file
254 254 return No newline at end of file
255 255 No newline at end of file
256 256 #Crea las carpetas en la ruta del proyecto y verifica que se crearon correctamente No newline at end of file
257 257 list_dirs=['gpath','iso','ppath'] No newline at end of file
258 258 bool_make_dirs = functions.make_dirs(list_dirs, self) No newline at end of file
259 259 if bool_make_dirs == False: No newline at end of file
260 260 return No newline at end of file
261 261 No newline at end of file
262 262 var_files_list = functions.list_files(self) #Se obtiene la lista de archivos a grabar No newline at end of file
263 263 self.var_Discs = functions.make_files_dat(var_files_list, self) #Se crean los archivos .dat No newline at end of file
264 264 functions.make_files_print(self) # Se crean los archivos .print No newline at end of file
265 265 functions2.make_parameters_conf(self) # se crea el archivo parameters.conf No newline at end of file
266 266 No newline at end of file
267 267 #Se bloquean los parametros de configuracion No newline at end of file
268 268 functions2.enabled_items1(True, self) No newline at end of file
269 269 No newline at end of file
270 270 No newline at end of file
271 271 No newline at end of file
272 272 #----------------------------------------------------- Permite reiniciar la configuracion --------------------------------------------------------------- No newline at end of file
273 273 No newline at end of file
274 274 @pyqtSignature("") No newline at end of file
275 275 def on_btnRestart_clicked(self): No newline at end of file
276 276 """ No newline at end of file
277 277 Permite que se puedan cambiar los parametros No newline at end of file
278 278 """ No newline at end of file
279 279 functions2.enabled_items1(False, self) No newline at end of file
280 280 os.remove("parameters.conf") No newline at end of file
281 281 No newline at end of file
282 282 No newline at end of file
283 283 #----------------------------------------------------- Iniciar proceso de grabacion --------------------------------------------------------------- No newline at end of file
284 284 No newline at end of file
285 285 @pyqtSignature("") No newline at end of file
286 286 def on_btnStartburn_clicked(self): No newline at end of file
287 287 """ No newline at end of file
288 288 Se inicia el proceso de grabacion No newline at end of file
289 289 """ No newline at end of file
290 290 No newline at end of file
291 291 #Verifica que exista algun dispositivo de grabacion seleccionado No newline at end of file
292 292 if not(functions2.selected_devices(self)): No newline at end of file
293 293 self.txtInfo.append("No hay ningun dispositivo de grabacion seleccionado ") No newline at end of file
294 294 return No newline at end of file
295 295 No newline at end of file
296 296 #Lista los dispositivos de grabacion a usar No newline at end of file
297 297 for dev in self.var_devices: No newline at end of file
298 298 self.txtInfo.append("dispositivo :"+dev) No newline at end of file
299 299 No newline at end of file
300 300 #Asigna las variables con los valores iniciales No newline at end of file
301 301 self.var_disc_n = 0 # numero de disco actual para grabacion No newline at end of file
302 302 self.var_copy_n = 0 No newline at end of file
303 303 self.var_step = 0 No newline at end of file
304 304 self.bool_state_burning = True No newline at end of file
305 305 No newline at end of file
306 306 functions2.enabled_items2(True, self) No newline at end of file
307 307 self.burning() No newline at end of file
308 308 No newline at end of file
309 309 def burning(self): No newline at end of file
310 310 No newline at end of file
311 311 var_Rpath_ppath=self.var_Rpath+"/ppath" No newline at end of file
312 312 var_Rpath_iso=self.var_Rpath+"/iso"
No newline at end of file
313 file_iso=var_Rpath_iso+"/"+functions.i2s(self.var_disc_n)+".iso" No newline at end of file
314 313 No newline at end of file
315 314 #Creacion del archivo.iso para la grabacion No newline at end of file
316 315 if self.var_step == 0: No newline at end of file
317 316 No newline at end of file
318 317 self.var_disc_n += 1 # numero de disco actual para grabacion No newline at end of file
318 self.var_copy_n = 0 No newline at end of file
319 319 No newline at end of file
320 320 #Si ya se grabaron todos los discos No newline at end of file
321 321 if self.var_disc_n > self.var_Discs: No newline at end of file
322 322 self.bool_state_burning = False No newline at end of file
323 323 self.txtInfo.append("GRABACION TERMINADA") No newline at end of file
324 324 return No newline at end of file
325 325
326 No newline at end of file
326 self.txtInfo.append("Creando el iso del disco numero: "+str(self.var_disc_n)) No newline at end of file
No newline at end of file
327 self.txtInfo.append("--------Creando el iso del disco numero: "+str(self.var_disc_n)) No newline at end of file
327 328 No newline at end of file
328 329 #comando para la creacion del archivo.iso No newline at end of file
329 330 file_dat=var_Rpath_ppath+"/"+self.var_Elabel+"_"+functions.i2s(self.var_disc_n)+".dat" No newline at end of file
331 file_iso=var_Rpath_iso+"/"+functions.i2s(self.var_disc_n)+".iso" No newline at end of file
330 332 var_cmd = 'genisoimage -hide-joliet-trans-tbl -joliet-long -r ' No newline at end of file
331 333 var_cmd += ' -A '+self.var_Elabel+' -V '+self.var_Elabel No newline at end of file
332 334 var_cmd += ' -graft-points -path-list '+ file_dat+' -o '+file_iso No newline at end of file
333 335 self.var_step = 1 #Se ira al paso de la grabacion en la siguiente llamada No newline at end of file
334 336 No newline at end of file
335 337 #Grabacion de los DVDs No newline at end of file
336 338 elif self.var_step == 1: No newline at end of file
337 339 self.var_copy_n += 1 # numero de copia actual No newline at end of file
338 340 self.txtInfo.append("Grabando la copia numero: "+str(self.var_copy_n)) No newline at end of file
339 341 No newline at end of file
340 342 #Si esta es la ultima copia se pasara al siguiente disco en la siguiente llamada a la funcion No newline at end of file
341 343 if self.var_copy_n == self.var_Copys: No newline at end of file
342 344 self.var_step = 0 No newline at end of file
343 345
346 No newline at end of file
344 var_index = (((self.var_disc_n - 1) * self.var_Discs) + self.var_copy_n) % len(self.var_devices) No newline at end of file
345 347 No newline at end of file
346 348 if var_index == 0: No newline at end of file
347 349 self.txtInfo.append("EXPULSANDO BANDEJAS") No newline at end of file
348 350
351 No newline at end of file
349 var_dev_tmp=self.var_devices[var_index] No newline at end of file
No newline at end of file
352 file_iso=var_Rpath_iso+"/"+functions.i2s(self.var_disc_n)+".iso" No newline at end of file
350 353 var_cmd = "wodim -v dev="+var_dev_tmp+" speed=16 "+ file_iso No newline at end of file
351 354 No newline at end of file
352 355 No newline at end of file
353 356 self.var_process.start('ls') No newline at end of file
354 357 self.txtInfo.append(var_cmd) No newline at end of file
355 358 No newline at end of file
356 359 # self.txtInfo.append("creando iso") No newline at end of file
357 360 # self.var_process.start(var_cmd) No newline at end of file
358 361 No newline at end of file
359 362 No newline at end of file
360 363 #----------------------------------------------------- Detener proceso de grabacion --------------------------------------------------------------- No newline at end of file
361 364 No newline at end of file
362 365 @pyqtSignature("") No newline at end of file
363 366 def on_btnStopburn_clicked(self): No newline at end of file
364 367 """ No newline at end of file
365 368 Slot documentation goes here. No newline at end of file
366 369 """ No newline at end of file
367 370 self.bool_state_burning = False No newline at end of file
368 371 self.var_process.terminate() #Termina el proceso, si puede
372 No newline at end of file
369 # self.var_process.kill() #Mata el proceso, no es la forma adecuada No newline at end of file
No newline at end of file
373
No newline at end of file
374 self.txtInfo.append("SE DETUVO LA GRABACION MANUALMENTE") No newline at end of file
370 375 functions2.enabled_items2(False, self) No newline at end of file
371 376 No newline at end of file
372 377 No newline at end of file
373 378 #----------------------------------------------------- Testeo de las unidades de grabacion --------------------------------------------------------------- No newline at end of file
374 379 No newline at end of file
375 380 @pyqtSignature("") No newline at end of file
376 381 def on_btnTdevA_clicked(self): No newline at end of file
377 382 var_dev = str(self.txtDeviceA.text()) No newline at end of file
378 383 var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev No newline at end of file
379 384 commands.getstatusoutput(var_cmd) No newline at end of file
380 385 No newline at end of file
381 386 @pyqtSignature("") No newline at end of file
382 387 def on_btnTdevB_clicked(self): No newline at end of file
383 388 var_dev = str(self.txtDeviceB.text()) No newline at end of file
384 389 var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev No newline at end of file
385 390 commands.getstatusoutput(var_cmd) No newline at end of file
386 391 No newline at end of file
387 392 @pyqtSignature("") No newline at end of file
388 393 def on_btnTdevC_clicked(self): No newline at end of file
389 394 var_dev = str(self.txtDeviceC.text()) No newline at end of file
390 395 var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev No newline at end of file
391 396 commands.getstatusoutput(var_cmd) No newline at end of file
392 397 No newline at end of file
393 398 @pyqtSignature("") No newline at end of file
394 399 def on_btnTdevD_clicked(self): No newline at end of file
395 400 var_dev = str(self.txtDeviceD.text()) No newline at end of file
396 401 var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev No newline at end of file
397 402 commands.getstatusoutput(var_cmd) No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now