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