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