@@ -11,22 +11,26 | |||||
11 | from subprocess import * |
|
11 | from subprocess import * | |
12 | import sys |
|
12 | import sys | |
13 | import os |
|
13 | import os | |
14 |
|
|
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 | def __init__(self, parent = None): |
|
22 | def __init__(self, parent = None): | |
22 | QMainWindow.__init__(self, parent) |
|
23 | QMainWindow.__init__(self, parent) | |
23 | self.setupUi(self) |
|
24 | self.setupUi(self) | |
24 | self.setupUi2() |
|
25 | self.setupUi2() | |
|
26 | #sys.stdout = obj | |||
|
27 | ||||
25 |
|
28 | |||
26 | def setupUi2(self): |
|
29 | def setupUi2(self): | |
27 | print 'hi' |
|
|||
28 | self.txtDpath.setText('/home/ricardoar/optional/STORAGE/EW_DRIFTS') |
|
30 | self.txtDpath.setText('/home/ricardoar/optional/STORAGE/EW_DRIFTS') | |
29 | self.txtRpath.setText('/home/ricardoar/optional/STORAGE/prueba1_jro_backup_manager') |
|
31 | self.txtRpath.setText('/home/ricardoar/optional/STORAGE/prueba1_jro_backup_manager') | |
|
32 | self.txtElabel.setText('EW_DRIFTS') | |||
|
33 | ||||
30 |
|
34 | |||
31 | @pyqtSignature("") |
|
35 | @pyqtSignature("") | |
32 | def on_btnDpath_clicked(self): |
|
36 | def on_btnDpath_clicked(self): | |
@@ -37,6 +41,7 | |||||
37 | self.txtDpath.setText(var_Dpath) |
|
41 | self.txtDpath.setText(var_Dpath) | |
38 | self.on_txtDpath_editingFinished() |
|
42 | self.on_txtDpath_editingFinished() | |
39 |
|
43 | |||
|
44 | ||||
40 | @pyqtSignature("") |
|
45 | @pyqtSignature("") | |
41 | def on_btnRpath_clicked(self): |
|
46 | def on_btnRpath_clicked(self): | |
42 | """ |
|
47 | """ | |
@@ -50,7 +55,7 | |||||
50 | @pyqtSignature("") |
|
55 | @pyqtSignature("") | |
51 | def on_txtDpath_editingFinished(self): |
|
56 | def on_txtDpath_editingFinished(self): | |
52 |
|
57 | |||
53 | #Usando el modulo "subprocess" eric4 pide seleccion del tipo de subproceso (padre o hijo) |
|
58 | #Usando el modulo "subprocess", eric4 pide seleccion del tipo de subproceso (padre o hijo) | |
54 | #por ello se prefiere usar el modulo "commands" |
|
59 | #por ello se prefiere usar el modulo "commands" | |
55 | #p1= Popen(['find', var_Dpath, '-name', '*.r'], stdout=PIPE) |
|
60 | #p1= Popen(['find', var_Dpath, '-name', '*.r'], stdout=PIPE) | |
56 | #p2= Popen(['awk', '-F/', '{print substr($NF,2,7)}'], stdin=p1.stdout, stdout=PIPE) |
|
61 | #p2= Popen(['awk', '-F/', '{print substr($NF,2,7)}'], stdin=p1.stdout, stdout=PIPE) | |
@@ -72,7 +77,7 | |||||
72 | output_p2=commands.getstatusoutput(var_cmd)[1] |
|
77 | output_p2=commands.getstatusoutput(var_cmd)[1] | |
73 |
|
78 | |||
74 | #INFO: Muestra los dias que se encontraron |
|
79 | #INFO: Muestra los dias que se encontraron | |
75 |
self.txtInfo. |
|
80 | self.txtInfo.append(output_p2) | |
76 |
|
81 | |||
77 | #Se cargan las listas para seleccionar StartDay y StopDay |
|
82 | #Se cargan las listas para seleccionar StartDay y StopDay | |
78 | self.var_list=[] |
|
83 | self.var_list=[] | |
@@ -89,7 +94,7 | |||||
89 | self.lstStopDay.setCurrentIndex(self.lstStartDay.count()-1) |
|
94 | self.lstStopDay.setCurrentIndex(self.lstStartDay.count()-1) | |
90 |
|
95 | |||
91 | #INFO: Muestra cuantos dias se encontraron |
|
96 | #INFO: Muestra cuantos dias se encontraron | |
92 |
|
|
97 | #self.txtInfo.setText(str(self.lstStartDay.count())) | |
93 |
|
98 | |||
94 |
|
99 | |||
95 | @pyqtSignature("") |
|
100 | @pyqtSignature("") | |
@@ -98,14 +103,15 | |||||
98 | Slot documentation goes here. |
|
103 | Slot documentation goes here. | |
99 | """ |
|
104 | """ | |
100 | var_Rpath=self.txtRpath.text() |
|
105 | var_Rpath=self.txtRpath.text() | |
|
106 | ||||
101 | #Se verifica que la ruta exista y sea un directorio |
|
107 | #Se verifica que la ruta exista y sea un directorio | |
102 | var_cmd="test -d "+str(var_Rpath) |
|
108 | var_cmd="test -d "+str(var_Rpath) | |
103 | var_output=commands.getstatusoutput(var_cmd)[0] |
|
109 | var_output=commands.getstatusoutput(var_cmd)[0] | |
104 | if var_output != 0: |
|
110 | if var_output != 0: | |
105 |
self.txtInfo. |
|
111 | self.txtInfo.append("Ruta no valida, output_error:" + str(var_output)) | |
106 | return |
|
112 | return | |
107 | else: |
|
113 | else: | |
108 |
self.txtInfo. |
|
114 | self.txtInfo.append("Ruta valida, sin error") | |
109 |
|
115 | |||
110 |
|
116 | |||
111 | @pyqtSignature("int") |
|
117 | @pyqtSignature("int") | |
@@ -128,6 +134,7 | |||||
128 | self.txtDtype.setText('') |
|
134 | self.txtDtype.setText('') | |
129 | self.txtDtype.setReadOnly(False) |
|
135 | self.txtDtype.setReadOnly(False) | |
130 |
|
136 | |||
|
137 | ||||
131 | @pyqtSignature("") |
|
138 | @pyqtSignature("") | |
132 | def on_txtDtype_editingFinished(self): |
|
139 | def on_txtDtype_editingFinished(self): | |
133 | """ |
|
140 | """ | |
@@ -135,44 +142,37 | |||||
135 | """ |
|
142 | """ | |
136 | self.on_txtDpath_editingFinished() |
|
143 | self.on_txtDpath_editingFinished() | |
137 |
|
144 | |||
138 | @pyqtSignature("int") |
|
145 | ||
|
146 | @pyqtSignature("int") #CLOSED | |||
139 | def on_lstStartDay_activated(self, index): |
|
147 | def on_lstStartDay_activated(self, index): | |
140 | """ |
|
148 | """ | |
141 | Slot documentation goes here. |
|
149 | Cambia la lista de opciones en lstStopDay | |
142 | """ |
|
150 | """ | |
143 | #self.txtInfo.setText(str(index)) |
|
|||
144 | var_StopDay_index=self.lstStopDay.count() - self.lstStopDay.currentIndex() |
|
151 | var_StopDay_index=self.lstStopDay.count() - self.lstStopDay.currentIndex() | |
145 |
|
||||
146 | self.lstStopDay.clear() |
|
152 | self.lstStopDay.clear() | |
147 |
|
153 | |||
148 | for i in self.var_list[index:]: |
|
154 | for i in self.var_list[index:]: | |
149 | self.lstStopDay.addItem(i) |
|
155 | self.lstStopDay.addItem(i) | |
150 |
|
156 | |||
151 | self.lstStopDay.setCurrentIndex(self.lstStopDay.count() - var_StopDay_index) |
|
157 | self.lstStopDay.setCurrentIndex(self.lstStopDay.count() - var_StopDay_index) | |
152 | #self.txtInfo.append(str(var_StopDay_index)) |
|
158 | ||
153 | #self.txtInfo.append(str(self.lstStopDay.count())) |
|
159 | ||
154 |
|
160 | @pyqtSignature("int") #CLOSED | ||
155 |
|
161 | def on_lstStopDay_activated(self, index): | ||
156 | @pyqtSignature("int") |
|
162 | """ | |
157 | def on_lstStopDay_activated(self, index): |
|
163 | Cambia la lista de opciones en lstStartDay | |
158 |
|
|
164 | """ | |
159 | Slot documentation goes here. |
|
|||
160 | """ |
|
|||
161 | #self.txtInfo.setText(str(index)) |
|
|||
162 | var_StartDay_index=self.lstStartDay.currentIndex() |
|
165 | var_StartDay_index=self.lstStartDay.currentIndex() | |
163 |
|
||||
164 | var_end_index = self.lstStopDay.count() - index |
|
166 | var_end_index = self.lstStopDay.count() - index | |
165 |
|
||||
166 | self.lstStartDay.clear() |
|
167 | self.lstStartDay.clear() | |
167 |
|
168 | |||
168 | for i in self.var_list[:len(self.var_list) - var_end_index + 1]: |
|
169 | for i in self.var_list[:len(self.var_list) - var_end_index + 1]: | |
169 | self.lstStartDay.addItem(i) |
|
170 | self.lstStartDay.addItem(i) | |
170 |
|
171 | |||
171 | self.lstStartDay.setCurrentIndex(var_StartDay_index) |
|
172 | self.lstStartDay.setCurrentIndex(var_StartDay_index) | |
172 | #self.txtInfo.append(str(var_StartDay_index)) |
|
173 | ||
173 | #self.txtInfo.append(str(self.lstStartDay.count())) |
|
174 | ||
174 |
|
175 | @pyqtSignature("int") #CLOSED | ||
175 | @pyqtSignature("int") |
|
|||
176 | def on_lstDcapacity_activated(self, index): |
|
176 | def on_lstDcapacity_activated(self, index): | |
177 | """ |
|
177 | """ | |
178 | Permite elegir el tamaño del disco |
|
178 | Permite elegir el tamaño del disco | |
@@ -192,6 +192,7 | |||||
192 | else: |
|
192 | else: | |
193 | self.txtDcapacity.setText('') |
|
193 | self.txtDcapacity.setText('') | |
194 | self.txtDcapacity.setReadOnly(False) |
|
194 | self.txtDcapacity.setReadOnly(False) | |
|
195 | ||||
195 |
|
196 | |||
196 | @pyqtSignature("") |
|
197 | @pyqtSignature("") | |
197 | def on_btnGbkp_clicked(self): |
|
198 | def on_btnGbkp_clicked(self): | |
@@ -242,7 +243,8 | |||||
242 | #lista de archivos a grabar en archivos . |
|
243 | #lista de archivos a grabar en archivos . | |
243 |
|
244 | |||
244 | #Ruta de los archivos a grabar |
|
245 | #Ruta de los archivos a grabar | |
245 |
|
|
246 | var_Rpath=self.txtRpath.text() | |
|
247 | var_Rpath_ppath=var_Rpath+"/ppath" | |||
246 | var_Dpath=self.txtDpath.text() |
|
248 | var_Dpath=self.txtDpath.text() | |
247 |
|
249 | |||
248 | var_n=0 |
|
250 | var_n=0 | |
@@ -287,3 +289,42 | |||||
287 |
|
289 | |||
288 | var_n_files += len(var_files_list_2) |
|
290 | var_n_files += len(var_files_list_2) | |
289 | self.txtInfo.append(str(var_n_files)) |
|
291 | self.txtInfo.append(str(var_n_files)) | |
|
292 | self.tabParameters.setEnabled(False) | |||
|
293 | ||||
|
294 | ||||
|
295 | @pyqtSignature("") | |||
|
296 | def on_btnStartburn_clicked(self): | |||
|
297 | """ | |||
|
298 | Slot documentation goes here. | |||
|
299 | """ | |||
|
300 | var_Rpath=self.txtRpath.text() | |||
|
301 | var_Rpath_ppath=var_Rpath+"/ppath" | |||
|
302 | var_Rpath_iso=var_Rpath+"/iso" | |||
|
303 | ||||
|
304 | var_label=self.txtElabel.text() | |||
|
305 | ||||
|
306 | file_iso=var_Rpath_iso+'/2.iso' | |||
|
307 | file_dat=var_Rpath_ppath+'/EW_DRIFTS_1.dat' | |||
|
308 | ||||
|
309 | var_cmd = 'genisoimage -hide-joliet-trans-tbl -joliet-long -r ' | |||
|
310 | var_cmd += ' -A '+var_label+' -V '+var_label | |||
|
311 | var_cmd += ' -graft-points -path-list '+ file_dat+' -o '+file_iso | |||
|
312 | self.txtInfo.append(var_cmd) | |||
|
313 | ||||
|
314 | #var_output=commands.getstatusoutput(str(var_cmd))[1] | |||
|
315 | #self.txtInfo.append(var_output) | |||
|
316 | ||||
|
317 | #os.system(str(var_cmd)) | |||
|
318 | p = subprocess.Popen(str(var_cmd), shell=True) | |||
|
319 | #os.waitpid(p.pid, 0) | |||
|
320 | self.txtInfo.append(str(p.pid)) | |||
|
321 | ||||
|
322 | #timer.time = 10 | |||
|
323 | #timer.init() | |||
|
324 | ||||
|
325 | @pyqtSignature("") | |||
|
326 | def on_btnRestart_clicked(self): | |||
|
327 | """ | |||
|
328 | Slot documentation goes here. | |||
|
329 | """ | |||
|
330 | self.tabParameters.setEnabled(True) |
@@ -2,7 +2,7 | |||||
2 |
|
2 | |||
3 | # Form implementation generated from reading ui file '/home/ricardoar/principal/JRO_SVN/eric4/jro_backup_manager/ui/MainWindow.ui' |
|
3 | # Form implementation generated from reading ui file '/home/ricardoar/principal/JRO_SVN/eric4/jro_backup_manager/ui/MainWindow.ui' | |
4 | # |
|
4 | # | |
5 |
# Created: Tue Apr 27 1 |
|
5 | # Created: Tue Apr 27 17:26:12 2010 | |
6 | # by: PyQt4 UI code generator 4.7.2 |
|
6 | # by: PyQt4 UI code generator 4.7.2 | |
7 | # |
|
7 | # | |
8 | # WARNING! All changes made in this file will be lost! |
|
8 | # WARNING! All changes made in this file will be lost! |
General Comments 0
You need to be logged in to leave comments.
Login now