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