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