##// END OF EJS Templates
genera imagen y graba OK
ralonso -
r57:58
parent child
Show More
@@ -1,344 +1,366
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 No newline at end of file
33 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_n_discs=0 No newline at end of file
36 self.var_disc=0 No newline at end of file
36 37 self.var_list=[] No newline at end of file
37 38 self.var_sublist=[] No newline at end of file
39 self.bool_iso = False
No newline at end of file
40 self.bool_burn = False No newline at end of file
38 41 No newline at end of file
39 42 #Revisa si existe el archivo de confirguracion No newline at end of file
40 43 if os.path.isfile("parameters.conf"): No newline at end of file
41 44 self.txtInfo.append("Archivo de configuracion encontrado") No newline at end of file
42 45 functions2.get_parameters_conf(self) No newline at end of file
43 46 self.txtInfo.append("El proyecto creara "+str(self.var_n_discs)+" DVDs") No newline at end of file
44 47 else: No newline at end of file
45 48 self.txtInfo.append("Elija los parametros de configuracion") No newline at end of file
46 49 functions2.set_parameters_test(self) #Establece ciertos parametros, para pruebas No newline at end of file
47 50 No newline at end of file
48 51 functions2.set_vars(self) #Carga las variables de la clase con los parametros seleccionados No newline at end of file
49 52 No newline at end of file
50 53 self.statusDpath = functions.dir_exists(self.var_Dpath, self) No newline at end of file
51 54 self.statusRpath = functions.dir_exists(self.var_Rpath, self) No newline at end of file
52 55 functions.load_days(self) No newline at end of file
53 56 No newline at end of file
54 57 self.var_process = QtCore.QProcess() No newline at end of file
55 58 self.connect(self.var_process, QtCore.SIGNAL('readyReadStandardOutput()'), self.readOuput) No newline at end of file
56 59 self.connect(self.var_process, QtCore.SIGNAL('readyReadStandardError()'), self.readError) No newline at end of file
57 60 self.connect(self.var_process, QtCore.SIGNAL('finished(int,QProcess::ExitStatus)'), self.finished) No newline at end of file
58 61 No newline at end of file
59 62 No newline at end of file
60 63 def write(self, txt): No newline at end of file
61 64 self.txtInfo.append(str(txt)) No newline at end of file
62 65 No newline at end of file
63 66 No newline at end of file
64 67 #----------------------------------------------------- Funciones del proceso --------------------------------------------------------------- No newline at end of file
65 68 No newline at end of file
66 69 def readOuput(self): No newline at end of file
67 70 self.txtSburn.insertPlainText("stdout: " + QtCore.QString(self.var_process.readAllStandardOutput())) No newline at end of file
68 71 No newline at end of file
69 72 def readError(self): No newline at end of file
70 73 self.txtSburn.insertPlainText("stderr: " + QtCore.QString(self.var_process.readAllStandardError())) No newline at end of file
71 74 No newline at end of file
72 75 def finished(self): No newline at end of file
73 76 self.txtInfo.append("proceso terminado finished() "+QtCore.QString(self.var_process.exitCode())) No newline at end of file
77 if self.var_disc <= self.var_n_discs:
No newline at end of file
78 self.burning() No newline at end of file
74 79 No newline at end of file
75 80 No newline at end of file
76 81 #----------------------------------------------------- Obtencion de las ruta de los datos --------------------------------------------------------------- No newline at end of file
77 82 No newline at end of file
78 83 @pyqtSignature("") No newline at end of file
79 84 def on_btnDpath_clicked(self): No newline at end of file
80 85 """ No newline at end of file
81 86 Permite seleccionar graficamente el direcorio de los datos a grabar No newline at end of file
82 87 """ No newline at end of file
83 88 self.var_Dpath= QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly) No newline at end of file
84 89 self.txtDpath.setText(self.var_Dpath) No newline at end of file
85 90 self.statusDpath = functions.dir_exists(self.var_Dpath, self) No newline at end of file
86 91 functions.load_days(self) No newline at end of file
87 92 No newline at end of file
88 93 No newline at end of file
89 94 @pyqtSignature("") No newline at end of file
90 95 def on_txtDpath_editingFinished(self): No newline at end of file
91 96 """ No newline at end of file
92 97 Carga la ruta editada y verifica que sea correcta y carga la lista de dias No newline at end of file
93 98 """ No newline at end of file
94 99 self.var_Dpath=self.txtDpath.text() #Se carga la variable con la ruta recien editada No newline at end of file
95 100 self.statusDpath = functions.dir_exists(self.var_Dpath, self) No newline at end of file
96 101 functions.load_days(self) No newline at end of file
97 102 No newline at end of file
98 103 No newline at end of file
99 104 #----------------------------------------------------- Obtencion de las ruta del proyecto --------------------------------------------------------------- No newline at end of file
100 105 No newline at end of file
101 106 @pyqtSignature("") No newline at end of file
102 107 def on_btnRpath_clicked(self): No newline at end of file
103 108 """ No newline at end of file
104 109 Permite seleccionar graficamente el direcorio del proyecto No newline at end of file
105 110 """ No newline at end of file
106 111 self.var_Rpath = QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly) No newline at end of file
107 112 self.txtRpath.setText(self.var_Rpath) No newline at end of file
108 113 self.statusRpath = functions.dir_exists(self.var_Rpath, self) No newline at end of file
109 114 No newline at end of file
110 115 No newline at end of file
111 116 @pyqtSignature("") No newline at end of file
112 117 def on_txtRpath_editingFinished(self): No newline at end of file
113 118 """ No newline at end of file
114 119 Valida la ruta del proyecto No newline at end of file
115 120 """ No newline at end of file
116 121 self.var_Rpath=self.txtRpath.text() #Se carga la variable con la ruta recien editada No newline at end of file
117 122 self.statusRpath = functions.dir_exists(self.var_Rpath, self) No newline at end of file
118 123 No newline at end of file
119 124 No newline at end of file
120 125 #----------------------------------------------------- Tipo de datos --------------------------------------------------------------- No newline at end of file
121 126 No newline at end of file
122 127 @pyqtSignature("int") No newline at end of file
123 128 def on_lstDtype_activated(self, index): No newline at end of file
124 129 """ No newline at end of file
125 130 Permite elegir entre los tipos de archivos No newline at end of file
126 131 """ No newline at end of file
127 132 self.txtDtype.setReadOnly(True) No newline at end of file
128 133 if index == 0: No newline at end of file
129 134 self.var_Dtype ='r' No newline at end of file
130 135 elif index == 1: No newline at end of file
131 136 self.var_Dtype ='pdata' No newline at end of file
132 137 elif index == 2: No newline at end of file
133 138 self.var_Dtype ='sswma' No newline at end of file
134 139 else : No newline at end of file
135 140 self.var_Dtype ='' No newline at end of file
136 141 self.txtDtype.setReadOnly(False) No newline at end of file
137 142 No newline at end of file
138 143 self.txtDtype.setText(self.var_Dtype) No newline at end of file
139 144 functions.load_days(self) #llamada a funcion No newline at end of file
140 145 No newline at end of file
141 146 @pyqtSignature("") No newline at end of file
142 147 def on_txtDtype_editingFinished(self): No newline at end of file
143 148 self.var_Dtype=self.txtDtype.text() No newline at end of file
144 149 functions.load_days(self) #llamada a funcion No newline at end of file
145 150 No newline at end of file
146 151 No newline at end of file
147 152 #----------------------------------------------------- Etiqueta --------------------------------------------------------------- No newline at end of file
148 153 No newline at end of file
149 154 @pyqtSignature("") No newline at end of file
150 155 def on_txtElabel_editingFinished(self): No newline at end of file
151 156 self.var_Elabel = self.txtElabel.text() No newline at end of file
152 157 No newline at end of file
153 158 #----------------------------------------------------- Numero de copias --------------------------------------------------------------- No newline at end of file
154 159 @pyqtSignature("") No newline at end of file
155 160 def on_txtCopys_editingFinished(self): No newline at end of file
156 161 self.var_Copys = self.txtCopys.value() No newline at end of file
157 162 No newline at end of file
158 163 #----------------------------------------------------- Seleccion del rango de fechas --------------------------------------------------------------- No newline at end of file
159 164 No newline at end of file
160 165 @pyqtSignature("int") #CLOSED No newline at end of file
161 166 def on_lstStartDay_activated(self, index): No newline at end of file
162 167 """ No newline at end of file
163 168 Cambia la lista de opciones en lstStopDay No newline at end of file
164 169 """ No newline at end of file
165 170 var_StopDay_index=self.lstStopDay.count() - self.lstStopDay.currentIndex() No newline at end of file
166 171 self.lstStopDay.clear() No newline at end of file
167 172 No newline at end of file
168 173 for i in self.var_list[index:]: No newline at end of file
169 174 self.lstStopDay.addItem(i) No newline at end of file
170 175 No newline at end of file
171 176 self.lstStopDay.setCurrentIndex(self.lstStopDay.count() - var_StopDay_index) No newline at end of file
172 177 No newline at end of file
173 178 functions.get_sub_list(self) No newline at end of file
174 179 No newline at end of file
175 180 No newline at end of file
176 181 @pyqtSignature("int") #CLOSED No newline at end of file
177 182 def on_lstStopDay_activated(self, index): No newline at end of file
178 183 """ No newline at end of file
179 184 Cambia la lista de opciones en lstStartDay No newline at end of file
180 185 """ No newline at end of file
181 186 var_StartDay_index=self.lstStartDay.currentIndex() No newline at end of file
182 187 var_end_index = self.lstStopDay.count() - index No newline at end of file
183 188 self.lstStartDay.clear() No newline at end of file
184 189 No newline at end of file
185 190 for i in self.var_list[:len(self.var_list) - var_end_index + 1]: No newline at end of file
186 191 self.lstStartDay.addItem(i) No newline at end of file
187 192 No newline at end of file
188 193 self.lstStartDay.setCurrentIndex(var_StartDay_index) No newline at end of file
189 194 No newline at end of file
190 195 functions.get_sub_list(self) No newline at end of file
191 196 No newline at end of file
192 197 No newline at end of file
193 198 #----------------------------------------------------- Capacidad del dispositivo de grabacion --------------------------------------------------------------- No newline at end of file
194 199 No newline at end of file
195 200 @pyqtSignature("") No newline at end of file
196 201 def on_txtDcapacity_editingFinished(self): No newline at end of file
197 202 self.var_Dcapacity = self.txtDcapacity.value() No newline at end of file
198 203 No newline at end of file
199 204 No newline at end of file
200 205 @pyqtSignature("int") #CLOSED No newline at end of file
201 206 def on_lstDcapacity_activated(self, index): No newline at end of file
202 207 """ No newline at end of file
203 208 Permite elegir el tamaΓ±o del disco No newline at end of file
204 209 """ No newline at end of file
205 210 if index == 0: No newline at end of file
206 211 var_size=25.0 No newline at end of file
207 212 elif index == 1: No newline at end of file
208 213 var_size=8.5 No newline at end of file
209 214 elif index == 2: No newline at end of file
210 215 var_size=4.7 No newline at end of file
211 216 elif index == 3: No newline at end of file
212 217 var_size=0.7 No newline at end of file
213 218 No newline at end of file
214 219 if index != 4: No newline at end of file
215 220 self.txtDcapacity.setValue(var_size*10**9/1024**2) No newline at end of file
216 221 self.txtDcapacity.setReadOnly(True) No newline at end of file
217 222 else: No newline at end of file
218 223 self.txtDcapacity.setValue(100.0) No newline at end of file
219 224 self.txtDcapacity.setReadOnly(False) No newline at end of file
220 225 No newline at end of file
221 226 self.var_Dcapacity = self.txtDcapacity.value() No newline at end of file
222 227 No newline at end of file
223 228 No newline at end of file
224 229 #============================================================================== No newline at end of file
225 230 # Botones para la generacion de los archivos de configuracion y el proceso de grabacion No newline at end of file
226 231 #============================================================================== No newline at end of file
227 232 No newline at end of file
228 233 #----------------------------------------------------- Generacion de la configuracion usando los parametros --------------------------------------------------------------- No newline at end of file
229 234 No newline at end of file
230 235 @pyqtSignature("") No newline at end of file
231 236 def on_btnGbkp_clicked(self): No newline at end of file
232 237 """ No newline at end of file
233 238 Generacion de archivos de configuracion usando los parametros No newline at end of file
234 239 """ No newline at end of file
235 240 No newline at end of file
236 241 if functions.validate_parameters(self) == False: No newline at end of file
237 242 return No newline at end of file
238 243 No newline at end of file
239 244 #Crea las carpetas en la ruta del proyecto y verifica que se crearon correctamente No newline at end of file
240 245 list_dirs=['gpath','iso','ppath'] No newline at end of file
241 246 bool_make_dirs = functions.make_dirs(list_dirs, self) No newline at end of file
242 247 if bool_make_dirs == False: No newline at end of file
243 248 return No newline at end of file
244 249 No newline at end of file
245 250 var_files_list = functions.list_files(self) #Se obtiene la lista de archivos a grabar No newline at end of file
246 251 self.var_n_discs = functions.make_files_dat(var_files_list, self) #Se crean los archivos .dat No newline at end of file
247 252 functions.make_files_print(self) # Se crean los archivos .print No newline at end of file
248 253 functions2.make_parameters_conf(self) # se crea el archivo parameters.conf No newline at end of file
249 254 No newline at end of file
250 255 #Se bloquean los parametros de configuracion No newline at end of file
251 256 functions2.enabled_items1(True, self) No newline at end of file
252 257 No newline at end of file
253 258 No newline at end of file
254 259 #----------------------------------------------------- Permite reiniciar la configuracion --------------------------------------------------------------- No newline at end of file
255 260 No newline at end of file
256 261 @pyqtSignature("") No newline at end of file
257 262 def on_btnRestart_clicked(self): No newline at end of file
258 263 """ No newline at end of file
259 264 Permite que se puedan cambiar los parametros No newline at end of file
260 265 """ No newline at end of file
261 266 functions2.enabled_items1(False, self) No newline at end of file
262 267 os.remove("parameters.conf") No newline at end of file
263 268 No newline at end of file
264 269 No newline at end of file
265 270 #----------------------------------------------------- Iniciar proceso de grabacion --------------------------------------------------------------- No newline at end of file
266 271 No newline at end of file
267 272 @pyqtSignature("") No newline at end of file
268 273 def on_btnStartburn_clicked(self): No newline at end of file
269 274 """ No newline at end of file
270 275 Se inicia el proceso de grabacion No newline at end of file
271 276 """ No newline at end of file
272 277 functions2.enabled_items2(True, self) No newline at end of file
273 278 No newline at end of file
274 279 sys.stdout = self
280 No newline at end of file
275 #sys.stderr = self
No newline at end of file
281 No newline at end of file
276 print "stdout_!!!"
No newline at end of file
282 No newline at end of file
277
No newline at end of file
283 No newline at end of file
278
No newline at end of file
284 No newline at end of file
279
No newline at end of file
285 No newline at end of file
280 #Inicializando variables No newline at end of file
No newline at end of file
286 if self.chkDevB.isChecked():
No newline at end of file
287 self.var_devices.append(self.txtDeviceB.text())
No newline at end of file
288 if self.chkDevC.isChecked():
No newline at end of file
289 self.var_devices.append(self.txtDeviceC.text())
No newline at end of file
290 if self.chkDevD.isChecked():
No newline at end of file
291 self.var_devices.append(self.txtDeviceD.text())
No newline at end of file
292
No newline at end of file
293 if len(self.var_devices) ==0:
No newline at end of file
294 return
No newline at end of file
295
No newline at end of file
296 for dev in self.var_devices:
No newline at end of file
297 self.txtInfo.append("dispositivo :"+dev)
No newline at end of file
298
No newline at end of file
299 self.var_disc = 1
No newline at end of file
300 self.burning()
No newline at end of file
301
No newline at end of file
302 def burning(self):
No newline at end of file
303 No newline at end of file
281 304 var_Rpath_ppath=self.var_Rpath+"/ppath" No newline at end of file
282 305 var_Rpath_iso=self.var_Rpath+"/iso"
306 No newline at end of file
283
No newline at end of file
307 No newline at end of file
284 var_n=1
No newline at end of file
308 No newline at end of file
285 file_iso=var_Rpath_iso+"/"+functions.i2s(var_n)+".iso"
No newline at end of file
309 No newline at end of file
286 file_dat=var_Rpath_ppath+"/"+self.var_Elabel+"_"+functions.i2s(var_n)+".dat"
No newline at end of file
310 No newline at end of file
287 No newline at end of file
No newline at end of file
311 file_iso=var_Rpath_iso+"/"+functions.i2s(self.var_disc)+".iso"
No newline at end of file
312 file_dat=var_Rpath_ppath+"/"+self.var_Elabel+"_"+functions.i2s(self.var_disc)+".dat" No newline at end of file
288 313 var_cmd = 'genisoimage -hide-joliet-trans-tbl -joliet-long -r ' No newline at end of file
289 314 var_cmd += ' -A '+self.var_Elabel+' -V '+self.var_Elabel No newline at end of file
290 315 var_cmd += ' -graft-points -path-list '+ file_dat+' -o '+file_iso No newline at end of file
291 316
317 No newline at end of file
292 self.var_process.start(var_cmd)
No newline at end of file
318 No newline at end of file
293 self.txtInfo.append("ejecutandose")
No newline at end of file
319 No newline at end of file
294
No newline at end of file
320 No newline at end of file
295
No newline at end of file
321 No newline at end of file
296 # # Se leen todos los archivos .dat creados para crear las etiquetas en los archivos .ps
No newline at end of file
322 No newline at end of file
297 # for var_n in range(1, self.var_n_discs+1):
No newline at end of file
323 No newline at end of file
298 # self.txtInfo.append(str(var_n))
No newline at end of file
324 No newline at end of file
299 # file_iso=var_Rpath_iso+"/"+functions.i2s(var_n)+".iso"
No newline at end of file
325 No newline at end of file
300 # file_dat=var_Rpath_ppath+"/"+self.var_Elabel+"_"+functions.i2s(var_n)+".dat"
No newline at end of file
326 No newline at end of file
301 #
No newline at end of file
327 No newline at end of file
302 # var_cmd = 'genisoimage -hide-joliet-trans-tbl -joliet-long -r '
No newline at end of file
328 No newline at end of file
303 # var_cmd += ' -A '+self.var_Elabel+' -V '+self.var_Elabel
No newline at end of file
304 # var_cmd += ' -graft-points -path-list '+ file_dat+' -o '+file_iso
No newline at end of file
305 # self.txtInfo.append(var_cmd)
No newline at end of file
306 # No newline at end of file
307 329 No newline at end of file
308 330 No newline at end of file
309 331 #----------------------------------------------------- Detener proceso de grabacion --------------------------------------------------------------- No newline at end of file
310 332 No newline at end of file
311 333 @pyqtSignature("") No newline at end of file
312 334 def on_btnStopburn_clicked(self): No newline at end of file
313 335 """ No newline at end of file
314 336 Slot documentation goes here. No newline at end of file
315 337 """ No newline at end of file
316 338 self.var_process.terminate() #Termina el proceso, si puede No newline at end of file
317 339 functions2.enabled_items2(False, self) No newline at end of file
318 340 No newline at end of file
319 341 No newline at end of file
320 342 #----------------------------------------------------- Testeo de las unidades de grabacion --------------------------------------------------------------- No newline at end of file
321 343 No newline at end of file
322 344 @pyqtSignature("") No newline at end of file
323 345 def on_btnTdevA_clicked(self): No newline at end of file
324 346 var_dev = str(self.txtDeviceA.text()) No newline at end of file
325 347 var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev No newline at end of file
326 348 commands.getstatusoutput(var_cmd) No newline at end of file
327 349 No newline at end of file
328 350 @pyqtSignature("") No newline at end of file
329 351 def on_btnTdevB_clicked(self): No newline at end of file
330 352 var_dev = str(self.txtDeviceB.text()) No newline at end of file
331 353 var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev No newline at end of file
332 354 commands.getstatusoutput(var_cmd) No newline at end of file
333 355 No newline at end of file
334 356 @pyqtSignature("") No newline at end of file
335 357 def on_btnTdevC_clicked(self): No newline at end of file
336 358 var_dev = str(self.txtDeviceC.text()) No newline at end of file
337 359 var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev No newline at end of file
338 360 commands.getstatusoutput(var_cmd) No newline at end of file
339 361 No newline at end of file
340 362 @pyqtSignature("") No newline at end of file
341 363 def on_btnTdevD_clicked(self): No newline at end of file
342 364 var_dev = str(self.txtDeviceD.text()) No newline at end of file
343 365 var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev No newline at end of file
344 366 commands.getstatusoutput(var_cmd) No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now