@@ -1,192 +1,242 | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 |
|
2 | |||
3 |
|
3 | |||
4 | from subprocess import * |
|
4 | from subprocess import * | |
5 | import sys |
|
5 | import sys | |
6 | import os |
|
6 | import os | |
7 | import subprocess |
|
7 | import subprocess | |
8 | import commands |
|
8 | import commands | |
9 |
|
9 | |||
10 | #----------------------------------------------------- Deteccion de los dispositivos de grabacion --------------------------------------------------------------- |
|
10 | #----------------------------------------------------- Deteccion de los dispositivos de grabacion --------------------------------------------------------------- | |
11 |
|
11 | |||
12 | def detect_devices(self): |
|
12 | def detect_devices(self): | |
13 | """ |
|
13 | """ | |
14 | Deteccion de los dispositvos de grabacion |
|
14 | Deteccion de los dispositvos de grabacion | |
15 | """ |
|
15 | """ | |
16 | #var_cmd="wodim --devices | grep /dev/ | awk -F\' '{print $2}'" #Funciona en consola pero no en python ΒΏ? |
|
16 | #var_cmd="wodim --devices | grep /dev/ | awk -F\' '{print $2}'" #Funciona en consola pero no en python ΒΏ? | |
17 | var_cmd="wodim --devices | grep /dev/ | awk '{print $2}' | awk -F= '{print $2}'" |
|
17 | var_cmd="wodim --devices | grep /dev/ | awk '{print $2}' | awk -F= '{print $2}'" | |
18 |
|
18 | |||
19 | var_output = commands.getstatusoutput(var_cmd) |
|
19 | var_output = commands.getstatusoutput(var_cmd) | |
20 | if var_output[0] != 0: |
|
20 | if var_output[0] != 0: | |
21 | self.txtInfo.append("No recording devices") |
|
21 | self.txtInfo.append("No recording devices") | |
22 | else: |
|
22 | else: | |
23 | # self.txtInfo.append("dispositivos encontrados") |
|
23 | # self.txtInfo.append("dispositivos encontrados") | |
24 | var_devices = var_output[1].split('\n') |
|
24 | var_devices = var_output[1].split('\n') | |
25 |
|
25 | |||
26 | var_tmp=[] |
|
26 | var_tmp=[] | |
27 | for i in range(0, 4): |
|
27 | for i in range(0, 4): | |
28 | if i < len(var_devices): |
|
28 | if i < len(var_devices): | |
29 | var_len = len(var_devices[i]) |
|
29 | var_len = len(var_devices[i]) | |
30 | var_tmp.append(var_devices[i][1:var_len - 1]) |
|
30 | var_tmp.append(var_devices[i][1:var_len - 1]) | |
31 | else: |
|
31 | else: | |
32 | var_tmp.append('') |
|
32 | var_tmp.append('') | |
33 |
|
33 | |||
34 | #Se escriben los dispostivos correspodientes, si existen |
|
34 | #Se escriben los dispostivos correspodientes, si existen | |
35 | self.txtDeviceA.setText(str(var_tmp[0])) |
|
35 | self.txtDeviceA.setText(str(var_tmp[0])) | |
36 | self.txtDeviceB.setText(str(var_tmp[1])) |
|
36 | self.txtDeviceB.setText(str(var_tmp[1])) | |
37 | self.txtDeviceC.setText(str(var_tmp[2])) |
|
37 | self.txtDeviceC.setText(str(var_tmp[2])) | |
38 | self.txtDeviceD.setText(str(var_tmp[3])) |
|
38 | self.txtDeviceD.setText(str(var_tmp[3])) | |
39 | #Se desactivan los que no existen |
|
39 | #Se desactivan los que no existen | |
40 | if len(var_tmp[0]) == 0 : |
|
40 | if len(var_tmp[0]) == 0 : | |
41 | self.chkDevA.setChecked(False) |
|
41 | self.chkDevA.setChecked(False) | |
42 | self.chkDevA.setEnabled(False) |
|
42 | self.chkDevA.setEnabled(False) | |
43 | if len(var_tmp[1]) == 0 : |
|
43 | if len(var_tmp[1]) == 0 : | |
44 | self.chkDevB.setChecked(False) |
|
44 | self.chkDevB.setChecked(False) | |
45 | self.chkDevB.setEnabled(False) |
|
45 | self.chkDevB.setEnabled(False) | |
46 | if len(var_tmp[2]) == 0 : |
|
46 | if len(var_tmp[2]) == 0 : | |
47 | self.chkDevC.setChecked(False) |
|
47 | self.chkDevC.setChecked(False) | |
48 | self.chkDevC.setEnabled(False) |
|
48 | self.chkDevC.setEnabled(False) | |
49 | if len(var_tmp[3]) == 0 : |
|
49 | if len(var_tmp[3]) == 0 : | |
50 | self.chkDevD.setChecked(False) |
|
50 | self.chkDevD.setChecked(False) | |
51 | self.chkDevD.setEnabled(False) |
|
51 | self.chkDevD.setEnabled(False) | |
52 |
|
52 | |||
53 | #----------------------------------- expulsa los dispositivos de grabacion -------------------------------------------- |
|
53 | #----------------------------------- expulsa los dispositivos de grabacion -------------------------------------------- | |
54 |
|
54 | |||
55 | def eject_devices(self): |
|
55 | def eject_devices(self): | |
56 | self.txtInfo.append("Ejecting recording devices") |
|
56 | self.txtInfo.append("Ejecting recording devices") | |
57 | return |
|
57 | return | |
58 | for var_dev in self.var_devices: |
|
58 | for var_dev in self.var_devices: | |
59 | var_cmd = 'eject ' + var_dev |
|
59 | var_cmd = 'eject ' + var_dev | |
60 | commands.getstatusoutput(var_cmd) |
|
60 | commands.getstatusoutput(var_cmd) | |
61 |
|
61 | |||
62 | #----------------------------------- listado de los dispositivos de grabacion seleccionados -------------------------------------------- |
|
62 | #----------------------------------- listado de los dispositivos de grabacion seleccionados -------------------------------------------- | |
63 |
|
63 | |||
64 | def selected_devices(self): |
|
64 | def selected_devices(self): | |
65 | self.var_devices=[] |
|
65 | self.var_devices=[] | |
66 | if self.chkDevA.isChecked(): |
|
66 | if self.chkDevA.isChecked(): | |
67 | self.var_devices.append(str(self.txtDeviceA.text())) |
|
67 | self.var_devices.append(str(self.txtDeviceA.text())) | |
68 | if self.chkDevB.isChecked(): |
|
68 | if self.chkDevB.isChecked(): | |
69 | self.var_devices.append(str(self.txtDeviceB.text())) |
|
69 | self.var_devices.append(str(self.txtDeviceB.text())) | |
70 | if self.chkDevC.isChecked(): |
|
70 | if self.chkDevC.isChecked(): | |
71 | self.var_devices.append(str(self.txtDeviceC.text())) |
|
71 | self.var_devices.append(str(self.txtDeviceC.text())) | |
72 | if self.chkDevD.isChecked(): |
|
72 | if self.chkDevD.isChecked(): | |
73 | self.var_devices.append(str(self.txtDeviceD.text())) |
|
73 | self.var_devices.append(str(self.txtDeviceD.text())) | |
74 |
|
74 | |||
75 | if len(self.var_devices) == 0: |
|
75 | if len(self.var_devices) == 0: | |
76 | return False |
|
76 | return False | |
77 | else: |
|
77 | else: | |
78 | return True |
|
78 | return True | |
79 |
|
79 | |||
80 |
|
80 | |||
81 | #----------------------------------------------------- Inicializacion para pruebas--------------------------------------------------------------- |
|
81 | #----------------------------------------------------- Inicializacion para pruebas--------------------------------------------------------------- | |
82 |
|
82 | |||
83 | def set_parameters_test(self): |
|
83 | def set_parameters_test(self): | |
84 | """ |
|
84 | """ | |
85 | Se usa para inicializar ciertos parametros para pruebas |
|
85 | Se usa para inicializar ciertos parametros para pruebas | |
86 | """ |
|
86 | """ | |
87 | self.txtDpath.setText('/home/ricardoar/optional/STORAGE/EW_DRIFTS') |
|
87 | self.txtDpath.setText('/home/ricardoar/optional/STORAGE/EW_DRIFTS') | |
88 | self.txtRpath.setText('/home/ricardoar/optional/prueba1_jro_backup_manager') |
|
88 | self.txtRpath.setText('/home/ricardoar/optional/prueba1_jro_backup_manager') | |
89 | self.txtElabel.setText('EW_DRIFTS_pruebas') |
|
89 | self.txtElabel.setText('EW_DRIFTS_pruebas') | |
90 | self.lstDcapacity.setCurrentIndex(4) |
|
90 | self.lstDcapacity.setCurrentIndex(4) | |
91 | self.txtDcapacity.setValue(100.0) |
|
91 | self.txtDcapacity.setValue(100.0) | |
92 | self.txtDcapacity.setReadOnly(False) |
|
92 | self.txtDcapacity.setReadOnly(False) | |
93 | self.txtDeviceA.setText("/dev/scd0") |
|
93 | self.txtDeviceA.setText("/dev/scd0") | |
94 | self.txtDeviceB.setText("/dev/scd1") |
|
94 | self.txtDeviceB.setText("/dev/scd1") | |
95 | self.txtDeviceC.setText("/dev/scd2") |
|
95 | self.txtDeviceC.setText("/dev/scd2") | |
96 | self.txtDeviceD.setText("/dev/scd3") |
|
96 | self.txtDeviceD.setText("/dev/scd3") | |
97 |
|
97 | |||
98 |
|
98 | |||
99 |
|
99 | |||
100 | #----------------------------------------------------- crea parameters.conf --------------------------------------------------------------- |
|
100 | #----------------------------------------------------- crea parameters.conf --------------------------------------------------------------- | |
101 |
|
101 | |||
102 | def make_parameters_conf(self): |
|
102 | def make_parameters_conf(self): | |
103 | var_file = open("parameters.conf","w") |
|
103 | var_file = open("parameters.conf","w") | |
104 | var_file.write(self.var_Dpath+"\n") #0 Ruta de los datos |
|
104 | var_file.write(self.var_Dpath+"\n") #0 Ruta de los datos | |
105 | var_file.write(self.var_Rpath+"\n") #1 Ruta del proyecto |
|
105 | var_file.write(self.var_Rpath+"\n") #1 Ruta del proyecto | |
106 | var_file.write(str(self.var_lstDtype)+"\n") #2 opcion Data Type |
|
106 | var_file.write(str(self.var_lstDtype)+"\n") #2 opcion Data Type | |
107 | var_file.write(self.var_Dtype+"\n") #3 extension Data Type |
|
107 | var_file.write(self.var_Dtype+"\n") #3 extension Data Type | |
108 | var_file.write(self.var_Elabel+"\n") #4 etiqueta |
|
108 | var_file.write(self.var_Elabel+"\n") #4 etiqueta | |
109 | var_file.write(str(self.var_Copys)+"\n") #5 Numero de copias |
|
109 | var_file.write(str(self.var_Copys)+"\n") #5 Numero de copias | |
110 | var_file.write(str(self.var_lstDcapacity)+"\n") #6 opcion Device Capacity |
|
110 | var_file.write(str(self.var_lstDcapacity)+"\n") #6 opcion Device Capacity | |
111 | var_file.write(str(self.var_Dcapacity)+"\n") #7 tamaΓ±o Device Capacity |
|
111 | var_file.write(str(self.var_Dcapacity)+"\n") #7 tamaΓ±o Device Capacity | |
112 | var_file.write(str(self.var_Discs)+"\n") #8 Numero de discos a grabar |
|
112 | var_file.write(str(self.var_Discs)+"\n") #8 Numero de discos a grabar | |
113 | # var_file.write(str(self.lstStartDay.currentIndex())+"\n") #9 Indice fecha inicial |
|
113 | # var_file.write(str(self.lstStartDay.currentIndex())+"\n") #9 Indice fecha inicial | |
114 | # var_file.write(str(self.lstStopDay.currentIndex())+"\n") #10 Indice fecha final |
|
114 | # var_file.write(str(self.lstStopDay.currentIndex())+"\n") #10 Indice fecha final | |
115 |
|
115 | |||
116 | var_file.close() |
|
116 | var_file.close() | |
117 |
|
117 | |||
118 | #----------------------------------------------------- carga parameters.conf --------------------------------------------------------------- |
|
118 | #----------------------------------------------------- carga parameters.conf --------------------------------------------------------------- | |
119 |
|
119 | |||
120 | def get_parameters_conf(self): |
|
120 | def get_parameters_conf(self): | |
121 | var_file = open("parameters.conf","r") |
|
121 | var_file = open("parameters.conf","r") | |
122 | lines = var_file.readlines() |
|
122 | lines = var_file.readlines() | |
123 | self.txtDpath.setText(lines[0][:-1]) #0 |
|
123 | self.txtDpath.setText(lines[0][:-1]) #0 | |
124 | self.txtRpath.setText(lines[1][:-1]) #1 |
|
124 | self.txtRpath.setText(lines[1][:-1]) #1 | |
125 | self.lstDtype.setCurrentIndex(int(lines[2])) #2 |
|
125 | self.lstDtype.setCurrentIndex(int(lines[2])) #2 | |
126 | self.txtDtype.setText(lines[3][:-1]) #3 |
|
126 | self.txtDtype.setText(lines[3][:-1]) #3 | |
127 | self.txtElabel.setText(lines[4][:-1]) #4 |
|
127 | self.txtElabel.setText(lines[4][:-1]) #4 | |
128 | self.txtCopys.setValue(int(lines[5][:-1])) #5 |
|
128 | self.txtCopys.setValue(int(lines[5][:-1])) #5 | |
129 | self.lstDcapacity.setCurrentIndex(int(lines[6])) #6 |
|
129 | self.lstDcapacity.setCurrentIndex(int(lines[6])) #6 | |
130 | self.txtDcapacity.setValue(float(lines[7])) #7 |
|
130 | self.txtDcapacity.setValue(float(lines[7])) #7 | |
131 | self.var_Discs = int(lines[8]) #8 |
|
131 | self.var_Discs = int(lines[8]) #8 | |
132 | # var_StartDay = int(lines[6]) #9 |
|
132 | # var_StartDay = int(lines[6]) #9 | |
133 | # var_StopDay = int(lines[7]) #10 |
|
133 | # var_StopDay = int(lines[7]) #10 | |
134 | ################################ |
|
134 | ################################ | |
135 | self.var_Copys = self.txtCopys.value() #5 |
|
135 | self.var_Copys = self.txtCopys.value() #5 | |
136 | ################################ |
|
136 | ################################ | |
137 |
|
137 | |||
138 | var_file.close() |
|
138 | var_file.close() | |
139 |
|
139 | |||
140 |
|
140 | |||
141 |
|
141 | |||
142 | #-------------------------- actualiza el valor de las variables con los parametros seleccionados ----------------------------- |
|
142 | #-------------------------- actualiza el valor de las variables con los parametros seleccionados ----------------------------- | |
143 |
|
143 | |||
144 | def set_vars(self): |
|
144 | def set_vars(self): | |
145 | self.var_Dpath = str(self.txtDpath.text()) #0 |
|
145 | self.var_Dpath = str(self.txtDpath.text()) #0 | |
146 | self.var_Rpath = str(self.txtRpath.text()) #1 |
|
146 | self.var_Rpath = str(self.txtRpath.text()) #1 | |
147 | self.var_lstDtype = self.lstDtype.currentIndex() #2 |
|
147 | self.var_lstDtype = self.lstDtype.currentIndex() #2 | |
148 | self.var_Dtype = str(self.txtDtype.text()) #3 |
|
148 | self.var_Dtype = str(self.txtDtype.text()) #3 | |
149 | self.var_Elabel = str(self.txtElabel.text()) #4 |
|
149 | self.var_Elabel = str(self.txtElabel.text()) #4 | |
150 | self.var_Copys = self.txtCopys.value() #5 |
|
150 | self.var_Copys = self.txtCopys.value() #5 | |
151 | self.var_lstDcapacity = self.lstDcapacity.currentIndex() #6 |
|
151 | self.var_lstDcapacity = self.lstDcapacity.currentIndex() #6 | |
152 | self.var_Dcapacity = self.txtDcapacity.value() #7 |
|
152 | self.var_Dcapacity = self.txtDcapacity.value() #7 | |
153 | self.var_Discs = self.var_Discs #8 |
|
153 | self.var_Discs = self.var_Discs #8 | |
154 |
|
154 | |||
155 |
|
155 | |||
156 | #-------------------------- crea burning.conf ----------------------------- |
|
156 | #-------------------------- crea burning.conf ----------------------------- | |
157 |
|
157 | |||
158 | def make_burning_conf(self): |
|
158 | def make_burning_conf(self): | |
159 | var_file = open("burning.conf","w") |
|
159 | var_file = open("burning.conf","w") | |
160 | var_n_burned_discs = ( ( (self.var_disc_n - 1) * self.var_Copys) + self.var_copy_n -1 ) |
|
160 | var_n_burned_discs = ( ( (self.var_disc_n - 1) * self.var_Copys) + self.var_copy_n -1 ) | |
161 | var_file.write(str(var_n_burned_discs)+"\n") #0 Numero de discos ya grabados |
|
161 | var_file.write(str(var_n_burned_discs)+"\n") #0 Numero de discos ya grabados | |
162 | var_file.write(str(self.var_disc_n)+"\n") #1 Disco actual para grabar |
|
162 | var_file.write(str(self.var_disc_n)+"\n") #1 Disco actual para grabar | |
163 | var_file.write(str(self.var_copy_n)+"\n") #2 Numero de copia actual para grabar |
|
163 | var_file.write(str(self.var_copy_n)+"\n") #2 Numero de copia actual para grabar | |
164 | var_file.close() |
|
164 | var_file.close() | |
165 |
|
165 | |||
166 | #----------------------------------------------------- carga burning.conf --------------------------------------------------------------- |
|
166 | #----------------------------------------------------- carga burning.conf --------------------------------------------------------------- | |
167 |
|
167 | |||
168 | def get_burning_conf(self): |
|
168 | def get_burning_conf(self): | |
169 | var_file = open("burning.conf","r") |
|
169 | var_file = open("burning.conf","r") | |
170 | lines = var_file.readlines() |
|
170 | lines = var_file.readlines() | |
171 | self.var_burned_discs = int(lines[0]) #0 |
|
171 | self.var_burned_discs = int(lines[0]) #0 | |
172 | self.var_disc_n = int(lines[1]) |
|
172 | self.var_disc_n = int(lines[1]) | |
173 | self.var_copy_n = int(lines[2]) |
|
173 | self.var_copy_n = int(lines[2]) | |
174 | var_file.close() |
|
174 | var_file.close() | |
175 |
|
175 | |||
176 | #---------------------------------------------- Habilitacion y deshabilitacion de items ------------------------------------------------------- |
|
176 | #---------------------------------------------- Habilitacion y deshabilitacion de items ------------------------------------------------------- | |
177 |
|
177 | |||
178 | def enabled_items1(var_bool, self): |
|
178 | def enabled_items1(var_bool, self): | |
179 | self.tabParameters.setEnabled(not(var_bool)) |
|
179 | self.tabParameters.setEnabled(not(var_bool)) | |
180 | self.lstDcapacity.setEnabled(not(var_bool)) |
|
180 | self.lstDcapacity.setEnabled(not(var_bool)) | |
181 | self.txtDcapacity.setEnabled(not(var_bool)) |
|
181 | self.txtDcapacity.setEnabled(not(var_bool)) | |
182 | self.actionChange_Parameters.setEnabled(var_bool) |
|
182 | self.actionChange_Parameters.setEnabled(var_bool) | |
183 | self.btnGbkp.setEnabled(not(var_bool)) |
|
183 | self.btnGbkp.setEnabled(not(var_bool)) | |
184 | self.btnRestart.setEnabled(var_bool) |
|
184 | self.btnRestart.setEnabled(var_bool) | |
185 | self.btnStartburn.setEnabled(var_bool) |
|
185 | self.btnStartburn.setEnabled(var_bool) | |
186 |
|
186 | |||
187 |
|
187 | |||
188 | def enabled_items2(var_bool, self): |
|
188 | def enabled_items2(var_bool, self): | |
189 | self.btnRestart.setEnabled(not(var_bool)) |
|
189 | self.btnRestart.setEnabled(not(var_bool)) | |
190 | self.btnStartburn.setEnabled(not(var_bool)) |
|
190 | self.btnStartburn.setEnabled(not(var_bool)) | |
191 | self.btnStopburn.setEnabled(var_bool) |
|
191 | self.btnStopburn.setEnabled(var_bool) | |
192 | self.chkCheck.setEnabled(not(var_bool)) |
|
192 | self.chkCheck.setEnabled(not(var_bool)) | |
|
193 | self.actionChange_Parameters.setEnabled(False) | |||
|
194 | ||||
|
195 | ||||
|
196 | ||||
|
197 | ||||
|
198 | #---------------------------------------------- Actualiza estado en los labels ------------------------------------------------------- | |||
|
199 | ||||
|
200 | def update_message(type, self): | |||
|
201 | ||||
|
202 | var_index = ( ( (self.var_disc_n - 1) * self.var_Copys) + (self.var_copy_n - 1) - self.var_burned_discs ) % len(self.var_devices) | |||
|
203 | ||||
|
204 | if type == 1: | |||
|
205 | var_message = "BURNING" | |||
|
206 | if var_index == 0: | |||
|
207 | self.txtBstatusA.setText(var_message) | |||
|
208 | self.txtBdiscA.setText(str(self.var_disc_n)) | |||
|
209 | self.txtBcopyA.setText(str(self.var_copy_n)) | |||
|
210 | ||||
|
211 | if var_index == 1: | |||
|
212 | self.txtBstatusB.setText(var_message) | |||
|
213 | self.txtBdiscB.setText(str(self.var_disc_n)) | |||
|
214 | self.txtBcopyB.setText(str(self.var_copy_n)) | |||
|
215 | ||||
|
216 | if var_index == 2: | |||
|
217 | self.txtBstatusC.setText(var_message) | |||
|
218 | self.txtBdiscC.setText(str(self.var_disc_n)) | |||
|
219 | self.txtBcopyC.setText(str(self.var_copy_n)) | |||
|
220 | ||||
|
221 | if var_index == 3: | |||
|
222 | self.txtBstatusD.setText(var_message) | |||
|
223 | self.txtBdiscD.setText(str(self.var_disc_n)) | |||
|
224 | self.txtBcopyD.setText(str(self.var_copy_n)) | |||
|
225 | ||||
|
226 | if type == 2: | |||
|
227 | var_message = "COMPLETED" | |||
|
228 | if var_index == 0: | |||
|
229 | self.txtBstatusA.setText(var_message) | |||
|
230 | ||||
|
231 | if var_index == 1: | |||
|
232 | self.txtBstatusB.setText(var_message) | |||
|
233 | ||||
|
234 | if var_index == 2: | |||
|
235 | self.txtBstatusC.setText(var_message) | |||
|
236 | ||||
|
237 | if var_index == 3: | |||
|
238 | self.txtBstatusD.setText(var_message) | |||
|
239 | ||||
|
240 | ||||
|
241 | ||||
|
242 |
@@ -1,517 +1,523 | |||||
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 commands |
|
18 | import commands | |
19 | from functions import functions |
|
19 | from functions import functions | |
20 | from functions import functions2 |
|
20 | from functions import functions2 | |
21 |
|
21 | |||
22 | class MainWindow(QMainWindow, Ui_MainWindow): |
|
22 | class MainWindow(QMainWindow, Ui_MainWindow): | |
23 | """ |
|
23 | """ | |
24 | Class documentation goes here. |
|
24 | Class documentation goes here. | |
25 | """ |
|
25 | """ | |
26 |
|
26 | |||
27 | def __init__(self, parent = None): |
|
27 | def __init__(self, parent = None): | |
28 | QMainWindow.__init__(self, parent) |
|
28 | QMainWindow.__init__(self, parent) | |
29 | self.setupUi(self) |
|
29 | self.setupUi(self) | |
30 |
|
30 | |||
31 | self.setupUi2() |
|
31 | self.setupUi2() | |
32 | #sys.stdout = self #redirige salida estandar |
|
32 | #sys.stdout = self #redirige salida estandar | |
33 |
|
33 | |||
34 | def setupUi2(self): |
|
34 | def setupUi2(self): | |
35 |
|
35 | |||
36 | # functions2.detect_devices(self) #busca los dispositivos de grabacion |
|
36 | # functions2.detect_devices(self) #busca los dispositivos de grabacion | |
37 |
|
37 | |||
38 | self.var_Discs = 0 #Numero de discos del proyecto |
|
38 | self.var_Discs = 0 #Numero de discos del proyecto | |
39 | self.var_Copys = 0 #Numero de copias |
|
39 | self.var_Copys = 0 #Numero de copias | |
40 | self.var_disc_n = 0 |
|
40 | self.var_disc_n = 0 | |
41 | self.var_copy_n = 0 |
|
41 | self.var_copy_n = 0 | |
42 | self.var_burned_discs = 0 |
|
42 | self.var_burned_discs = 0 | |
43 |
|
43 | |||
44 | self.var_list=[] |
|
44 | self.var_list=[] | |
45 | self.var_sublist=[] |
|
45 | self.var_sublist=[] | |
46 |
|
46 | |||
47 | self.var_devices=[] |
|
47 | self.var_devices=[] | |
48 |
|
48 | |||
49 | self.var_step = 0 |
|
49 | self.var_step = 0 | |
50 | self.bool_state_burning = False |
|
50 | self.bool_state_burning = False | |
51 | self.blank_discs = False |
|
51 | self.blank_discs = False | |
52 |
|
52 | |||
53 |
|
53 | |||
54 | #Revisa si existe el archivo de confirguracion |
|
54 | #Revisa si existe el archivo de confirguracion | |
55 | if os.path.isfile("parameters.conf"): |
|
55 | if os.path.isfile("parameters.conf"): | |
56 | functions2.get_parameters_conf(self) |
|
56 | functions2.get_parameters_conf(self) | |
57 | self.txtInfo.append("Parameters were loaded from configuration file") |
|
57 | self.txtInfo.append("Parameters were loaded from configuration file") | |
58 | self.txtInfo.append("Total number of discs for recording: "+str(self.var_Discs * self.var_Copys)) |
|
58 | self.txtInfo.append("Total number of discs for recording: "+str(self.var_Discs * self.var_Copys)) | |
59 |
|
59 | |||
60 | else: |
|
60 | else: | |
61 | # self.txtInfo.append("Elija los parametros de configuracion") |
|
61 | # self.txtInfo.append("Elija los parametros de configuracion") | |
62 | functions2.set_parameters_test(self) #Establece ciertos parametros, para pruebas |
|
62 | functions2.set_parameters_test(self) #Establece ciertos parametros, para pruebas | |
63 |
|
63 | |||
64 | functions2.set_vars(self) #Carga las variables de la clase con los parametros seleccionados |
|
64 | functions2.set_vars(self) #Carga las variables de la clase con los parametros seleccionados | |
65 |
|
65 | |||
66 | self.statusDpath = functions.dir_exists(self.var_Dpath, self) |
|
66 | self.statusDpath = functions.dir_exists(self.var_Dpath, self) | |
67 | self.statusRpath = functions.dir_exists(self.var_Rpath, self) |
|
67 | self.statusRpath = functions.dir_exists(self.var_Rpath, self) | |
68 | functions.load_days(self) |
|
68 | functions.load_days(self) | |
69 |
|
69 | |||
70 | if os.path.isfile("parameters.conf"): |
|
70 | if os.path.isfile("parameters.conf"): | |
71 | functions2.enabled_items1(True, self) #Se bloquean los parametros de configuracion |
|
71 | functions2.enabled_items1(True, self) #Se bloquean los parametros de configuracion | |
72 |
|
72 | |||
73 | if os.path.isfile("burning.conf"): |
|
73 | if os.path.isfile("burning.conf"): | |
74 | functions2.get_burning_conf(self) |
|
74 | functions2.get_burning_conf(self) | |
75 | self.txtInfo.append("Current disc: "+str(self.var_disc_n)) |
|
75 | self.txtInfo.append("Current disc: "+str(self.var_disc_n)) | |
76 | self.txtInfo.append("Current copy: "+str(self.var_copy_n)) |
|
76 | self.txtInfo.append("Current copy: "+str(self.var_copy_n)) | |
77 | self.btnStartburn.setText("Continue") |
|
77 | self.btnStartburn.setText("Continue") | |
78 |
|
78 | |||
79 | self.txtDeviceA.setText("/dev/scd0") |
|
79 | self.txtDeviceA.setText("/dev/scd0") | |
80 | self.txtDeviceB.setText("/dev/scd1") |
|
80 | self.txtDeviceB.setText("/dev/scd1") | |
81 | self.txtDeviceC.setText("/dev/scd2") |
|
81 | self.txtDeviceC.setText("/dev/scd2") | |
82 | self.txtDeviceD.setText("/dev/scd3") |
|
82 | self.txtDeviceD.setText("/dev/scd3") | |
83 |
|
83 | |||
84 | self.connect(self.actionChange_Parameters, QtCore.SIGNAL("triggered()"), self.changeParameters) |
|
84 | self.connect(self.actionChange_Parameters, QtCore.SIGNAL("triggered()"), self.changeParameters) | |
85 | self.connect(self.actionAbout, QtCore.SIGNAL("triggered()"), self.about) |
|
85 | self.connect(self.actionAbout, QtCore.SIGNAL("triggered()"), self.about) | |
86 |
|
86 | |||
87 | self.var_process = QtCore.QProcess() |
|
87 | self.var_process = QtCore.QProcess() | |
88 | self.connect(self.var_process, QtCore.SIGNAL('readyReadStandardOutput()'), self.readOuput) |
|
88 | self.connect(self.var_process, QtCore.SIGNAL('readyReadStandardOutput()'), self.readOuput) | |
89 | self.connect(self.var_process, QtCore.SIGNAL('readyReadStandardError()'), self.readError) |
|
89 | self.connect(self.var_process, QtCore.SIGNAL('readyReadStandardError()'), self.readError) | |
90 | self.connect(self.var_process, QtCore.SIGNAL('finished(int,QProcess::ExitStatus)'), self.finished) |
|
90 | self.connect(self.var_process, QtCore.SIGNAL('finished(int,QProcess::ExitStatus)'), self.finished) | |
91 |
|
91 | |||
92 | self.var_process_check = QtCore.QProcess() |
|
92 | self.var_process_check = QtCore.QProcess() | |
93 | self.connect(self.var_process_check, QtCore.SIGNAL('readyReadStandardOutput()'), self.readOuput_check) |
|
93 | self.connect(self.var_process_check, QtCore.SIGNAL('readyReadStandardOutput()'), self.readOuput_check) | |
94 | self.connect(self.var_process_check, QtCore.SIGNAL('readyReadStandardError()'), self.readError_check) |
|
94 | self.connect(self.var_process_check, QtCore.SIGNAL('readyReadStandardError()'), self.readError_check) | |
95 | self.connect(self.var_process_check, QtCore.SIGNAL('finished(int,QProcess::ExitStatus)'), self.finished_check) |
|
95 | self.connect(self.var_process_check, QtCore.SIGNAL('finished(int,QProcess::ExitStatus)'), self.finished_check) | |
96 |
|
96 | |||
97 | def write(self, txt): |
|
97 | def write(self, txt): | |
98 | self.txtInfo.append(str(txt)) |
|
98 | self.txtInfo.append(str(txt)) | |
99 |
|
99 | |||
100 | def changeParameters(self): |
|
100 | def changeParameters(self): | |
101 | dlg=QtGui.QDialog() |
|
101 | dlg=QtGui.QDialog() | |
102 | dlgui=Ui_Parameters() |
|
102 | dlgui=Ui_Parameters() | |
103 | dlgui.setupUi(dlg) |
|
103 | dlgui.setupUi(dlg) | |
104 | if (dlg.exec_() == QtGui.QDialog.Accepted): |
|
104 | if (dlg.exec_() == QtGui.QDialog.Accepted): | |
105 | if dlgui.txtDisc.value() > self.var_Discs or dlgui.txtCopy.value() > dlgui.txtNcopys.value(): |
|
105 | if dlgui.txtDisc.value() > self.var_Discs or dlgui.txtCopy.value() > dlgui.txtNcopys.value(): | |
106 | self.txtInfo.append("Wrong parameters") |
|
106 | self.txtInfo.append("Wrong parameters") | |
107 | else: |
|
107 | else: | |
108 | self.var_Copys = dlgui.txtNcopys.value() |
|
108 | self.var_Copys = dlgui.txtNcopys.value() | |
109 | self.var_disc_n = dlgui.txtDisc.value() |
|
109 | self.var_disc_n = dlgui.txtDisc.value() | |
110 | self.var_copy_n = dlgui.txtCopy.value() |
|
110 | self.var_copy_n = dlgui.txtCopy.value() | |
111 | self.txtInfo.append("Changed parameters") |
|
111 | self.txtInfo.append("Changed parameters") | |
|
112 | self.var_burned_discs = ( ( (self.var_disc_n - 1) * self.var_Copys) + self.var_copy_n -1 ) | |||
112 |
|
113 | |||
113 |
|
114 | |||
114 | def about(self): |
|
115 | def about(self): | |
115 | dlg_about=QtGui.QDialog() |
|
116 | dlg_about=QtGui.QDialog() | |
116 | dlgui_about=Ui_About() |
|
117 | dlgui_about=Ui_About() | |
117 | dlgui_about.setupUi(dlg_about) |
|
118 | dlgui_about.setupUi(dlg_about) | |
118 | dlg_about.exec_() |
|
119 | dlg_about.exec_() | |
119 |
|
120 | |||
120 | #----------------------------------------------------- Funciones del proceso --------------------------------------------------------------- |
|
121 | #----------------------------------------------------- Funciones del proceso --------------------------------------------------------------- | |
121 |
|
122 | |||
122 | def readOuput(self): |
|
123 | def readOuput(self): | |
123 | self.txtInfo.insertPlainText("stdout: " + QtCore.QString(self.var_process.readAllStandardOutput())) |
|
124 | # self.txtInfo.insertPlainText("stdout: " + QtCore.QString(self.var_process.readAllStandardOutput())) | |
|
125 | pass | |||
124 |
|
126 | |||
125 | def readError(self): |
|
127 | def readError(self): | |
126 | self.txtInfo.insertPlainText("stderr: " + QtCore.QString(self.var_process.readAllStandardError())) |
|
128 | self.txtInfo.insertPlainText("stderr: " + QtCore.QString(self.var_process.readAllStandardError())) | |
127 |
|
129 | |||
128 | def finished(self): |
|
130 | def finished(self): | |
129 | self.txtInfo.insertPlainText("process completed"+QtCore.QString(self.var_process.exitCode())+"\n") |
|
131 | self.txtInfo.insertPlainText("\nprocess completed"+QtCore.QString(self.var_process.exitCode())+"\n") | |
130 |
|
132 | |||
131 |
|
133 | |||
132 | if self.var_process.exitCode() != 0: |
|
134 | if self.var_process.exitCode() != 0: | |
133 | self.txtInfo.append("ERROR") |
|
135 | self.txtInfo.append("ERROR") | |
134 |
|
136 | |||
135 | if self.bool_state_burning: |
|
137 | if self.bool_state_burning: | |
136 | if self.var_step == 0: |
|
138 | if self.var_step == 0: | |
137 | self.var_step = 1 #Se ira al paso de la grabacion en la siguiente llamada |
|
139 | self.var_step = 1 #Se ira al paso de la grabacion en la siguiente llamada | |
138 |
|
140 | |||
139 | elif self.var_step == 1: |
|
141 | elif self.var_step == 1: | |
|
142 | functions2.update_message(2, self) | |||
140 | self.var_copy_n += 1 |
|
143 | self.var_copy_n += 1 | |
141 |
|
144 | |||
142 | self.burning() |
|
145 | self.burning() | |
143 |
|
146 | |||
144 |
|
147 | |||
145 | #----------------------------------------------------- Funciones del proceso de verificacion --------------------------------------------------------------- |
|
148 | #----------------------------------------------------- Funciones del proceso de verificacion --------------------------------------------------------------- | |
146 |
|
149 | |||
147 | def readOuput_check(self): |
|
150 | def readOuput_check(self): | |
148 | self.txtInfo.insertPlainText("stdout check: " + QtCore.QString(self.var_process_check.readAllStandardOutput())) |
|
151 | self.txtInfo.insertPlainText("stdout check: " + QtCore.QString(self.var_process_check.readAllStandardOutput())) | |
149 |
|
152 | |||
150 | def readError_check(self): |
|
153 | def readError_check(self): | |
151 | self.txtInfo.setText("stderr check: " + QtCore.QString(self.var_process_check.readAllStandardError())) |
|
154 | self.txtInfo.setText("stderr check: " + QtCore.QString(self.var_process_check.readAllStandardError())) | |
152 |
|
155 | |||
153 | def finished_check(self): |
|
156 | def finished_check(self): | |
154 | self.txtInfo.append("check process completed "+QtCore.QString(self.var_process_check.exitCode())+"\n") |
|
157 | self.txtInfo.append("check process completed "+QtCore.QString(self.var_process_check.exitCode())+"\n") | |
155 |
|
158 | |||
156 |
|
159 | |||
157 | #----------------------------------------------------- Obtencion de la ruta de los datos --------------------------------------------------------------- |
|
160 | #----------------------------------------------------- Obtencion de la ruta de los datos --------------------------------------------------------------- | |
158 |
|
161 | |||
159 | @pyqtSignature("") |
|
162 | @pyqtSignature("") | |
160 | def on_btnDpath_clicked(self): |
|
163 | def on_btnDpath_clicked(self): | |
161 | """ |
|
164 | """ | |
162 | Permite seleccionar graficamente el direcorio de los datos a grabar |
|
165 | Permite seleccionar graficamente el direcorio de los datos a grabar | |
163 | """ |
|
166 | """ | |
164 | self.var_Dpath= str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
167 | self.var_Dpath= str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) | |
165 | self.txtDpath.setText(self.var_Dpath) |
|
168 | self.txtDpath.setText(self.var_Dpath) | |
166 | self.statusDpath = functions.dir_exists(self.var_Dpath, self) |
|
169 | self.statusDpath = functions.dir_exists(self.var_Dpath, self) | |
167 | functions.load_days(self) |
|
170 | functions.load_days(self) | |
168 |
|
171 | |||
169 |
|
172 | |||
170 | @pyqtSignature("") |
|
173 | @pyqtSignature("") | |
171 | def on_txtDpath_editingFinished(self): |
|
174 | def on_txtDpath_editingFinished(self): | |
172 | """ |
|
175 | """ | |
173 | Carga la ruta editada y verifica que sea correcta y carga la lista de dias |
|
176 | Carga la ruta editada y verifica que sea correcta y carga la lista de dias | |
174 | """ |
|
177 | """ | |
175 | self.var_Dpath=str(self.txtDpath.text()) #Se carga la variable con la ruta recien editada |
|
178 | self.var_Dpath=str(self.txtDpath.text()) #Se carga la variable con la ruta recien editada | |
176 | self.statusDpath = functions.dir_exists(self.var_Dpath, self) |
|
179 | self.statusDpath = functions.dir_exists(self.var_Dpath, self) | |
177 | functions.load_days(self) |
|
180 | functions.load_days(self) | |
178 |
|
181 | |||
179 |
|
182 | |||
180 | #----------------------------------------------------- Obtencion de las ruta del proyecto --------------------------------------------------------------- |
|
183 | #----------------------------------------------------- Obtencion de las ruta del proyecto --------------------------------------------------------------- | |
181 |
|
184 | |||
182 | @pyqtSignature("") |
|
185 | @pyqtSignature("") | |
183 | def on_btnRpath_clicked(self): |
|
186 | def on_btnRpath_clicked(self): | |
184 | """ |
|
187 | """ | |
185 | Permite seleccionar graficamente el direcorio del proyecto |
|
188 | Permite seleccionar graficamente el direcorio del proyecto | |
186 | """ |
|
189 | """ | |
187 | self.var_Rpath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
190 | self.var_Rpath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) | |
188 | self.txtRpath.setText(self.var_Rpath) |
|
191 | self.txtRpath.setText(self.var_Rpath) | |
189 | self.statusRpath = functions.dir_exists(self.var_Rpath, self) |
|
192 | self.statusRpath = functions.dir_exists(self.var_Rpath, self) | |
190 |
|
193 | |||
191 |
|
194 | |||
192 | @pyqtSignature("") |
|
195 | @pyqtSignature("") | |
193 | def on_txtRpath_editingFinished(self): |
|
196 | def on_txtRpath_editingFinished(self): | |
194 | """ |
|
197 | """ | |
195 | Valida la ruta del proyecto |
|
198 | Valida la ruta del proyecto | |
196 | """ |
|
199 | """ | |
197 | self.var_Rpath = str(self.txtRpath.text()) #Se carga la variable con la ruta recien editada |
|
200 | self.var_Rpath = str(self.txtRpath.text()) #Se carga la variable con la ruta recien editada | |
198 | self.statusRpath = functions.dir_exists(self.var_Rpath, self) |
|
201 | self.statusRpath = functions.dir_exists(self.var_Rpath, self) | |
199 |
|
202 | |||
200 |
|
203 | |||
201 | #----------------------------------------------------- Tipo de datos --------------------------------------------------------------- |
|
204 | #----------------------------------------------------- Tipo de datos --------------------------------------------------------------- | |
202 |
|
205 | |||
203 | @pyqtSignature("int") |
|
206 | @pyqtSignature("int") | |
204 | def on_lstDtype_activated(self, index): |
|
207 | def on_lstDtype_activated(self, index): | |
205 | """ |
|
208 | """ | |
206 | Permite elegir entre los tipos de archivos |
|
209 | Permite elegir entre los tipos de archivos | |
207 | """ |
|
210 | """ | |
208 | self.txtDtype.setReadOnly(True) |
|
211 | self.txtDtype.setReadOnly(True) | |
209 | if index == 0: |
|
212 | if index == 0: | |
210 | self.var_Dtype ='r' |
|
213 | self.var_Dtype ='r' | |
211 | elif index == 1: |
|
214 | elif index == 1: | |
212 | self.var_Dtype ='pdata' |
|
215 | self.var_Dtype ='pdata' | |
213 | elif index == 2: |
|
216 | elif index == 2: | |
214 | self.var_Dtype ='sswma' |
|
217 | self.var_Dtype ='sswma' | |
215 | else : |
|
218 | else : | |
216 | self.var_Dtype ='' |
|
219 | self.var_Dtype ='' | |
217 | self.txtDtype.setReadOnly(False) |
|
220 | self.txtDtype.setReadOnly(False) | |
218 |
|
221 | |||
219 | self.txtDtype.setText(self.var_Dtype) |
|
222 | self.txtDtype.setText(self.var_Dtype) | |
220 | functions.load_days(self) #llamada a funcion |
|
223 | functions.load_days(self) #llamada a funcion | |
221 |
|
224 | |||
222 | @pyqtSignature("") |
|
225 | @pyqtSignature("") | |
223 | def on_txtDtype_editingFinished(self): |
|
226 | def on_txtDtype_editingFinished(self): | |
224 | self.var_Dtype=str(self.txtDtype.text()) |
|
227 | self.var_Dtype=str(self.txtDtype.text()) | |
225 | functions.load_days(self) #llamada a funcion |
|
228 | functions.load_days(self) #llamada a funcion | |
226 |
|
229 | |||
227 |
|
230 | |||
228 | #----------------------------------------------------- Etiqueta --------------------------------------------------------------- |
|
231 | #----------------------------------------------------- Etiqueta --------------------------------------------------------------- | |
229 |
|
232 | |||
230 | @pyqtSignature("") |
|
233 | @pyqtSignature("") | |
231 | def on_txtElabel_editingFinished(self): |
|
234 | def on_txtElabel_editingFinished(self): | |
232 | self.var_Elabel = str(self.txtElabel.text()) |
|
235 | self.var_Elabel = str(self.txtElabel.text()) | |
233 |
|
236 | |||
234 | #----------------------------------------------------- Numero de copias --------------------------------------------------------------- |
|
237 | #----------------------------------------------------- Numero de copias --------------------------------------------------------------- | |
235 | @pyqtSignature("") |
|
238 | @pyqtSignature("") | |
236 | def on_txtCopys_editingFinished(self): |
|
239 | def on_txtCopys_editingFinished(self): | |
237 | self.var_Copys = self.txtCopys.value() |
|
240 | self.var_Copys = self.txtCopys.value() | |
238 |
|
241 | |||
239 | #----------------------------------------------------- Seleccion del rango de fechas --------------------------------------------------------------- |
|
242 | #----------------------------------------------------- Seleccion del rango de fechas --------------------------------------------------------------- | |
240 |
|
243 | |||
241 | @pyqtSignature("int") #CLOSED |
|
244 | @pyqtSignature("int") #CLOSED | |
242 | def on_lstStartDay_activated(self, index): |
|
245 | def on_lstStartDay_activated(self, index): | |
243 | """ |
|
246 | """ | |
244 | Cambia la lista de opciones en lstStopDay |
|
247 | Cambia la lista de opciones en lstStopDay | |
245 | """ |
|
248 | """ | |
246 | var_StopDay_index=self.lstStopDay.count() - self.lstStopDay.currentIndex() |
|
249 | var_StopDay_index=self.lstStopDay.count() - self.lstStopDay.currentIndex() | |
247 | self.lstStopDay.clear() |
|
250 | self.lstStopDay.clear() | |
248 |
|
251 | |||
249 | for i in self.var_list[index:]: |
|
252 | for i in self.var_list[index:]: | |
250 | self.lstStopDay.addItem(i) |
|
253 | self.lstStopDay.addItem(i) | |
251 |
|
254 | |||
252 | self.lstStopDay.setCurrentIndex(self.lstStopDay.count() - var_StopDay_index) |
|
255 | self.lstStopDay.setCurrentIndex(self.lstStopDay.count() - var_StopDay_index) | |
253 |
|
256 | |||
254 | functions.get_sub_list(self) |
|
257 | functions.get_sub_list(self) | |
255 |
|
258 | |||
256 |
|
259 | |||
257 | @pyqtSignature("int") #CLOSED |
|
260 | @pyqtSignature("int") #CLOSED | |
258 | def on_lstStopDay_activated(self, index): |
|
261 | def on_lstStopDay_activated(self, index): | |
259 | """ |
|
262 | """ | |
260 | Cambia la lista de opciones en lstStartDay |
|
263 | Cambia la lista de opciones en lstStartDay | |
261 | """ |
|
264 | """ | |
262 | var_StartDay_index=self.lstStartDay.currentIndex() |
|
265 | var_StartDay_index=self.lstStartDay.currentIndex() | |
263 | var_end_index = self.lstStopDay.count() - index |
|
266 | var_end_index = self.lstStopDay.count() - index | |
264 | self.lstStartDay.clear() |
|
267 | self.lstStartDay.clear() | |
265 |
|
268 | |||
266 | for i in self.var_list[:len(self.var_list) - var_end_index + 1]: |
|
269 | for i in self.var_list[:len(self.var_list) - var_end_index + 1]: | |
267 | self.lstStartDay.addItem(i) |
|
270 | self.lstStartDay.addItem(i) | |
268 |
|
271 | |||
269 | self.lstStartDay.setCurrentIndex(var_StartDay_index) |
|
272 | self.lstStartDay.setCurrentIndex(var_StartDay_index) | |
270 |
|
273 | |||
271 | functions.get_sub_list(self) |
|
274 | functions.get_sub_list(self) | |
272 |
|
275 | |||
273 |
|
276 | |||
274 | #----------------------------------------------------- Capacidad del dispositivo de grabacion --------------------------------------------------------------- |
|
277 | #----------------------------------------------------- Capacidad del dispositivo de grabacion --------------------------------------------------------------- | |
275 |
|
278 | |||
276 | @pyqtSignature("") |
|
279 | @pyqtSignature("") | |
277 | def on_txtDcapacity_editingFinished(self): |
|
280 | def on_txtDcapacity_editingFinished(self): | |
278 | self.var_Dcapacity = self.txtDcapacity.value() |
|
281 | self.var_Dcapacity = self.txtDcapacity.value() | |
279 |
|
282 | |||
280 |
|
283 | |||
281 | @pyqtSignature("int") #CLOSED |
|
284 | @pyqtSignature("int") #CLOSED | |
282 | def on_lstDcapacity_activated(self, index): |
|
285 | def on_lstDcapacity_activated(self, index): | |
283 | """ |
|
286 | """ | |
284 | Permite elegir el tamaΓ±o del disco |
|
287 | Permite elegir el tamaΓ±o del disco | |
285 | """ |
|
288 | """ | |
286 | if index == 0: |
|
289 | if index == 0: | |
287 | var_size=25.0 |
|
290 | var_size=25.0 | |
288 | elif index == 1: |
|
291 | elif index == 1: | |
289 | var_size=8.5 |
|
292 | var_size=8.5 | |
290 | elif index == 2: |
|
293 | elif index == 2: | |
291 | var_size=4.7 |
|
294 | var_size=4.7 | |
292 | elif index == 3: |
|
295 | elif index == 3: | |
293 | var_size=0.7 |
|
296 | var_size=0.7 | |
294 |
|
297 | |||
295 | if index != 4: |
|
298 | if index != 4: | |
296 | self.txtDcapacity.setValue(var_size*10**9/1024**2) |
|
299 | self.txtDcapacity.setValue(var_size*10**9/1024**2) | |
297 | self.txtDcapacity.setReadOnly(True) |
|
300 | self.txtDcapacity.setReadOnly(True) | |
298 | else: |
|
301 | else: | |
299 | self.txtDcapacity.setValue(100.0) |
|
302 | self.txtDcapacity.setValue(100.0) | |
300 | self.txtDcapacity.setReadOnly(False) |
|
303 | self.txtDcapacity.setReadOnly(False) | |
301 |
|
304 | |||
302 | self.var_lstDcapacity = self.lstDcapacity.currentIndex() |
|
305 | self.var_lstDcapacity = self.lstDcapacity.currentIndex() | |
303 | self.var_Dcapacity = self.txtDcapacity.value() |
|
306 | self.var_Dcapacity = self.txtDcapacity.value() | |
304 |
|
307 | |||
305 |
|
308 | |||
306 | #============================================================================== |
|
309 | #============================================================================== | |
307 | # Botones para la generacion de los archivos de configuracion y el proceso de grabacion |
|
310 | # Botones para la generacion de los archivos de configuracion y el proceso de grabacion | |
308 | #============================================================================== |
|
311 | #============================================================================== | |
309 |
|
312 | |||
310 | #----------------------------------------------------- Generacion de la configuracion usando los parametros --------------------------------------------------------------- |
|
313 | #----------------------------------------------------- Generacion de la configuracion usando los parametros --------------------------------------------------------------- | |
311 |
|
314 | |||
312 | @pyqtSignature("") |
|
315 | @pyqtSignature("") | |
313 | def on_btnGbkp_clicked(self): |
|
316 | def on_btnGbkp_clicked(self): | |
314 | """ |
|
317 | """ | |
315 | Generacion de archivos de configuracion usando los parametros |
|
318 | Generacion de archivos de configuracion usando los parametros | |
316 | """ |
|
319 | """ | |
317 |
|
320 | |||
318 | if functions.validate_parameters(self) == False: |
|
321 | if functions.validate_parameters(self) == False: | |
319 | return |
|
322 | return | |
320 |
|
323 | |||
321 | #Crea las carpetas en la ruta del proyecto y verifica que se crearon correctamente |
|
324 | #Crea las carpetas en la ruta del proyecto y verifica que se crearon correctamente | |
322 | list_dirs=['gpath','iso','ppath', 'tmpdata'] |
|
325 | list_dirs=['gpath','iso','ppath', 'tmpdata'] | |
323 | bool_make_dirs = functions.make_dirs(list_dirs, self) |
|
326 | bool_make_dirs = functions.make_dirs(list_dirs, self) | |
324 | if bool_make_dirs == False: |
|
327 | if bool_make_dirs == False: | |
325 | return |
|
328 | return | |
326 |
|
329 | |||
327 | var_files_list = functions.list_files(self) #Se obtiene la lista de archivos a grabar |
|
330 | var_files_list = functions.list_files(self) #Se obtiene la lista de archivos a grabar | |
328 |
|
331 | |||
329 | self.var_Discs = functions.make_files_dat(var_files_list, self) #Se crean los archivos .dat |
|
332 | self.var_Discs = functions.make_files_dat(var_files_list, self) #Se crean los archivos .dat | |
330 |
|
333 | |||
331 | functions.make_files_print(self) # Se crean los archivos .print |
|
334 | functions.make_files_print(self) # Se crean los archivos .print | |
332 |
|
335 | |||
333 | functions2.make_parameters_conf(self) # se crea el archivo parameters.conf |
|
336 | functions2.make_parameters_conf(self) # se crea el archivo parameters.conf | |
334 |
|
337 | |||
335 | self.txtInfo.append("Total number of discs for recording: "+str(self.var_Discs * self.var_Copys)) |
|
338 | self.txtInfo.append("Total number of discs for recording: "+str(self.var_Discs * self.var_Copys)) | |
336 |
|
339 | |||
337 | #Se bloquean los parametros de configuracion |
|
340 | #Se bloquean los parametros de configuracion | |
338 | functions2.enabled_items1(True, self) |
|
341 | functions2.enabled_items1(True, self) | |
339 |
|
342 | |||
340 |
|
343 | |||
341 |
|
344 | |||
342 | #----------------------------------------------------- Permite reiniciar la configuracion --------------------------------------------------------------- |
|
345 | #----------------------------------------------------- Permite reiniciar la configuracion --------------------------------------------------------------- | |
343 |
|
346 | |||
344 | @pyqtSignature("") |
|
347 | @pyqtSignature("") | |
345 | def on_btnRestart_clicked(self): |
|
348 | def on_btnRestart_clicked(self): | |
346 | """ |
|
349 | """ | |
347 | Permite que se puedan cambiar los parametros |
|
350 | Permite que se puedan cambiar los parametros | |
348 | """ |
|
351 | """ | |
349 | if os.path.isfile("parameters.conf"): |
|
352 | if os.path.isfile("parameters.conf"): | |
350 | os.remove("parameters.conf") |
|
353 | os.remove("parameters.conf") | |
351 | if os.path.isfile("burning.conf"): |
|
354 | if os.path.isfile("burning.conf"): | |
352 | os.remove("burning.conf") |
|
355 | os.remove("burning.conf") | |
353 |
|
356 | |||
354 | functions2.enabled_items1(False, self) |
|
357 | functions2.enabled_items1(False, self) | |
355 | self.btnStartburn.setText("Start Burn") |
|
358 | self.btnStartburn.setText("Start Burn") | |
356 |
|
359 | |||
357 |
|
360 | |||
358 |
|
361 | |||
359 | #----------------------------------------------------- Iniciar proceso de grabacion --------------------------------------------------------------- |
|
362 | #----------------------------------------------------- Iniciar proceso de grabacion --------------------------------------------------------------- | |
360 |
|
363 | |||
361 | @pyqtSignature("") |
|
364 | @pyqtSignature("") | |
362 | def on_btnStartburn_clicked(self): |
|
365 | def on_btnStartburn_clicked(self): | |
363 | """ |
|
366 | """ | |
364 | Se inicia el proceso de grabacion |
|
367 | Se inicia el proceso de grabacion | |
365 | """ |
|
368 | """ | |
366 | self.txtInfo.append("BUTTON: on_btnStartburn_clicked") |
|
369 | ####### self.txtInfo.append("BUTTON: on_btnStartburn_clicked") | |
367 | #Verifica que exista algun dispositivo de grabacion seleccionado |
|
370 | #Verifica que exista algun dispositivo de grabacion seleccionado | |
368 | if not(functions2.selected_devices(self)): |
|
371 | if not(functions2.selected_devices(self)): | |
369 | self.txtInfo.append("There is no recording device selected") |
|
372 | self.txtInfo.append("There is no recording device selected") | |
370 | return |
|
373 | return | |
371 |
|
374 | |||
372 | # #Lista los dispositivos de grabacion a usar |
|
375 | # #Lista los dispositivos de grabacion a usar | |
373 | # for dev in self.var_devices: |
|
376 | # for dev in self.var_devices: | |
374 | # self.txtInfo.append("recording device :"+dev) |
|
377 | # self.txtInfo.append("recording device :"+dev) | |
375 |
|
378 | |||
376 | #Si se ingresaron los DVDs en blanco |
|
379 | #Si se ingresaron los DVDs en blanco | |
377 | if self.blank_discs == True: |
|
380 | if self.blank_discs == True: | |
378 | self.btnStartburn.setEnabled(False) |
|
381 | self.btnStartburn.setEnabled(False) | |
379 | self.burning() |
|
382 | self.burning() | |
380 | return |
|
383 | return | |
381 |
|
384 | |||
382 | #Si se cargo los parametros de burning.conf |
|
385 | #Si se cargo los parametros de burning.conf | |
383 | if self.var_burned_discs != 0: |
|
386 | if self.var_burned_discs != 0: | |
384 | self.txtInfo.append("BURNED DISC: "+str(self.var_burned_discs)) |
|
387 | self.txtInfo.append("BURNED DISC: "+str(self.var_burned_discs)) | |
385 | self.var_step = 0 |
|
388 | self.var_step = 0 | |
386 | self.bool_state_burning = True |
|
389 | self.bool_state_burning = True | |
387 | self.blank_discs = False |
|
390 | self.blank_discs = False | |
388 | functions2.enabled_items2(True, self) |
|
391 | functions2.enabled_items2(True, self) | |
389 | self.burning() |
|
392 | self.burning() | |
390 | return |
|
393 | return | |
391 |
|
394 | |||
392 | #Asigna las variables con los valores iniciales |
|
395 | #Asigna las variables con los valores iniciales | |
393 | self.var_disc_n = 1 # numero de disco actual para grabacion |
|
396 | self.var_disc_n = 1 # numero de disco actual para grabacion | |
394 | self.var_copy_n = 1 |
|
397 | self.var_copy_n = 1 | |
395 | self.var_burned_discs = 0 #numero de discos grabados |
|
398 | self.var_burned_discs = 0 #numero de discos grabados | |
396 | self.var_step = 0 |
|
399 | self.var_step = 0 | |
397 | self.bool_state_burning = True |
|
400 | self.bool_state_burning = True | |
398 | self.blank_discs = False |
|
401 | self.blank_discs = False | |
399 | functions2.enabled_items2(True, self) |
|
402 | functions2.enabled_items2(True, self) | |
400 | self.burning() |
|
403 | self.burning() | |
401 |
|
404 | |||
402 |
|
405 | |||
403 | def burning(self): |
|
406 | def burning(self): | |
404 |
|
407 | |||
405 | var_Rpath_ppath=self.var_Rpath+"/ppath" |
|
408 | var_Rpath_ppath=self.var_Rpath+"/ppath" | |
406 | var_Rpath_iso=self.var_Rpath+"/iso" |
|
409 | var_Rpath_iso=self.var_Rpath+"/iso" | |
407 |
|
410 | |||
408 | #Si ya se grabaron todas las copias del disco |
|
411 | #Si ya se grabaron todas las copias del disco | |
409 | if self.var_copy_n > self.var_Copys: |
|
412 | if self.var_copy_n > self.var_Copys: | |
410 | #borra la imagen.iso del numero de disco anterior |
|
413 | #borra la imagen.iso del numero de disco anterior | |
411 | file_iso=var_Rpath_iso+"/"+functions.i2s(self.var_disc_n)+".iso" |
|
414 | file_iso=var_Rpath_iso+"/"+functions.i2s(self.var_disc_n)+".iso" | |
412 | self.txtInfo.append("Deleting iso file") |
|
415 | # self.txtInfo.append("Deleting iso file") | |
413 | # os.remove(file_iso) |
|
416 | # os.remove(file_iso) | |
414 | self.var_copy_n = 1 |
|
417 | self.var_copy_n = 1 | |
415 | self.var_disc_n += 1 # aumenta numero de disco actual para grabacion |
|
418 | self.var_disc_n += 1 # aumenta numero de disco actual para grabacion | |
416 | self.var_step = 0 |
|
419 | self.var_step = 0 | |
417 |
|
420 | |||
418 | #Si ya se grabaron todos los discos |
|
421 | #Si ya se grabaron todos los discos | |
419 | if self.var_disc_n > self.var_Discs: |
|
422 | if self.var_disc_n > self.var_Discs: | |
420 | self.bool_state_burning = False |
|
423 | self.bool_state_burning = False | |
421 | self.txtInfo.append("Recording process is complete") |
|
424 | self.txtInfo.append("Recording process is complete") | |
422 | functions2.eject_devices(self) # Expulsa las bandejas de los dispostivos de grabacion |
|
425 | functions2.eject_devices(self) # Expulsa las bandejas de los dispostivos de grabacion | |
|
426 | self.on_btnRestart_clicked() | |||
|
427 | self.btnStopburn.setEnabled(False) | |||
423 | return |
|
428 | return | |
424 |
|
429 | |||
425 | self.txtInfo.append("\n"+str(self.var_disc_n)+" "+str(self.var_copy_n)+" "+str(self.var_step)) |
|
430 | # self.txtInfo.append("\n"+str(self.var_disc_n)+" "+str(self.var_copy_n)+" "+str(self.var_step)) | |
426 |
|
431 | |||
427 | #Creacion del archivo.iso para la grabacion |
|
432 | #Creacion del archivo.iso para la grabacion | |
428 | if self.var_step == 0: |
|
433 | if self.var_step == 0: | |
429 | self.txtInfo.append("########## Disc number: "+str(self.var_disc_n)+"##########") |
|
434 | self.txtInfo.append("########## Disc number: "+str(self.var_disc_n)+"##########") | |
430 | self.txtInfo.append("---------Creating iso file number: "+str(self.var_disc_n)) |
|
435 | self.txtInfo.append("---------Creating iso file number: "+str(self.var_disc_n)) | |
431 | var_cmd = functions.cmd_iso(self) |
|
436 | var_cmd = functions.cmd_iso(self) | |
432 |
|
437 | |||
433 | #Grabacion de los DVDs |
|
438 | #Grabacion de los DVDs | |
434 | elif self.var_step == 1: |
|
439 | elif self.var_step == 1: | |
435 |
|
440 | |||
436 | functions2.make_burning_conf(self) |
|
441 | functions2.make_burning_conf(self) | |
437 |
|
442 | |||
438 | var_index = ( ( (self.var_disc_n - 1) * self.var_Copys) + (self.var_copy_n - 1) - self.var_burned_discs ) % len(self.var_devices) |
|
443 | var_index = ( ( (self.var_disc_n - 1) * self.var_Copys) + (self.var_copy_n - 1) - self.var_burned_discs ) % len(self.var_devices) | |
439 |
|
444 | # self.txtInfo.append("INDEX: "+str(var_index)) | ||
440 | if var_index == 0 and self.blank_discs == False: |
|
445 | if var_index == 0 and self.blank_discs == False: | |
441 | functions2.eject_devices(self) # Expulsa las bandejas de los dispostivos de grabacion |
|
446 | functions2.eject_devices(self) # Expulsa las bandejas de los dispostivos de grabacion | |
442 | self.blank_discs = True |
|
447 | self.blank_discs = True | |
443 | self.btnStartburn.setText("Continue") |
|
448 | self.btnStartburn.setText("Continue") | |
444 | self.btnStartburn.setEnabled(True) |
|
449 | self.btnStartburn.setEnabled(True) | |
445 | return |
|
450 | return | |
446 |
|
451 | |||
447 | self.blank_discs = False |
|
452 | self.blank_discs = False | |
448 |
|
453 | |||
449 |
self.txtInfo.append(" |
|
454 | self.txtInfo.append("recording disc:"+str(self.var_copy_n)+", copy:"+str(self.var_copy_n)) | |
|
455 | functions2.update_message(1, self) | |||
450 |
|
456 | |||
451 | var_dev_tmp = self.var_devices[var_index] |
|
457 | var_dev_tmp = self.var_devices[var_index] | |
452 | file_iso=var_Rpath_iso+"/"+functions.i2s(self.var_disc_n)+".iso" |
|
458 | file_iso=var_Rpath_iso+"/"+functions.i2s(self.var_disc_n)+".iso" | |
453 | var_cmd = "wodim -v dev="+var_dev_tmp+" speed=16 "+ file_iso |
|
459 | var_cmd = "wodim -v dev="+var_dev_tmp+" speed=16 "+ file_iso | |
454 |
|
460 | |||
455 | self.var_process.start('echo "comando"') |
|
461 | self.var_process.start('echo "comando"') | |
456 | # self.txtInfo.append("CMD: "+var_cmd) |
|
462 | # self.txtInfo.append("CMD: "+var_cmd) | |
457 |
|
463 | |||
458 | # self.txtInfo.append("creando iso") |
|
464 | # self.txtInfo.append("creando iso") | |
459 | # self.var_process.start(var_cmd) |
|
465 | # self.var_process.start(var_cmd) | |
460 |
|
466 | |||
461 |
|
467 | |||
462 | #----------------------------------------------------- Detener proceso de grabacion --------------------------------------------------------------- |
|
468 | #----------------------------------------------------- Detener proceso de grabacion --------------------------------------------------------------- | |
463 |
|
469 | |||
464 | @pyqtSignature("") |
|
470 | @pyqtSignature("") | |
465 | def on_btnStopburn_clicked(self): |
|
471 | def on_btnStopburn_clicked(self): | |
466 | """ |
|
472 | """ | |
467 | Slot documentation goes here. |
|
473 | Slot documentation goes here. | |
468 | """ |
|
474 | """ | |
469 | self.bool_state_burning = False |
|
475 | self.bool_state_burning = False | |
470 | self.var_process.terminate() #Termina el proceso, si puede |
|
476 | self.var_process.terminate() #Termina el proceso, si puede | |
471 | # self.var_process.kill() #Mata el proceso, no es la forma adecuada, solo usar si terminate() no funciona |
|
477 | # self.var_process.kill() #Mata el proceso, no es la forma adecuada, solo usar si terminate() no funciona | |
472 | self.txtInfo.append("Stopped recording") |
|
478 | self.txtInfo.append("Stopped recording") | |
473 | functions2.enabled_items2(False, self) |
|
479 | functions2.enabled_items2(False, self) | |
474 |
|
480 | |||
475 |
|
481 | |||
476 | #----------------------------------------------------- Testeo de las unidades de grabacion --------------------------------------------------------------- |
|
482 | #----------------------------------------------------- Testeo de las unidades de grabacion --------------------------------------------------------------- | |
477 |
|
483 | |||
478 | @pyqtSignature("") |
|
484 | @pyqtSignature("") | |
479 | def on_btnTdevA_clicked(self): |
|
485 | def on_btnTdevA_clicked(self): | |
480 | var_dev = str(self.txtDeviceA.text()) |
|
486 | var_dev = str(self.txtDeviceA.text()) | |
481 | var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev |
|
487 | var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev | |
482 | commands.getstatusoutput(var_cmd) |
|
488 | commands.getstatusoutput(var_cmd) | |
483 |
|
489 | |||
484 | @pyqtSignature("") |
|
490 | @pyqtSignature("") | |
485 | def on_btnTdevB_clicked(self): |
|
491 | def on_btnTdevB_clicked(self): | |
486 | var_dev = str(self.txtDeviceB.text()) |
|
492 | var_dev = str(self.txtDeviceB.text()) | |
487 | var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev |
|
493 | var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev | |
488 | commands.getstatusoutput(var_cmd) |
|
494 | commands.getstatusoutput(var_cmd) | |
489 |
|
495 | |||
490 | @pyqtSignature("") |
|
496 | @pyqtSignature("") | |
491 | def on_btnTdevC_clicked(self): |
|
497 | def on_btnTdevC_clicked(self): | |
492 | var_dev = str(self.txtDeviceC.text()) |
|
498 | var_dev = str(self.txtDeviceC.text()) | |
493 | var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev |
|
499 | var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev | |
494 | commands.getstatusoutput(var_cmd) |
|
500 | commands.getstatusoutput(var_cmd) | |
495 |
|
501 | |||
496 | @pyqtSignature("") |
|
502 | @pyqtSignature("") | |
497 | def on_btnTdevD_clicked(self): |
|
503 | def on_btnTdevD_clicked(self): | |
498 | var_dev = str(self.txtDeviceD.text()) |
|
504 | var_dev = str(self.txtDeviceD.text()) | |
499 | var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev |
|
505 | var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev | |
500 | commands.getstatusoutput(var_cmd) |
|
506 | commands.getstatusoutput(var_cmd) | |
501 |
|
507 | |||
502 | @pyqtSignature("") |
|
508 | @pyqtSignature("") | |
503 | def on_btnTDpath_clicked(self): |
|
509 | def on_btnTDpath_clicked(self): | |
504 | """ |
|
510 | """ | |
505 | Slot documentation goes here. |
|
511 | Slot documentation goes here. | |
506 | """ |
|
512 | """ | |
507 | self.var_TDpath= str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) |
|
513 | self.var_TDpath= str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) | |
508 | self.txtTDpath.setText(self.var_TDpath) |
|
514 | self.txtTDpath.setText(self.var_TDpath) | |
509 | self.statusTDpath = functions.dir_exists(self.var_TDpath, self) |
|
515 | self.statusTDpath = functions.dir_exists(self.var_TDpath, self) | |
510 |
|
516 | |||
511 |
|
517 | |||
512 | @pyqtSignature("") |
|
518 | @pyqtSignature("") | |
513 | def on_btnCHstart_clicked(self): |
|
519 | def on_btnCHstart_clicked(self): | |
514 | """ |
|
520 | """ | |
515 | Slot documentation goes here. |
|
521 | Slot documentation goes here. | |
516 | """ |
|
522 | """ | |
517 | pass |
|
523 | pass |
General Comments 0
You need to be logged in to leave comments.
Login now