@@ -1,278 +1,279 | |||||
1 | # -*- coding: utf-8 -*- No newline at end of file |
|
1 | # -*- coding: utf-8 -*- | |
2 | No newline at end of file |
|
2 | ||
3 | """ No newline at end of file |
|
3 | """ | |
4 | Module implementing MainWindow. No newline at end of file |
|
4 | Module implementing MainWindow. | |
5 | """ No newline at end of file |
|
5 | """ | |
6 | No newline at end of file |
|
6 | ||
7 | from PyQt4.QtGui import QMainWindow No newline at end of file |
|
7 | from PyQt4.QtGui import QMainWindow | |
8 | from PyQt4.QtCore import pyqtSignature No newline at end of file |
|
8 | from PyQt4.QtCore import pyqtSignature | |
9 | from Ui_MainWindow import Ui_MainWindow No newline at end of file |
|
9 | from Ui_MainWindow import Ui_MainWindow | |
10 | from PyQt4 import QtGui No newline at end of file |
|
10 | from PyQt4 import QtGui | |
11 | from subprocess import * No newline at end of file |
|
11 | from subprocess import * | |
12 | import sys No newline at end of file |
|
12 | import sys | |
13 | import os No newline at end of file |
|
13 | import os | |
14 | #import subprocess No newline at end of file |
|
14 | #import subprocess | |
15 | import commands No newline at end of file |
|
15 | import commands | |
16 | No newline at end of file |
|
16 | ||
17 | class MainWindow(QMainWindow, Ui_MainWindow): No newline at end of file |
|
17 | class MainWindow(QMainWindow, Ui_MainWindow): | |
18 | """ No newline at end of file |
|
18 | """ | |
19 | Class documentation goes here. No newline at end of file |
|
19 | Class documentation goes here. | |
20 | """ No newline at end of file |
|
20 | """ | |
21 | def __init__(self, parent = None): No newline at end of file |
|
21 | def __init__(self, parent = None): | |
22 | QMainWindow.__init__(self, parent) No newline at end of file |
|
22 | QMainWindow.__init__(self, parent) | |
23 | self.setupUi(self) No newline at end of file |
|
23 | self.setupUi(self) | |
24 | self.setupUi2() No newline at end of file |
|
24 | self.setupUi2() | |
25 | No newline at end of file |
|
25 | ||
26 | def setupUi2(self): No newline at end of file |
|
26 | def setupUi2(self): | |
27 | print 'hi' No newline at end of file |
|
27 | print 'hi' | |
28 | self.txtDpath.setText('/home/ricardoar/optional/STORAGE/EW_DRIFTS/') No newline at end of file |
|
28 | self.txtDpath.setText('/home/ricardoar/optional/STORAGE/EW_DRIFTS/') | |
29 | self.txtRpath.setText('/home/ricardoar/optional/STORAGE/prueba1_jro_backup_manager/') No newline at end of file |
|
29 | self.txtRpath.setText('/home/ricardoar/optional/STORAGE/prueba1_jro_backup_manager/') | |
30 | No newline at end of file |
|
30 | ||
31 | @pyqtSignature("") No newline at end of file |
|
31 | @pyqtSignature("") | |
32 | def on_btnDpath_clicked(self): No newline at end of file |
|
32 | def on_btnDpath_clicked(self): | |
33 | """ No newline at end of file |
|
33 | """ | |
34 | Slot documentation goes here. No newline at end of file |
|
34 | Slot documentation goes here. | |
35 | """ No newline at end of file |
|
35 | """ | |
36 | var_Dpath= QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly) No newline at end of file |
|
36 | var_Dpath= QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly) | |
37 | self.txtDpath.setText(var_Dpath) No newline at end of file |
|
37 | self.txtDpath.setText(var_Dpath) | |
38 | self.on_txtDpath_editingFinished() No newline at end of file |
|
38 | self.on_txtDpath_editingFinished() | |
39 | No newline at end of file |
|
39 | ||
40 | @pyqtSignature("") No newline at end of file |
|
40 | @pyqtSignature("") | |
41 | def on_btnRpath_clicked(self): No newline at end of file |
|
41 | def on_btnRpath_clicked(self): | |
42 | """ No newline at end of file |
|
42 | """ | |
43 | Slot documentation goes here. No newline at end of file |
|
43 | Slot documentation goes here. | |
44 | """ No newline at end of file |
|
44 | """ | |
45 | var_Rpath = QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly) No newline at end of file |
|
45 | var_Rpath = QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly) | |
46 | self.txtRpath.setText(var_Rpath) No newline at end of file |
|
46 | self.txtRpath.setText(var_Rpath) | |
47 | self.on_txtRpath_editingFinished() No newline at end of file |
|
47 | self.on_txtRpath_editingFinished() | |
48 | No newline at end of file |
|
48 | ||
49 | No newline at end of file |
|
49 | ||
50 | @pyqtSignature("") No newline at end of file |
|
50 | @pyqtSignature("") | |
51 | def on_txtDpath_editingFinished(self): No newline at end of file |
|
51 | def on_txtDpath_editingFinished(self): | |
52 | No newline at end of file |
|
52 | ||
53 | #Usando el modulo "subprocess" eric4 pide seleccion del tipo de subproceso (padre o hijo) No newline at end of file |
|
53 | #Usando el modulo "subprocess" eric4 pide seleccion del tipo de subproceso (padre o hijo) | |
54 | #por ello se prefiere usar el modulo "commands" No newline at end of file |
|
54 | #por ello se prefiere usar el modulo "commands" | |
55 | #p1= Popen(['find', var_Dpath, '-name', '*.r'], stdout=PIPE) No newline at end of file |
|
55 | #p1= Popen(['find', var_Dpath, '-name', '*.r'], stdout=PIPE) | |
56 | #p2= Popen(['awk', '-F/', '{print substr($NF,2,7)}'], stdin=p1.stdout, stdout=PIPE) No newline at end of file |
|
56 | #p2= Popen(['awk', '-F/', '{print substr($NF,2,7)}'], stdin=p1.stdout, stdout=PIPE) | |
57 | #output_p2= p2.communicate()[0] No newline at end of file |
|
57 | #output_p2= p2.communicate()[0] | |
58 | #self.txtInfo.setText(output_p2) No newline at end of file |
|
58 | #self.txtInfo.setText(output_p2) | |
59 | No newline at end of file |
|
59 | ||
60 | var_Dpath=self.txtDpath.text() No newline at end of file |
|
60 | var_Dpath=self.txtDpath.text() | |
61 | No newline at end of file |
|
61 | ||
62 | #Se verifica que la ruta exista y sea un directorio No newline at end of file |
|
62 | #Se verifica que la ruta exista y sea un directorio | |
63 | var_cmd="test -d "+str(var_Dpath) No newline at end of file |
|
63 | var_cmd="test -d "+str(var_Dpath) | |
64 | var_output=commands.getstatusoutput(var_cmd)[0] No newline at end of file |
|
64 | var_output=commands.getstatusoutput(var_cmd)[0] | |
65 | if var_output != 0: No newline at end of file |
|
65 | if var_output != 0: | |
66 | self.txtInfo.setText("Ruta no valida, output_error:" + str(var_output)) No newline at end of file |
|
66 | self.txtInfo.setText("Ruta no valida, output_error:" + str(var_output)) | |
67 | return No newline at end of file |
|
67 | return | |
68 | No newline at end of file |
|
68 | ||
69 | #Se buscan los archivos del tipo especificado No newline at end of file |
|
69 | #Se buscan los archivos del tipo especificado | |
70 | var_Dtype=self.txtDtype.text() No newline at end of file |
|
70 | var_Dtype=self.txtDtype.text() | |
71 | 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 |
|
71 | var_cmd="find " + str(var_Dpath) + " -name *."+ str(var_Dtype) +" | awk -F/ '{print substr($NF,2,7)}' | sort| uniq" | |
72 | output_p2=commands.getstatusoutput(var_cmd)[1] No newline at end of file |
|
72 | output_p2=commands.getstatusoutput(var_cmd)[1] | |
73 | No newline at end of file |
|
73 | ||
74 | #INFO: Muestra los dias que se encontraron No newline at end of file |
|
74 | #INFO: Muestra los dias que se encontraron | |
75 | self.txtInfo.setText(output_p2) No newline at end of file |
|
75 | self.txtInfo.setText(output_p2) | |
76 | No newline at end of file |
|
76 | ||
77 | #Se cargan las listas para seleccionar StartDay y StopDay No newline at end of file |
|
77 | #Se cargan las listas para seleccionar StartDay y StopDay | |
78 | self.var_list=[] No newline at end of file |
|
78 | self.var_list=[] | |
79 | for i in range(0, (len(output_p2)+1)/8): No newline at end of file |
|
79 | for i in range(0, (len(output_p2)+1)/8): | |
80 | self.var_list.append(output_p2[8*i:8*(i+1)-1]) No newline at end of file |
|
80 | self.var_list.append(output_p2[8*i:8*(i+1)-1]) | |
81 | No newline at end of file |
|
81 | ||
82 | self.lstStartDay.clear() No newline at end of file |
|
82 | self.lstStartDay.clear() | |
83 | self.lstStopDay.clear() No newline at end of file |
|
83 | self.lstStopDay.clear() | |
84 | No newline at end of file |
|
84 | ||
85 | for i in self.var_list: No newline at end of file |
|
85 | for i in self.var_list: | |
86 | self.lstStartDay.addItem(i) No newline at end of file |
|
86 | self.lstStartDay.addItem(i) | |
87 | self.lstStopDay.addItem(i) No newline at end of file |
|
87 | self.lstStopDay.addItem(i) | |
88 | No newline at end of file |
|
88 | ||
89 | self.lstStopDay.setCurrentIndex(self.lstStartDay.count()-1) No newline at end of file |
|
89 | self.lstStopDay.setCurrentIndex(self.lstStartDay.count()-1) | |
90 | No newline at end of file |
|
90 | ||
91 | #INFO: Muestra cuantos dias se encontraron No newline at end of file |
|
91 | #INFO: Muestra cuantos dias se encontraron | |
92 | # self.txtInfo.setText(str(self.lstStartDay.count())) No newline at end of file |
|
92 | # self.txtInfo.setText(str(self.lstStartDay.count())) | |
93 | No newline at end of file |
|
93 | ||
94 | No newline at end of file |
|
94 | ||
95 | @pyqtSignature("") No newline at end of file |
|
95 | @pyqtSignature("") | |
96 | def on_txtRpath_editingFinished(self): No newline at end of file |
|
96 | def on_txtRpath_editingFinished(self): | |
97 | """ No newline at end of file |
|
97 | """ | |
98 | Slot documentation goes here. No newline at end of file |
|
98 | Slot documentation goes here. | |
99 | """ No newline at end of file |
|
99 | """ | |
100 | var_Rpath=self.txtRpath.text() No newline at end of file |
|
100 | var_Rpath=self.txtRpath.text() | |
101 | #Se verifica que la ruta exista y sea un directorio No newline at end of file |
|
101 | #Se verifica que la ruta exista y sea un directorio | |
102 | var_cmd="test -d "+str(var_Rpath) No newline at end of file |
|
102 | var_cmd="test -d "+str(var_Rpath) | |
103 | var_output=commands.getstatusoutput(var_cmd)[0] No newline at end of file |
|
103 | var_output=commands.getstatusoutput(var_cmd)[0] | |
104 | if var_output != 0: No newline at end of file |
|
104 | if var_output != 0: | |
105 | self.txtInfo.setText("Ruta no valida, output_error:" + str(var_output)) No newline at end of file |
|
105 | self.txtInfo.setText("Ruta no valida, output_error:" + str(var_output)) | |
106 | return No newline at end of file |
|
106 | return | |
107 | else: No newline at end of file |
|
107 | else: | |
108 | self.txtInfo.setText("Ruta valida, sin error") No newline at end of file |
|
108 | self.txtInfo.setText("Ruta valida, sin error") | |
109 | No newline at end of file |
|
109 | ||
110 | No newline at end of file |
|
110 | ||
111 | @pyqtSignature("int") No newline at end of file |
|
111 | @pyqtSignature("int") | |
112 | def on_lstDtype_activated(self, index): No newline at end of file |
|
112 | def on_lstDtype_activated(self, index): | |
113 | """ No newline at end of file |
|
113 | """ | |
114 | Permite elegir entre los tipos de archivos No newline at end of file |
|
114 | Permite elegir entre los tipos de archivos | |
115 | """ No newline at end of file |
|
115 | """ | |
116 | if index == 0: No newline at end of file |
|
116 | if index == 0: | |
117 | var_type='r' No newline at end of file |
|
117 | var_type='r' | |
118 | elif index == 1: No newline at end of file |
|
118 | elif index == 1: | |
119 | var_type='pdata' No newline at end of file |
|
119 | var_type='pdata' | |
120 | elif index == 2: No newline at end of file |
|
120 | elif index == 2: | |
121 | var_type='sswma' No newline at end of file |
|
121 | var_type='sswma' | |
122 | No newline at end of file |
|
122 | ||
123 | if index != 3: No newline at end of file |
|
123 | if index != 3: | |
124 | self.txtDtype.setText(var_type) No newline at end of file |
|
124 | self.txtDtype.setText(var_type) | |
125 | self.txtDtype.setReadOnly(True) No newline at end of file |
|
125 | self.txtDtype.setReadOnly(True) | |
126 | self.on_txtDpath_editingFinished() No newline at end of file |
|
126 | self.on_txtDpath_editingFinished() | |
127 | else: No newline at end of file |
|
127 | else: | |
128 | self.txtDtype.setText('') No newline at end of file |
|
128 | self.txtDtype.setText('') | |
129 | self.txtDtype.setReadOnly(False) No newline at end of file |
|
129 | self.txtDtype.setReadOnly(False) | |
130 | No newline at end of file |
|
130 | ||
131 | @pyqtSignature("") No newline at end of file |
|
131 | @pyqtSignature("") | |
132 | def on_txtDtype_editingFinished(self): No newline at end of file |
|
132 | def on_txtDtype_editingFinished(self): | |
133 | """ No newline at end of file |
|
133 | """ | |
134 | Se activa cuando el tipo de archivo es ingresado manualmente No newline at end of file |
|
134 | Se activa cuando el tipo de archivo es ingresado manualmente | |
135 | """ No newline at end of file |
|
135 | """ | |
136 | self.on_txtDpath_editingFinished() No newline at end of file |
|
136 | self.on_txtDpath_editingFinished() | |
137 | No newline at end of file |
|
137 | ||
138 | @pyqtSignature("int") No newline at end of file |
|
138 | @pyqtSignature("int") | |
139 | def on_lstStartDay_activated(self, index): No newline at end of file |
|
139 | def on_lstStartDay_activated(self, index): | |
140 | """ No newline at end of file |
|
140 | """ | |
141 | Slot documentation goes here. No newline at end of file |
|
141 | Slot documentation goes here. | |
142 | """ No newline at end of file |
|
142 | """ | |
143 | #self.txtInfo.setText(str(index)) No newline at end of file |
|
143 | #self.txtInfo.setText(str(index)) | |
144 | var_StopDay_index=self.lstStopDay.count() - self.lstStopDay.currentIndex() No newline at end of file |
|
144 | var_StopDay_index=self.lstStopDay.count() - self.lstStopDay.currentIndex() | |
145 | No newline at end of file |
|
145 | ||
146 | self.lstStopDay.clear() No newline at end of file |
|
146 | self.lstStopDay.clear() | |
147 | No newline at end of file |
|
147 | ||
148 | for i in self.var_list[index:]: No newline at end of file |
|
148 | for i in self.var_list[index:]: | |
149 | self.lstStopDay.addItem(i) No newline at end of file |
|
149 | self.lstStopDay.addItem(i) | |
150 | No newline at end of file |
|
150 | ||
151 | self.lstStopDay.setCurrentIndex(self.lstStopDay.count() - var_StopDay_index) No newline at end of file |
|
151 | self.lstStopDay.setCurrentIndex(self.lstStopDay.count() - var_StopDay_index) | |
152 | #self.txtInfo.append(str(var_StopDay_index)) No newline at end of file |
|
152 | #self.txtInfo.append(str(var_StopDay_index)) | |
153 | #self.txtInfo.append(str(self.lstStopDay.count())) No newline at end of file |
|
153 | #self.txtInfo.append(str(self.lstStopDay.count())) | |
154 | No newline at end of file |
|
154 | ||
155 | No newline at end of file |
|
155 | ||
156 | @pyqtSignature("int") No newline at end of file |
|
156 | @pyqtSignature("int") | |
157 | def on_lstStopDay_activated(self, index): No newline at end of file |
|
157 | def on_lstStopDay_activated(self, index): | |
158 | """ No newline at end of file |
|
158 | """ | |
159 | Slot documentation goes here. No newline at end of file |
|
159 | Slot documentation goes here. | |
160 | """ No newline at end of file |
|
160 | """ | |
161 | #self.txtInfo.setText(str(index)) No newline at end of file |
|
161 | #self.txtInfo.setText(str(index)) | |
162 | var_StartDay_index=self.lstStartDay.currentIndex() No newline at end of file |
|
162 | var_StartDay_index=self.lstStartDay.currentIndex() | |
163 | No newline at end of file |
|
163 | ||
164 | var_end_index = self.lstStopDay.count() - index No newline at end of file |
|
164 | var_end_index = self.lstStopDay.count() - index | |
165 | No newline at end of file |
|
165 | ||
166 | self.lstStartDay.clear() No newline at end of file |
|
166 | self.lstStartDay.clear() | |
167 | No newline at end of file |
|
167 | ||
168 | for i in self.var_list[:len(self.var_list) - var_end_index + 1]: No newline at end of file |
|
168 | for i in self.var_list[:len(self.var_list) - var_end_index + 1]: | |
169 | self.lstStartDay.addItem(i) No newline at end of file |
|
169 | self.lstStartDay.addItem(i) | |
170 | No newline at end of file |
|
170 | ||
171 | self.lstStartDay.setCurrentIndex(var_StartDay_index) No newline at end of file |
|
171 | self.lstStartDay.setCurrentIndex(var_StartDay_index) | |
172 | #self.txtInfo.append(str(var_StartDay_index)) No newline at end of file |
|
172 | #self.txtInfo.append(str(var_StartDay_index)) | |
173 | #self.txtInfo.append(str(self.lstStartDay.count())) No newline at end of file |
|
173 | #self.txtInfo.append(str(self.lstStartDay.count())) | |
174 | No newline at end of file |
|
174 | ||
175 | @pyqtSignature("int") No newline at end of file |
|
175 | @pyqtSignature("int") | |
176 | def on_lstDcapacity_activated(self, index): No newline at end of file |
|
176 | def on_lstDcapacity_activated(self, index): | |
177 | """ No newline at end of file |
|
177 | """ | |
178 | Permite elegir el tamaño del disco No newline at end of file |
|
178 | Permite elegir el tamaño del disco | |
179 | """ No newline at end of file |
|
179 | """ | |
180 | if index == 0: No newline at end of file |
|
180 | if index == 0: | |
181 | var_size=25.0 No newline at end of file |
|
181 | var_size=25.0 | |
182 | elif index == 1: No newline at end of file |
|
182 | elif index == 1: | |
183 | var_size=8.5 No newline at end of file |
|
183 | var_size=8.5 | |
184 | elif index == 2: No newline at end of file |
|
184 | elif index == 2: | |
185 | var_size=4.7 No newline at end of file |
|
185 | var_size=4.7 | |
186 | elif index == 3: No newline at end of file |
|
186 | elif index == 3: | |
187 | var_size=0.7 No newline at end of file |
|
187 | var_size=0.7 | |
188 | No newline at end of file |
|
188 | ||
189 | if index != 4: No newline at end of file |
|
189 | if index != 4: | |
190 | self.txtDcapacity.setText(str(var_size*10**9/1024**2)) No newline at end of file |
|
190 | self.txtDcapacity.setText(str(var_size*10**9/1024**2)) | |
191 | self.txtDcapacity.setReadOnly(True) No newline at end of file |
|
191 | self.txtDcapacity.setReadOnly(True) | |
192 | else: No newline at end of file |
|
192 | else: | |
193 | self.txtDcapacity.setText('') No newline at end of file |
|
193 | self.txtDcapacity.setText('') | |
194 | self.txtDcapacity.setReadOnly(False) No newline at end of file |
|
194 | self.txtDcapacity.setReadOnly(False) | |
195 | No newline at end of file |
|
195 | ||
196 | @pyqtSignature("") No newline at end of file |
|
196 | @pyqtSignature("") | |
197 | def on_btnGbkp_clicked(self): No newline at end of file |
|
197 | def on_btnGbkp_clicked(self): | |
198 | """ No newline at end of file |
|
198 | """ | |
199 | Cuando se presiona el boton Generate Bkp No newline at end of file |
|
199 | Cuando se presiona el boton Generate Bkp | |
200 | """ No newline at end of file |
|
200 | """ | |
201 | No newline at end of file |
|
201 | ||
202 | #CREA LAS CARPETAS "COMENTADO TEMPORALMENTE" No newline at end of file |
|
202 | #CREA LAS CARPETAS "COMENTADO TEMPORALMENTE" | |
203 | var_dirs='/{gpath,iso,ppath}' No newline at end of file |
|
203 | var_dirs='/{gpath,iso,ppath}' | |
204 | var_Rpath=self.txtRpath.text() No newline at end of file |
|
204 | var_Rpath=self.txtRpath.text() | |
205 | var_cmd="mkdir "+str(var_Rpath)+str(var_dirs) No newline at end of file |
|
205 | var_cmd="mkdir "+str(var_Rpath)+str(var_dirs) | |
206 | self.txtInfo.append(var_cmd) No newline at end of file |
|
206 | self.txtInfo.append(var_cmd) | |
207 | #var_output=commands.getstatusoutput(var_cmd)[0] No newline at end of file |
|
207 | #var_output=commands.getstatusoutput(var_cmd)[0] | |
208 | #if var_output != 0: No newline at end of file |
|
208 | #if var_output != 0: | |
209 | # self.txtInfo.setText("No se pudieron crear los directorios, output_error:" + str(var_output)) No newline at end of file |
|
209 | # self.txtInfo.setText("No se pudieron crear los directorios, output_error:" + str(var_output)) | |
210 | # return No newline at end of file |
|
210 | # return | |
211 | #else: No newline at end of file |
|
211 | #else: | |
212 | # self.txtInfo.append('Carpetas creadas correctamente') No newline at end of file |
|
212 | # self.txtInfo.append('Carpetas creadas correctamente') | |
213 | No newline at end of file |
|
213 | ||
214 | No newline at end of file |
|
214 | ||
215 | var_sublist=[] No newline at end of file |
|
215 | var_sublist=[] | |
216 | for i in self.var_list[self.lstStartDay.currentIndex():self.lstStartDay.currentIndex() + self.lstStopDay.currentIndex()+1]: No newline at end of file |
|
216 | for i in self.var_list[self.lstStartDay.currentIndex():self.lstStartDay.currentIndex() + self.lstStopDay.currentIndex()+1]: | |
217 | self.txtInfo.append(i) No newline at end of file |
|
217 | self.txtInfo.append(i) | |
218 | var_sublist.append(i) No newline at end of file |
|
218 | var_sublist.append(i) | |
219 | No newline at end of file |
|
219 | ||
220 | #Cargando los parametros de busqueda No newline at end of file |
|
220 | #Cargando los parametros de busqueda | |
221 | var_Dpath=self.txtDpath.text() No newline at end of file |
|
221 | var_Dpath=self.txtDpath.text() | |
222 | var_Dtype=self.txtDtype.text() No newline at end of file |
|
222 | var_Dtype=self.txtDtype.text() | |
223 | No newline at end of file |
|
223 | ||
224 | var_files_list=[] No newline at end of file |
|
224 | var_files_list=[] | |
225 | for var_doy in var_sublist: No newline at end of file |
|
225 | for var_doy in var_sublist: | |
226 | var_cmd="find " + str(var_Dpath) + " -name ?"+var_doy+"???."+ str(var_Dtype) No newline at end of file |
|
226 | var_cmd="find " + str(var_Dpath) + " -name ?"+var_doy+"???."+ str(var_Dtype) | |
227 | var_output=commands.getstatusoutput(var_cmd)[1] No newline at end of file |
|
227 | var_output=commands.getstatusoutput(var_cmd)[1] | |
228 | for var_file in var_output.split(): No newline at end of file |
|
228 | for var_file in var_output.split(): | |
229 | var_files_list.append(var_file) No newline at end of file |
|
229 | var_files_list.append(var_file) | |
230 | No newline at end of file |
|
230 | ||
231 | var_Dcapacity=float(self.txtDcapacity.text())*1024 #tamaño en KB No newline at end of file |
|
231 | var_Dcapacity=float(self.txtDcapacity.text())*1024 #tamaño en KB | |
232 | self.txtInfo.append(str(var_Dcapacity)) No newline at end of file |
|
232 | self.txtInfo.append(str(var_Dcapacity)) | |
233 | No newline at end of file |
|
233 | ||
234 | # self.txtInfo.append('Lista de archivos') No newline at end of file |
|
234 | # self.txtInfo.append('Lista de archivos') | |
235 | # var_n=0 No newline at end of file |
|
235 | # var_n=0 | |
236 | # for i in var_files_list: No newline at end of file |
|
236 | # for i in var_files_list: | |
237 | #self.txtInfo.append(str(os.path.getsize(i)/1024)+'KB') No newline at end of file |
|
237 | #self.txtInfo.append(str(os.path.getsize(i)/1024)+'KB') | |
238 | #self.txtInfo.append(i) No newline at end of file |
|
238 | #self.txtInfo.append(i) | |
239 | #var_n += 1 No newline at end of file |
|
239 | #var_n += 1 | |
240 | #self.txtInfo.append(str(var_n)) No newline at end of file |
|
240 | #self.txtInfo.append(str(var_n)) | |
241 | No newline at end of file |
|
241 | ||
242 | #lista de archivos a grabar en archivos . No newline at end of file |
|
242 | #lista de archivos a grabar en archivos . | |
243 | No newline at end of file |
|
243 | ||
244 | #Ruta de los archivos a grabar No newline at end of file |
|
244 | #Ruta de los archivos a grabar | |
245 | var_Rpath_ppath=var_Rpath=self.txtRpath.text()+"/ppath" No newline at end of file |
|
245 | var_Rpath_ppath=var_Rpath=self.txtRpath.text()+"/ppath" | |
246 | No newline at end of file |
|
246 | ||
247 | var_n=0 No newline at end of file |
|
247 | var_n=0 | |
248 | var_n_files=0 No newline at end of file |
|
248 | var_n_files=0 | |
249 | var_tmp=0 No newline at end of file |
|
249 | var_tmp=0 | |
250 | var_files_list_2=[] No newline at end of file |
|
250 | var_files_list_2=[] | |
251 | self.txtInfo.append(str(len(var_files_list))) No newline at end of file |
|
251 | self.txtInfo.append(str(len(var_files_list))) | |
252 | No newline at end of file |
|
252 | ||
253 | for i in var_files_list: No newline at end of file |
|
253 | for i in var_files_list: | |
254 | var_size_i=os.path.getsize(i)/1024+1 #tamaño en KB, se suma 1 KB para evitar problemas al momento de sumar No newline at end of file |
|
254 | var_size_i=os.path.getsize(i)/1024+1 #tamaño en KB, se suma 1 KB para evitar problemas al momento de sumar | |
255 | var_tmp += var_size_i No newline at end of file |
|
255 | var_tmp += var_size_i | |
256 | No newline at end of file |
|
256 | ||
257 | if var_tmp > var_Dcapacity: No newline at end of file |
|
257 | if var_tmp > var_Dcapacity: | |
258 | var_tmp -= var_size_i #se quita el tamaño sumado para mostrar el tamaño real No newline at end of file |
|
258 | var_tmp -= var_size_i #se quita el tamaño sumado para mostrar el tamaño real | |
259 | self.txtInfo.append(str(len(var_files_list_2))+" size:"+str(var_tmp)) No newline at end of file |
|
259 | self.txtInfo.append(str(len(var_files_list_2))+" size:"+str(var_tmp)) | |
260 | No newline at end of file |
|
260 | ||
|
261 | #se crea un archivo con numeral en el sufijo, y se añaden la lista de archivos No newline at end of file | |||
261 | var_file = open(self.txtElabel.text()+"_"+str(var_n),"w") No newline at end of file |
|
262 | var_file = open(self.txtElabel.text()+"_"+str(var_n),"w") | |
262 | for line in var_files_list_2: No newline at end of file |
|
263 | for line in var_files_list_2: | |
263 | var_file.write(line) No newline at end of file |
|
264 | var_file.write(line) | |
264 | var_file.close() No newline at end of file |
|
265 | var_file.close() | |
265 | No newline at end of file |
|
266 | ||
266 | var_n_files += len(var_files_list_2) No newline at end of file |
|
267 | var_n_files += len(var_files_list_2) | |
267 | var_tmp = var_size_i No newline at end of file |
|
268 | var_tmp = var_size_i | |
268 | var_files_list_2=[] No newline at end of file |
|
269 | var_files_list_2=[] | |
269 | var_files_list_2.append(i) No newline at end of file |
|
270 | var_files_list_2.append(i) | |
270 | var_n += 1 No newline at end of file |
|
271 | var_n += 1 | |
271 | No newline at end of file |
|
272 | ||
272 | else: No newline at end of file |
|
273 | else: | |
273 | var_files_list_2.append(i) No newline at end of file |
|
274 | var_files_list_2.append(i) | |
274 | No newline at end of file |
|
275 | ||
275 | self.txtInfo.append(str(len(var_files_list_2))+" size:"+str(var_tmp)) No newline at end of file |
|
276 | self.txtInfo.append(str(len(var_files_list_2))+" size:"+str(var_tmp)) | |
276 | No newline at end of file |
|
277 | ||
277 | var_n_files += len(var_files_list_2) No newline at end of file |
|
278 | var_n_files += len(var_files_list_2) | |
278 | self.txtInfo.append(str(var_n_files)) No newline at end of file |
|
279 | self.txtInfo.append(str(var_n_files)) |
General Comments 0
You need to be logged in to leave comments.
Login now