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