@@ -1,410 +1,472 | |||
|
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 Ui_MainWindow import Ui_MainWindow No newline at end of file |
|
10 | 10 | from PyQt4 import QtGui No newline at end of file |
|
11 | 11 | from subprocess import * No newline at end of file |
|
12 | 12 | import sys No newline at end of file |
|
13 | 13 | import os No newline at end of file |
|
14 | 14 | import subprocess No newline at end of file |
|
15 | 15 | import commands No newline at end of file |
|
16 | 16 | No newline at end of file |
|
17 | 17 | class MainWindow(QMainWindow, Ui_MainWindow): No newline at end of file |
|
18 | 18 | """ No newline at end of file |
|
19 | 19 | Class documentation goes here. No newline at end of file |
|
20 | 20 | """ No newline at end of file |
|
21 | 21 | No newline at end of file |
|
22 | 22 | def __init__(self, parent = None): No newline at end of file |
|
23 | 23 | QMainWindow.__init__(self, parent) No newline at end of file |
|
24 | 24 | self.setupUi(self) No newline at end of file |
|
25 | 25 | self.setupUi2() No newline at end of file |
|
26 | 26 | No newline at end of file |
|
27 | 27 | #redirige salida estandar No newline at end of file |
|
28 | 28 | sys.stdout = self No newline at end of file |
|
29 | 29 | No newline at end of file |
|
30 | 30 | No newline at end of file |
|
31 | 31 | def setupUi2(self): No newline at end of file |
|
32 | 32 | """ No newline at end of file |
|
33 | 33 | Se usa para inicializar ciertos parametros para pruebas No newline at end of file |
|
34 | 34 | """ |
|
35 | No newline at end of file | |
|
35 | self.txtDpath.setText('/home/ricardoar/optional/STORAGE/EW_DRIFTS') | |
|
No newline at end of file | ||
|
36 | No newline at end of file | |
|
36 | self.txtRpath.setText('/home/ricardoar/optional/STORAGE/prueba2_jro_backup_manager') | |
|
No newline at end of file | ||
|
37 | No newline at end of file | |
|
37 | self.txtElabel.setText('EW_DRIFTS') | |
|
No newline at end of file | ||
|
38 | No newline at end of file | |
|
38 | self.statusDpath = False | |
|
No newline at end of file | ||
|
39 | No newline at end of file | |
|
39 | self.statusRpath = False No newline at end of file | |
|
No newline at end of file | ||
|
40 | # self.statusDpath = False | |
|
No newline at end of file | ||
|
41 | # self.statusRpath = False | |
|
No newline at end of file | ||
|
42 | No newline at end of file | |
|
40 | 43 | No newline at end of file |
|
41 | 44 | # No newline at end of file |
|
42 | 45 | #Deteccion de los dispositvos de grabacion No newline at end of file |
|
43 | 46 | # No newline at end of file |
|
44 | 47 | #var_cmd="wodim --devices | grep /dev/ | awk -F\' '{print $2}'" #Funciona en consola pero no en python ΒΏ? No newline at end of file |
|
45 | 48 | var_cmd="wodim --devices | grep /dev/ | awk '{print $2}' | awk -F= '{print $2}'" No newline at end of file |
|
46 | 49 | var_output = commands.getstatusoutput(var_cmd) No newline at end of file |
|
47 | 50 | if var_output[0] != 0: No newline at end of file |
|
48 | 51 | self.txtInfo.setText("No se pudo encontrar los dispositivos de grabacion, output_error:" + str(var_output)) No newline at end of file |
|
49 | 52 | else: No newline at end of file |
|
50 | 53 | self.txtInfo.append("dispositivos encontrados") No newline at end of file |
|
51 | 54 | var_devices = var_output[1].split('\n') No newline at end of file |
|
52 | 55 | No newline at end of file |
|
53 | 56 | var_tmp=[] No newline at end of file |
|
54 | 57 | for i in range(0, 4): No newline at end of file |
|
55 | 58 | if i < len(var_devices): No newline at end of file |
|
56 | 59 | var_len = len(var_devices[i]) No newline at end of file |
|
57 | 60 | var_tmp.append(var_devices[i][1:var_len - 1]) No newline at end of file |
|
58 | 61 | else: No newline at end of file |
|
59 | 62 | var_tmp.append('') No newline at end of file |
|
60 | 63 | No newline at end of file |
|
61 | 64 | #Se escriben los dispostivos correspodientes, si existen No newline at end of file |
|
62 | 65 | self.txtDeviceA.setText(str(var_tmp[0])) No newline at end of file |
|
63 | 66 | self.txtDeviceB.setText(str(var_tmp[1])) No newline at end of file |
|
64 | 67 | self.txtDeviceC.setText(str(var_tmp[2])) No newline at end of file |
|
65 | 68 | self.txtDeviceD.setText(str(var_tmp[3])) No newline at end of file |
|
66 | 69 | #Se desactivan los que no existen No newline at end of file |
|
67 | 70 | if len(var_tmp[0]) == 0 : No newline at end of file |
|
68 | 71 | self.chkDevA.setChecked(False) No newline at end of file |
|
69 | 72 | self.chkDevA.setEnabled(False) No newline at end of file |
|
70 | 73 | if len(var_tmp[1]) == 0 : No newline at end of file |
|
71 | 74 | self.chkDevB.setChecked(False) No newline at end of file |
|
72 | 75 | self.chkDevB.setEnabled(False) No newline at end of file |
|
73 | 76 | if len(var_tmp[2]) == 0 : No newline at end of file |
|
74 | 77 | self.chkDevC.setChecked(False) No newline at end of file |
|
75 | 78 | self.chkDevC.setEnabled(False) No newline at end of file |
|
76 | 79 | if len(var_tmp[3]) == 0 : No newline at end of file |
|
77 | 80 | self.chkDevD.setChecked(False) No newline at end of file |
|
78 | 81 | self.chkDevD.setEnabled(False) No newline at end of file |
|
79 | 82 | No newline at end of file |
|
80 | 83 | No newline at end of file |
|
81 | 84 | def write(self, txt): No newline at end of file |
|
82 | 85 | """ No newline at end of file |
|
83 | 86 | Escribe la salida estandar eb txtInfo No newline at end of file |
|
84 | 87 | """ No newline at end of file |
|
85 | 88 | self.txtInfo.append(str(txt)) No newline at end of file |
|
86 | 89 | No newline at end of file |
|
87 | 90 | No newline at end of file |
|
88 | 91 | @pyqtSignature("") No newline at end of file |
|
89 | 92 | def on_btnDpath_clicked(self): No newline at end of file |
|
90 | 93 | """ No newline at end of file |
|
91 | 94 | Permite seleccionar graficamente el direcorio de los datos a grabar No newline at end of file |
|
92 | 95 | """ No newline at end of file |
|
93 | 96 | var_Dpath= QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly) No newline at end of file |
|
94 | 97 | self.txtDpath.setText(var_Dpath) No newline at end of file |
|
95 | 98 | No newline at end of file |
|
96 | 99 | #llamada a funcion No newline at end of file |
|
97 | 100 | self.on_txtDpath_editingFinished() No newline at end of file |
|
98 | 101 | No newline at end of file |
|
99 | 102 | No newline at end of file |
|
100 | 103 | @pyqtSignature("") No newline at end of file |
|
101 | 104 | def on_btnRpath_clicked(self): No newline at end of file |
|
102 | 105 | """ No newline at end of file |
|
103 | 106 | Permite seleccionar graficamente el direcorio del proyecto No newline at end of file |
|
104 | 107 | """ No newline at end of file |
|
105 | 108 | var_Rpath = QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly) No newline at end of file |
|
106 | 109 | self.txtRpath.setText(var_Rpath) No newline at end of file |
|
107 | 110 | No newline at end of file |
|
108 | 111 | #llamada a funcion No newline at end of file |
|
109 | 112 | self.on_txtRpath_editingFinished() No newline at end of file |
|
110 | 113 | No newline at end of file |
|
111 | 114 | No newline at end of file |
|
112 | 115 | @pyqtSignature("") No newline at end of file |
|
113 | 116 | def on_txtDpath_editingFinished(self): No newline at end of file |
|
114 | 117 | """ No newline at end of file |
|
115 | 118 | Permite buscar los archivos de extension seleccionada en la ruta de de datos No newline at end of file |
|
116 | 119 | y cargar los valores para el rango de tiempo a ser grabado No newline at end of file |
|
117 | 120 | """ No newline at end of file |
|
118 | 121 | No newline at end of file |
|
119 | 122 | #Usando el modulo "subprocess", eric4 pide seleccion del tipo de subproceso (padre o hijo) No newline at end of file |
|
120 | 123 | #por ello se prefiere usar el modulo "commands" No newline at end of file |
|
121 | 124 | #p1= Popen(['find', var_Dpath, '-name', '*.r'], stdout=PIPE) No newline at end of file |
|
122 | 125 | #p2= Popen(['awk', '-F/', '{print substr($NF,2,7)}'], stdin=p1.stdout, stdout=PIPE) No newline at end of file |
|
123 | 126 | #output_p2= p2.communicate()[0] No newline at end of file |
|
124 | 127 | #self.txtInfo.setText(output_p2) No newline at end of file |
|
125 | 128 | No newline at end of file |
|
126 | 129 | #Se carga la variable con la ruta de datos No newline at end of file |
|
127 | 130 | var_Dpath=self.txtDpath.text() No newline at end of file |
|
128 | 131 | No newline at end of file |
|
129 | 132 | #Se verifica que la ruta exista y sea un directorio No newline at end of file |
|
130 | 133 | var_cmd="test -d "+str(var_Dpath) No newline at end of file |
|
131 | 134 | var_output=commands.getstatusoutput(var_cmd)[0] No newline at end of file |
|
132 | 135 | if var_output != 0: No newline at end of file |
|
133 | 136 | self.statusDpath = False No newline at end of file |
|
134 | 137 | self.txtInfo.setText("Ruta no valida, output_error:" + str(var_output)) No newline at end of file |
|
135 | 138 | return No newline at end of file |
|
136 | 139 | else: No newline at end of file |
|
137 | 140 | self.statusDpath = True No newline at end of file |
|
138 | 141 | self.txtInfo.append("Ruta valida, sin error:" + str(var_Dpath)) No newline at end of file |
|
139 | 142 | No newline at end of file |
|
140 | 143 | #Se buscan los archivos del tipo especificado No newline at end of file |
|
141 | 144 | var_Dtype=self.txtDtype.text() No newline at end of file |
|
142 | 145 | var_cmd="find " + str(var_Dpath) + " -name *."+ str(var_Dtype) +" | awk -F/ '{print substr($NF,2,7)}' | sort| uniq" No newline at end of file |
|
143 | 146 | output_p2=commands.getstatusoutput(var_cmd)[1] No newline at end of file |
|
144 | 147 | No newline at end of file |
|
145 | 148 | #Se cargan las listas para seleccionar StartDay y StopDay (QComboBox) No newline at end of file |
|
146 | 149 | self.var_list=[] No newline at end of file |
|
147 | 150 | for i in range(0, (len(output_p2)+1)/8): No newline at end of file |
|
148 | 151 | self.var_list.append(output_p2[8*i:8*(i+1)-1]) No newline at end of file |
|
149 | 152 | No newline at end of file |
|
150 | 153 | self.lstStartDay.clear() No newline at end of file |
|
151 | 154 | self.lstStopDay.clear() No newline at end of file |
|
152 | 155 | No newline at end of file |
|
153 | 156 | for i in self.var_list: No newline at end of file |
|
154 | 157 | self.lstStartDay.addItem(i) No newline at end of file |
|
155 | 158 | self.lstStopDay.addItem(i) No newline at end of file |
|
156 | 159 | No newline at end of file |
|
157 | 160 | self.lstStopDay.setCurrentIndex(self.lstStartDay.count()-1) No newline at end of file |
|
158 | 161 | No newline at end of file |
|
159 | 162 | No newline at end of file |
|
160 | 163 | @pyqtSignature("") No newline at end of file |
|
161 | 164 | def on_txtRpath_editingFinished(self): No newline at end of file |
|
162 | 165 | """ No newline at end of file |
|
163 | 166 | Valida la ruta del proyecto No newline at end of file |
|
164 | 167 | """ No newline at end of file |
|
165 | 168 | #Se carga la variable con la ruta del proyecto No newline at end of file |
|
166 | 169 | var_Rpath=self.txtRpath.text() No newline at end of file |
|
167 | 170 | No newline at end of file |
|
168 | 171 | #Se verifica que la ruta exista y sea un directorio No newline at end of file |
|
169 | 172 | var_cmd="test -d "+str(var_Rpath) No newline at end of file |
|
170 | 173 | var_output=commands.getstatusoutput(var_cmd)[0] No newline at end of file |
|
171 | 174 | if var_output != 0: No newline at end of file |
|
172 | 175 | self.statusRpath = False No newline at end of file |
|
173 | 176 | self.txtInfo.append("Ruta no valida, output_error:" + str(var_output)) No newline at end of file |
|
174 | 177 | return No newline at end of file |
|
175 | 178 | else: No newline at end of file |
|
176 | 179 | self.statusRpath = True No newline at end of file |
|
177 | 180 | self.txtInfo.append("Ruta valida, sin error:" + str(var_Rpath)) No newline at end of file |
|
178 | 181 | No newline at end of file |
|
179 | 182 | No newline at end of file |
|
180 | 183 | @pyqtSignature("int") No newline at end of file |
|
181 | 184 | def on_lstDtype_activated(self, index): No newline at end of file |
|
182 | 185 | """ No newline at end of file |
|
183 | 186 | Permite elegir entre los tipos de archivos No newline at end of file |
|
184 | 187 | """ No newline at end of file |
|
185 | 188 | if index == 0: No newline at end of file |
|
186 | 189 | var_type='r' No newline at end of file |
|
187 | 190 | elif index == 1: No newline at end of file |
|
188 | 191 | var_type='pdata' No newline at end of file |
|
189 | 192 | elif index == 2: No newline at end of file |
|
190 | 193 | var_type='sswma' No newline at end of file |
|
191 | 194 | No newline at end of file |
|
192 | 195 | if index != 3: No newline at end of file |
|
193 | 196 | self.txtDtype.setText(var_type) No newline at end of file |
|
194 | 197 | self.txtDtype.setReadOnly(True) No newline at end of file |
|
195 | 198 | self.on_txtDpath_editingFinished() No newline at end of file |
|
196 | 199 | else: No newline at end of file |
|
197 | 200 | self.txtDtype.setText('') No newline at end of file |
|
198 | 201 | self.txtDtype.setReadOnly(False) No newline at end of file |
|
199 | 202 | No newline at end of file |
|
200 | 203 | No newline at end of file |
|
201 | 204 | @pyqtSignature("") No newline at end of file |
|
202 | 205 | def on_txtDtype_editingFinished(self): No newline at end of file |
|
203 | 206 | """ No newline at end of file |
|
204 | 207 | Se activa cuando el tipo de archivo es ingresado manualmente No newline at end of file |
|
205 | 208 | """ No newline at end of file |
|
206 | 209 | #llamada a funcion No newline at end of file |
|
207 | 210 | self.on_txtDpath_editingFinished() No newline at end of file |
|
208 | 211 | No newline at end of file |
|
209 | 212 | No newline at end of file |
|
210 | 213 | @pyqtSignature("int") #CLOSED No newline at end of file |
|
211 | 214 | def on_lstStartDay_activated(self, index): No newline at end of file |
|
212 | 215 | """ No newline at end of file |
|
213 | 216 | Cambia la lista de opciones en lstStopDay No newline at end of file |
|
214 | 217 | """ No newline at end of file |
|
215 | 218 | var_StopDay_index=self.lstStopDay.count() - self.lstStopDay.currentIndex() No newline at end of file |
|
216 | 219 | self.lstStopDay.clear() No newline at end of file |
|
217 | 220 | No newline at end of file |
|
218 | 221 | for i in self.var_list[index:]: No newline at end of file |
|
219 | 222 | self.lstStopDay.addItem(i) No newline at end of file |
|
220 | 223 | No newline at end of file |
|
221 | 224 | self.lstStopDay.setCurrentIndex(self.lstStopDay.count() - var_StopDay_index) No newline at end of file |
|
222 | 225 | No newline at end of file |
|
223 | 226 | No newline at end of file |
|
224 | 227 | @pyqtSignature("int") #CLOSED No newline at end of file |
|
225 | 228 | def on_lstStopDay_activated(self, index): No newline at end of file |
|
226 | 229 | """ No newline at end of file |
|
227 | 230 | Cambia la lista de opciones en lstStartDay No newline at end of file |
|
228 | 231 | """ No newline at end of file |
|
229 | 232 | var_StartDay_index=self.lstStartDay.currentIndex() No newline at end of file |
|
230 | 233 | var_end_index = self.lstStopDay.count() - index No newline at end of file |
|
231 | 234 | self.lstStartDay.clear() No newline at end of file |
|
232 | 235 | No newline at end of file |
|
233 | 236 | for i in self.var_list[:len(self.var_list) - var_end_index + 1]: No newline at end of file |
|
234 | 237 | self.lstStartDay.addItem(i) No newline at end of file |
|
235 | 238 | No newline at end of file |
|
236 | 239 | self.lstStartDay.setCurrentIndex(var_StartDay_index) No newline at end of file |
|
237 | 240 | No newline at end of file |
|
238 | 241 | No newline at end of file |
|
239 | 242 | @pyqtSignature("int") #CLOSED No newline at end of file |
|
240 | 243 | def on_lstDcapacity_activated(self, index): No newline at end of file |
|
241 | 244 | """ No newline at end of file |
|
242 | 245 | Permite elegir el tamaΓ±o del disco No newline at end of file |
|
243 | 246 | """ No newline at end of file |
|
244 | 247 | if index == 0: No newline at end of file |
|
245 | 248 | var_size=25.0 No newline at end of file |
|
246 | 249 | elif index == 1: No newline at end of file |
|
247 | 250 | var_size=8.5 No newline at end of file |
|
248 | 251 | elif index == 2: No newline at end of file |
|
249 | 252 | var_size=4.7 No newline at end of file |
|
250 | 253 | elif index == 3: No newline at end of file |
|
251 | 254 | var_size=0.7 No newline at end of file |
|
252 | 255 | No newline at end of file |
|
253 | 256 | if index != 4: No newline at end of file |
|
254 | 257 | self.txtDcapacity.setText(str(var_size*10**9/1024**2)) No newline at end of file |
|
255 | 258 | self.txtDcapacity.setReadOnly(True) No newline at end of file |
|
256 | 259 | else: No newline at end of file |
|
257 | 260 | self.txtDcapacity.setText('') No newline at end of file |
|
258 | 261 | self.txtDcapacity.setReadOnly(False) No newline at end of file |
|
259 | 262 | No newline at end of file |
|
260 | 263 | No newline at end of file |
|
261 | 264 | @pyqtSignature("") No newline at end of file |
|
262 | 265 | def on_btnGbkp_clicked(self): No newline at end of file |
|
263 | 266 | """ No newline at end of file |
|
264 | 267 | Cuando se presiona el boton btnGbkp No newline at end of file |
|
265 | 268 | """ No newline at end of file |
|
266 | 269 | No newline at end of file |
|
267 | 270 | #Verifica que las rutas sean validas No newline at end of file |
|
268 | 271 | if self.statusDpath == False or self.statusRpath == False: No newline at end of file |
|
269 | 272 | if self.statusDpath == False: No newline at end of file |
|
270 | 273 | self.txtInfo.append("Ruta de datos no valida") No newline at end of file |
|
271 | 274 | if self.statusRpath == False: No newline at end of file |
|
272 | 275 | self.txtInfo.append("Ruta de proyecto no valida") No newline at end of file |
|
273 | 276 | return No newline at end of file |
|
274 | 277 | No newline at end of file |
|
275 | 278 | #Crea las carpetas en la ruta del proyecto y verifica que se crearon correctamente No newline at end of file |
|
276 | 279 | var_Rpath=self.txtRpath.text() No newline at end of file |
|
277 | 280 | var_dirs='/{gpath,iso,ppath}' No newline at end of file |
|
278 | 281 | var_cmd="mkdir -p "+str(var_Rpath)+str(var_dirs) No newline at end of file |
|
279 | 282 | var_output=commands.getstatusoutput(var_cmd)[0] No newline at end of file |
|
280 | 283 | if var_output != 0: No newline at end of file |
|
281 | 284 | self.txtInfo.append("No se pudieron crear los directorios, output_error:" + str(var_output)) No newline at end of file |
|
282 | 285 | return No newline at end of file |
|
283 | 286 | else: No newline at end of file |
|
284 | 287 | self.txtInfo.append('Carpetas creadas correctamente') No newline at end of file |
|
285 | 288 | No newline at end of file |
|
286 | 289 | #Cargando variables con los parametros No newline at end of file |
|
287 | 290 | var_Dpath=self.txtDpath.text() No newline at end of file |
|
288 | 291 | var_Rpath=self.txtRpath.text() No newline at end of file |
|
289 | 292 | var_Rpath_ppath=var_Rpath+"/ppath" #Ruta de los archivos a grabar No newline at end of file |
|
290 | 293 | var_sublist=[] No newline at end of file |
|
291 | 294 | for i in self.var_list[self.lstStartDay.currentIndex():self.lstStartDay.currentIndex() + self.lstStopDay.currentIndex()+1]: No newline at end of file |
|
292 | 295 | var_sublist.append(i) No newline at end of file |
|
293 | 296 | if len(var_sublist) == 0: No newline at end of file |
|
294 | 297 | self.txtInfo.append("No existen archivos encontrados") No newline at end of file |
|
295 | 298 | return No newline at end of file |
|
296 | 299 | #self.txtInfo.append('elementos: '+str(len(var_sublist))) No newline at end of file |
|
297 | 300 | No newline at end of file |
|
298 | 301 | No newline at end of file |
|
299 | 302 | var_Dtype=self.txtDtype.text() No newline at end of file |
|
300 | 303 | var_Dcapacity=float(self.txtDcapacity.text())*1024 #tamaΓ±o en KB No newline at end of file |
|
301 | 304 | No newline at end of file |
|
302 | 305 | #Busca los archivos con los parametros de busqueda No newline at end of file |
|
303 | 306 | var_files_list=[] No newline at end of file |
|
304 | 307 | for var_doy in var_sublist: No newline at end of file |
|
305 | 308 | var_cmd="find " + str(var_Dpath) + " -name ?"+var_doy+"???."+ str(var_Dtype) + " |sort" No newline at end of file |
|
306 | 309 | var_output=commands.getstatusoutput(var_cmd)[1] No newline at end of file |
|
307 | 310 | for var_file in var_output.split(): No newline at end of file |
|
308 | 311 | var_files_list.append(var_file) #Almacena cada archivo en la lista No newline at end of file |
|
309 | 312 | No newline at end of file |
|
310 | 313 | # No newline at end of file |
|
311 | 314 | #Genera la lista de archivos .dat que contienen los archivos a grabar en cada DVD No newline at end of file |
|
312 | 315 | # |
|
316 | No newline at end of file | |
|
313 | var_n=0 #Se usa para contar el numero de archivos a grabar en el DVD No newline at end of file | |
|
314 | 317 | var_tmp=0 #Se usa para acumulanr el tamaΓ±o de los archivos de la lista No newline at end of file |
|
315 | 318 | var_files_list_2=[] #Se usa para almacenar la lista de archivos agrbar en cada DVD No newline at end of file |
|
316 | 319 | No newline at end of file |
|
317 | 320 | for i in var_files_list: #Se asignan en i los archivos de la lista No newline at end of file |
|
318 | 321 | var_size_i=os.path.getsize(i)/1024+1 #tamaΓ±o en KB del archivo de la lista, se suma 1 KB para evitar problemas al momento de sumar No newline at end of file |
|
319 | 322 | var_tmp += var_size_i #Se acumulan el tamaΓ±o de los archivos de la lista No newline at end of file |
|
320 | 323 | No newline at end of file |
|
321 | 324 | #Si el tamaΓ±o acumulado es mayor que el de el DVD No newline at end of file |
|
322 | 325 | if var_tmp > var_Dcapacity: No newline at end of file |
|
323 | 326 | var_tmp -= var_size_i #se quita el tamaΓ±o sumado para mostrar el tamaΓ±o real No newline at end of file |
|
327 | #se agregan los ceros necesarios | |
|
No newline at end of file | ||
|
328 | if len(str(var_n)) < 4: | |
|
No newline at end of file | ||
|
329 | var_n2="" | |
|
No newline at end of file | ||
|
330 | for k in range(0, 4-len(str(var_n))): | |
|
No newline at end of file | ||
|
331 | var_n2 = var_n2+"0" No newline at end of file | |
|
324 | 332 | #se crea un archivo con numeral en el sufijo y extension .dat |
|
333 | No newline at end of file | |
|
325 | var_file = open(var_Rpath_ppath+"/"+self.txtElabel.text()+"_"+str(var_n)+".dat","w") No newline at end of file | |
|
326 | 334 | #Se aΓ±ade la lista de archivos a grabar en el DVD al archivo .dat No newline at end of file |
|
327 | 335 | for line in var_files_list_2: |
|
336 | No newline at end of file | |
|
328 | var_file.write(line.split(var_Dpath)[1]+'=') No newline at end of file | |
|
No newline at end of file | ||
|
337 | var_tmp_path2="/" | |
|
No newline at end of file | ||
|
338 | for l in range(0, len(var_tmp_path)-1): | |
|
No newline at end of file | ||
|
339 | var_tmp_path2=var_tmp_path2+str(var_tmp_path[l])+"/" | |
|
No newline at end of file | ||
|
340 | var_file.write(var_tmp_path2+'=') No newline at end of file | |
|
329 | 341 | var_file.write(line+'\n') No newline at end of file |
|
330 | 342 | var_file.close() No newline at end of file |
|
331 | 343 | No newline at end of file |
|
332 | 344 | var_tmp = var_size_i #Se asigna a la variable el tamaΓ±o del archivo actual No newline at end of file |
|
333 | 345 | var_files_list_2=[] #Se reinicia la lista No newline at end of file |
|
334 | 346 | var_n += 1 No newline at end of file |
|
335 | 347 | var_files_list_2.append(i) No newline at end of file |
|
336 | 348 | |
|
349 | No newline at end of file | |
|
337 | var_file = open(var_Rpath_ppath+"/"+self.txtElabel.text()+"_"+str(var_n)+".dat","w") No newline at end of file | |
|
No newline at end of file | ||
|
350 | if len(str(var_n)) < 4: | |
|
No newline at end of file | ||
|
351 | var_n2="" | |
|
No newline at end of file | ||
|
352 | for k in range(0, 4-len(str(var_n))): | |
|
No newline at end of file | ||
|
353 | var_n2 = var_n2+"0" | |
|
No newline at end of file | ||
|
354 | #se crea un archivo con numeral en el sufijo y extension .dat | |
|
No newline at end of file | ||
|
355 | var_file = open(var_Rpath_ppath+"/"+self.txtElabel.text()+"_"+str(var_n2)+str(var_n)+".dat","w") | |
|
No newline at end of file | ||
|
356 | #Se aΓ±ade la lista de archivos a grabar en el DVD al archivo .dat No newline at end of file | |
|
338 | 357 | for line in var_files_list_2: |
|
358 | No newline at end of file | |
|
339 | var_file.write(line.split(var_Dpath)[1]+'=') No newline at end of file | |
|
No newline at end of file | ||
|
359 | var_tmp_path2="/" | |
|
No newline at end of file | ||
|
360 | for l in range(0, len(var_tmp_path)-1): | |
|
No newline at end of file | ||
|
361 | var_tmp_path2=var_tmp_path2+str(var_tmp_path[l])+"/" | |
|
No newline at end of file | ||
|
362 | var_file.write(var_tmp_path2+'=') No newline at end of file | |
|
340 | 363 | var_file.write(line+'\n') No newline at end of file |
|
341 | 364 | var_file.close() No newline at end of file |
|
365 | ||
|
No newline at end of file | ||
|
366 | # | |
|
No newline at end of file | ||
|
367 | #Genera los archivos postscript | |
|
No newline at end of file | ||
|
368 | # | |
|
No newline at end of file | ||
|
369 | var_n_files = var_n | |
|
No newline at end of file | ||
|
370 | var_n = 0 | |
|
No newline at end of file | ||
|
371 | for i in range(0, var_n_files+1): | |
|
No newline at end of file | ||
|
372 | print i | |
|
No newline at end of file | ||
|
373 | #se agregan los ceros necesarios | |
|
No newline at end of file | ||
|
374 | if len(str(var_n)) < 4: | |
|
No newline at end of file | ||
|
375 | var_n2="" | |
|
No newline at end of file | ||
|
376 | for k in range(0, 4-len(str(var_n))): | |
|
No newline at end of file | ||
|
377 | var_n2 = var_n2+"0" | |
|
No newline at end of file | ||
|
378 | ||
|
No newline at end of file | ||
|
379 | #se abren los archivos .dat en modo lectura | |
|
No newline at end of file | ||
|
380 | var_file = open(var_Rpath_ppath+"/"+self.txtElabel.text()+"_"+str(var_n2)+str(var_n)+".dat","r") | |
|
No newline at end of file | ||
|
381 | lines=var_file.readlines() | |
|
No newline at end of file | ||
|
382 | print str(len(lines)) | |
|
No newline at end of file | ||
|
383 | #Se crean los archivos .print con los cuales se crearan los archivos .ps | |
|
No newline at end of file | ||
|
384 | ||
|
No newline at end of file | ||
|
385 | var_first_folder = lines[0].split('=')[0] | |
|
No newline at end of file | ||
|
386 | var_first_file = (lines[0].split('=')[1]).split('/')[-1][1:11] | |
|
No newline at end of file | ||
|
387 | ||
|
No newline at end of file | ||
|
388 | for j in range(1, len(lines)-1): | |
|
No newline at end of file | ||
|
389 | var_tmp_folder = lines[j].split('=')[0] | |
|
No newline at end of file | ||
|
390 | var_tmp_file = (lines[j].split('=')[1]).split('/')[-1][1:11] | |
|
No newline at end of file | ||
|
391 | ||
|
No newline at end of file | ||
|
392 | # Si el subfolder superior o la fecha del archivo cambia se genera una nueva linea | |
|
No newline at end of file | ||
|
393 | if (var_tmp_folder != var_first_folder) or (var_tmp_file[0:7] != var_first_file[0:7]): | |
|
No newline at end of file | ||
|
394 | if var_first_folder == '/': | |
|
No newline at end of file | ||
|
395 | var_folder = self.txtElabel.text() | |
|
No newline at end of file | ||
|
396 | else: | |
|
No newline at end of file | ||
|
397 | var_folder = var_first_folder.split('/')[1] | |
|
No newline at end of file | ||
|
398 | ||
|
No newline at end of file | ||
|
399 | print var_first_folder[0:4]+" "+var_first_folder[4:7]+" "+var_folder +" "+\ | |
|
No newline at end of file | ||
|
400 | var_first_folder[7:10]+" "+(lines[j-1].split('=')[1]).split('/')[-1][8:11] | |
|
No newline at end of file | ||
|
401 | ||
|
No newline at end of file | ||
|
402 | var_n += 1 | |
|
No newline at end of file | ||
|
403 | No newline at end of file | |
|
342 | 404 | No newline at end of file |
|
343 | 405 | #Se deshabilita el Tab Parameters y el boton btnGbkp No newline at end of file |
|
344 | 406 | self.tabParameters.setEnabled(False) No newline at end of file |
|
345 | 407 | self.btnGbkp.setEnabled(False) No newline at end of file |
|
346 | 408 | No newline at end of file |
|
347 | 409 | No newline at end of file |
|
348 | 410 | @pyqtSignature("") No newline at end of file |
|
349 | 411 | def on_btnStartburn_clicked(self): No newline at end of file |
|
350 | 412 | """ No newline at end of file |
|
351 | 413 | Slot documentation goes here. No newline at end of file |
|
352 | 414 | """ No newline at end of file |
|
353 | 415 | sys.stdout = self No newline at end of file |
|
354 | 416 | #sys.stderr = self No newline at end of file |
|
355 | 417 | print "stdout_!!!" No newline at end of file |
|
356 | 418 | var_Rpath=self.txtRpath.text() No newline at end of file |
|
357 | 419 | var_Rpath_ppath=var_Rpath+"/ppath" No newline at end of file |
|
358 | 420 | var_Rpath_iso=var_Rpath+"/iso" No newline at end of file |
|
359 | 421 | No newline at end of file |
|
360 | 422 | var_label=self.txtElabel.text() No newline at end of file |
|
361 | 423 | No newline at end of file |
|
362 | 424 | file_iso=var_Rpath_iso+'/2.iso' No newline at end of file |
|
363 | 425 | file_dat=var_Rpath_ppath+'/EW_DRIFTS_1.dat' No newline at end of file |
|
364 | 426 | No newline at end of file |
|
365 | 427 | var_cmd = 'genisoimage -hide-joliet-trans-tbl -joliet-long -r ' No newline at end of file |
|
366 | 428 | var_cmd += ' -A '+var_label+' -V '+var_label No newline at end of file |
|
367 | 429 | var_cmd += ' -graft-points -path-list '+ file_dat+' -o '+file_iso No newline at end of file |
|
368 | 430 | self.txtInfo.append(var_cmd) No newline at end of file |
|
369 | 431 | No newline at end of file |
|
370 | 432 | #var_output=commands.getstatusoutput(str(var_cmd))[1] No newline at end of file |
|
371 | 433 | #self.txtInfo.append(var_output) No newline at end of file |
|
372 | 434 | No newline at end of file |
|
373 | 435 | #os.system(str(var_cmd)) No newline at end of file |
|
374 | 436 | #p = subprocess.Popen(str('ls /'), shell=True, stdout=self) No newline at end of file |
|
375 | 437 | #os.waitpid(p.pid, 0) No newline at end of file |
|
376 | 438 | ####self.txtInfo.append(str(p.pid)) No newline at end of file |
|
377 | 439 | No newline at end of file |
|
378 | 440 | No newline at end of file |
|
379 | 441 | No newline at end of file |
|
380 | 442 | @pyqtSignature("") No newline at end of file |
|
381 | 443 | def on_btnRestart_clicked(self): No newline at end of file |
|
382 | 444 | """ No newline at end of file |
|
383 | 445 | Slot documentation goes here. No newline at end of file |
|
384 | 446 | """ No newline at end of file |
|
385 | 447 | self.tabParameters.setEnabled(True) No newline at end of file |
|
386 | 448 | self.btnGbkp.setEnabled(True) No newline at end of file |
|
387 | 449 | No newline at end of file |
|
388 | 450 | @pyqtSignature("") No newline at end of file |
|
389 | 451 | def on_btnTdevA_clicked(self): No newline at end of file |
|
390 | 452 | var_dev = str(self.txtDeviceA.text()) No newline at end of file |
|
391 | 453 | var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev No newline at end of file |
|
392 | 454 | commands.getstatusoutput(var_cmd) No newline at end of file |
|
393 | 455 | No newline at end of file |
|
394 | 456 | @pyqtSignature("") No newline at end of file |
|
395 | 457 | def on_btnTdevB_clicked(self): No newline at end of file |
|
396 | 458 | var_dev = str(self.txtDeviceB.text()) No newline at end of file |
|
397 | 459 | var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev No newline at end of file |
|
398 | 460 | commands.getstatusoutput(var_cmd) No newline at end of file |
|
399 | 461 | No newline at end of file |
|
400 | 462 | @pyqtSignature("") No newline at end of file |
|
401 | 463 | def on_btnTdevC_clicked(self): No newline at end of file |
|
402 | 464 | var_dev = str(self.txtDeviceC.text()) No newline at end of file |
|
403 | 465 | var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev No newline at end of file |
|
404 | 466 | commands.getstatusoutput(var_cmd) No newline at end of file |
|
405 | 467 | No newline at end of file |
|
406 | 468 | @pyqtSignature("") No newline at end of file |
|
407 | 469 | def on_btnTdevD_clicked(self): No newline at end of file |
|
408 | 470 | var_dev = str(self.txtDeviceD.text()) No newline at end of file |
|
409 | 471 | var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev No newline at end of file |
|
410 | 472 | commands.getstatusoutput(var_cmd) No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now