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