@@ -11,22 +11,26 | |||
|
11 | 11 | from subprocess import * |
|
12 | 12 | import sys |
|
13 | 13 | import os |
|
14 |
|
|
|
14 | import subprocess | |
|
15 | 15 | import commands |
|
16 | 16 | |
|
17 | 17 | class MainWindow(QMainWindow, Ui_MainWindow): |
|
18 | 18 | """ |
|
19 | 19 | Class documentation goes here. |
|
20 | 20 | """ |
|
21 | ||
|
21 | 22 | def __init__(self, parent = None): |
|
22 | 23 | QMainWindow.__init__(self, parent) |
|
23 | 24 | self.setupUi(self) |
|
24 | 25 | self.setupUi2() |
|
26 | #sys.stdout = obj | |
|
27 | ||
|
25 | 28 | |
|
26 | 29 | def setupUi2(self): |
|
27 | print 'hi' | |
|
28 | 30 | self.txtDpath.setText('/home/ricardoar/optional/STORAGE/EW_DRIFTS') |
|
29 | 31 | self.txtRpath.setText('/home/ricardoar/optional/STORAGE/prueba1_jro_backup_manager') |
|
32 | self.txtElabel.setText('EW_DRIFTS') | |
|
33 | ||
|
30 | 34 | |
|
31 | 35 | @pyqtSignature("") |
|
32 | 36 | def on_btnDpath_clicked(self): |
@@ -37,6 +41,7 | |||
|
37 | 41 | self.txtDpath.setText(var_Dpath) |
|
38 | 42 | self.on_txtDpath_editingFinished() |
|
39 | 43 | |
|
44 | ||
|
40 | 45 | @pyqtSignature("") |
|
41 | 46 | def on_btnRpath_clicked(self): |
|
42 | 47 | """ |
@@ -50,7 +55,7 | |||
|
50 | 55 | @pyqtSignature("") |
|
51 | 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 | 59 | #por ello se prefiere usar el modulo "commands" |
|
55 | 60 | #p1= Popen(['find', var_Dpath, '-name', '*.r'], stdout=PIPE) |
|
56 | 61 | #p2= Popen(['awk', '-F/', '{print substr($NF,2,7)}'], stdin=p1.stdout, stdout=PIPE) |
@@ -72,7 +77,7 | |||
|
72 | 77 | output_p2=commands.getstatusoutput(var_cmd)[1] |
|
73 | 78 | |
|
74 | 79 | #INFO: Muestra los dias que se encontraron |
|
75 |
self.txtInfo. |
|
|
80 | self.txtInfo.append(output_p2) | |
|
76 | 81 | |
|
77 | 82 | #Se cargan las listas para seleccionar StartDay y StopDay |
|
78 | 83 | self.var_list=[] |
@@ -89,7 +94,7 | |||
|
89 | 94 | self.lstStopDay.setCurrentIndex(self.lstStartDay.count()-1) |
|
90 | 95 | |
|
91 | 96 | #INFO: Muestra cuantos dias se encontraron |
|
92 |
|
|
|
97 | #self.txtInfo.setText(str(self.lstStartDay.count())) | |
|
93 | 98 | |
|
94 | 99 | |
|
95 | 100 | @pyqtSignature("") |
@@ -98,14 +103,15 | |||
|
98 | 103 | Slot documentation goes here. |
|
99 | 104 | """ |
|
100 | 105 | var_Rpath=self.txtRpath.text() |
|
106 | ||
|
101 | 107 | #Se verifica que la ruta exista y sea un directorio |
|
102 | 108 | var_cmd="test -d "+str(var_Rpath) |
|
103 | 109 | var_output=commands.getstatusoutput(var_cmd)[0] |
|
104 | 110 | if var_output != 0: |
|
105 |
self.txtInfo. |
|
|
111 | self.txtInfo.append("Ruta no valida, output_error:" + str(var_output)) | |
|
106 | 112 | return |
|
107 | 113 | else: |
|
108 |
self.txtInfo. |
|
|
114 | self.txtInfo.append("Ruta valida, sin error") | |
|
109 | 115 | |
|
110 | 116 | |
|
111 | 117 | @pyqtSignature("int") |
@@ -128,6 +134,7 | |||
|
128 | 134 | self.txtDtype.setText('') |
|
129 | 135 | self.txtDtype.setReadOnly(False) |
|
130 | 136 | |
|
137 | ||
|
131 | 138 | @pyqtSignature("") |
|
132 | 139 | def on_txtDtype_editingFinished(self): |
|
133 | 140 | """ |
@@ -135,44 +142,37 | |||
|
135 | 142 | """ |
|
136 | 143 | self.on_txtDpath_editingFinished() |
|
137 | 144 | |
|
138 | @pyqtSignature("int") | |
|
145 | ||
|
146 | @pyqtSignature("int") #CLOSED | |
|
139 | 147 | def on_lstStartDay_activated(self, index): |
|
140 | 148 | """ |
|
141 | Slot documentation goes here. | |
|
142 | """ | |
|
143 | #self.txtInfo.setText(str(index)) | |
|
149 | Cambia la lista de opciones en lstStopDay | |
|
150 | """ | |
|
144 | 151 | var_StopDay_index=self.lstStopDay.count() - self.lstStopDay.currentIndex() |
|
145 | ||
|
146 | 152 | self.lstStopDay.clear() |
|
147 | 153 | |
|
148 | 154 | for i in self.var_list[index:]: |
|
149 | 155 | self.lstStopDay.addItem(i) |
|
150 | 156 | |
|
151 | 157 | self.lstStopDay.setCurrentIndex(self.lstStopDay.count() - var_StopDay_index) |
|
152 | #self.txtInfo.append(str(var_StopDay_index)) | |
|
153 | #self.txtInfo.append(str(self.lstStopDay.count())) | |
|
154 | ||
|
155 | ||
|
156 | @pyqtSignature("int") | |
|
157 | def on_lstStopDay_activated(self, index): | |
|
158 |
|
|
|
159 | Slot documentation goes here. | |
|
160 | """ | |
|
161 | #self.txtInfo.setText(str(index)) | |
|
158 | ||
|
159 | ||
|
160 | @pyqtSignature("int") #CLOSED | |
|
161 | def on_lstStopDay_activated(self, index): | |
|
162 | """ | |
|
163 | Cambia la lista de opciones en lstStartDay | |
|
164 | """ | |
|
162 | 165 | var_StartDay_index=self.lstStartDay.currentIndex() |
|
163 | ||
|
164 | 166 | var_end_index = self.lstStopDay.count() - index |
|
165 | ||
|
166 | 167 | self.lstStartDay.clear() |
|
167 | 168 | |
|
168 | 169 | for i in self.var_list[:len(self.var_list) - var_end_index + 1]: |
|
169 | 170 | self.lstStartDay.addItem(i) |
|
170 | 171 | |
|
171 | 172 | self.lstStartDay.setCurrentIndex(var_StartDay_index) |
|
172 | #self.txtInfo.append(str(var_StartDay_index)) | |
|
173 | #self.txtInfo.append(str(self.lstStartDay.count())) | |
|
174 | ||
|
175 | @pyqtSignature("int") | |
|
173 | ||
|
174 | ||
|
175 | @pyqtSignature("int") #CLOSED | |
|
176 | 176 | def on_lstDcapacity_activated(self, index): |
|
177 | 177 | """ |
|
178 | 178 | Permite elegir el tamaño del disco |
@@ -192,6 +192,7 | |||
|
192 | 192 | else: |
|
193 | 193 | self.txtDcapacity.setText('') |
|
194 | 194 | self.txtDcapacity.setReadOnly(False) |
|
195 | ||
|
195 | 196 | |
|
196 | 197 | @pyqtSignature("") |
|
197 | 198 | def on_btnGbkp_clicked(self): |
@@ -242,7 +243,8 | |||
|
242 | 243 | #lista de archivos a grabar en archivos . |
|
243 | 244 | |
|
244 | 245 | #Ruta de los archivos a grabar |
|
245 |
|
|
|
246 | var_Rpath=self.txtRpath.text() | |
|
247 | var_Rpath_ppath=var_Rpath+"/ppath" | |
|
246 | 248 | var_Dpath=self.txtDpath.text() |
|
247 | 249 | |
|
248 | 250 | var_n=0 |
@@ -287,3 +289,42 | |||
|
287 | 289 | |
|
288 | 290 | var_n_files += len(var_files_list_2) |
|
289 | 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 | 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 | 6 | # by: PyQt4 UI code generator 4.7.2 |
|
7 | 7 | # |
|
8 | 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