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