##// END OF EJS Templates
archivo configuracion
ralonso -
r48:49
parent child
Show More
@@ -1,216 +1,216
1 # -*- coding: utf-8 -*- No newline at end of file
1 # -*- coding: utf-8 -*-
2 No newline at end of file
2
3 #class BKmanager: No newline at end of file
3 #class BKmanager:
4 # def __init__(self): No newline at end of file
4 # def __init__(self):
5 No newline at end of file
5
6 from subprocess import * No newline at end of file
6 from subprocess import *
7 import sys No newline at end of file
7 import sys
8 import os No newline at end of file
8 import os
9 import subprocess No newline at end of file
9 import subprocess
10 import commands No newline at end of file
10 import commands
11 No newline at end of file
11
12 No newline at end of file
12
13 #Entero a cadena agregando ceros delante No newline at end of file
13 #Entero a cadena agregando ceros delante
14 def i2s(var_n, var_length=4): No newline at end of file
14 def i2s(var_n, var_length=4):
15 var_n2=str(var_n) No newline at end of file
15 var_n2=str(var_n)
16 while len(var_n2) < var_length: No newline at end of file
16 while len(var_n2) < var_length:
17 var_n2 = "0"+var_n2 No newline at end of file
17 var_n2 = "0"+var_n2
18 return var_n2 No newline at end of file
18 return var_n2
19 No newline at end of file
19
20 No newline at end of file
20
21 #Crea directorios en la ruta indicada No newline at end of file
21 #Crea directorios en la ruta indicada
22 def make_dirs(list_dirs, self): No newline at end of file
22 def make_dirs(list_dirs, self):
23 var_cmd="mkdir -p "+str(self.var_Rpath) No newline at end of file
23 var_cmd="mkdir -p "+str(self.var_Rpath)
24 for var_dir in list_dirs: No newline at end of file
24 for var_dir in list_dirs:
25 var_output=commands.getstatusoutput(var_cmd+'/'+var_dir)[0] No newline at end of file
25 var_output=commands.getstatusoutput(var_cmd+'/'+var_dir)[0]
26 if var_output != 0: No newline at end of file
26 if var_output != 0:
27 self.txtInfo.append("Error al crear el directorio "+var_dir+", output_error:" + str(var_output)) No newline at end of file
27 self.txtInfo.append("Error al crear el directorio "+var_dir+", output_error:" + str(var_output))
28 return False No newline at end of file
28 return False
29 self.txtInfo.append('Carpetas creadas correctamente') No newline at end of file
29 self.txtInfo.append('Carpetas creadas correctamente')
30 return True No newline at end of file
30 return True
31 No newline at end of file
31
32 No newline at end of file
32
33 #Se verifica que la ruta exista y sea un directorio No newline at end of file
33 #Se verifica que la ruta exista y sea un directorio
34 def dir_exists(var_dir, self): No newline at end of file
34 def dir_exists(var_dir, self):
35 var_cmd="test -d "+str(var_dir) No newline at end of file
35 var_cmd="test -d "+str(var_dir)
36 var_output=commands.getstatusoutput(var_cmd)[0] No newline at end of file
36 var_output=commands.getstatusoutput(var_cmd)[0]
37 if var_output != 0: No newline at end of file
37 if var_output != 0:
38 self.txtInfo.append("Ruta no valida, output_error:" + str(var_output)) No newline at end of file
38 self.txtInfo.append("Ruta no valida, output_error:" + str(var_output))
39 return False No newline at end of file
39 return False
40 else: No newline at end of file
40 else:
41 self.txtInfo.append("Ruta valida, sin error:" + str(var_dir)) No newline at end of file
41 self.txtInfo.append("Ruta valida, sin error:" + str(var_dir))
42 return True No newline at end of file
42 return True
43 No newline at end of file
43
44 No newline at end of file
44
45 #Se buscan los archivos del tipo especificado No newline at end of file
45 #Se buscan los archivos del tipo especificado
46 def load_days(self): No newline at end of file
46 def load_days(self):
47 No newline at end of file
47
48 self.var_list=[] No newline at end of file
48 self.var_list=[]
49 self.lstStartDay.clear() No newline at end of file
49 self.lstStartDay.clear()
50 self.lstStopDay.clear() No newline at end of file
50 self.lstStopDay.clear()
51 No newline at end of file
51
52 if self.statusDpath == False: No newline at end of file
52 if self.statusDpath == False:
53 self.btnGbkp.setEnabled(False) No newline at end of file
53 self.btnGbkp.setEnabled(False)
54 return No newline at end of file
54 return
55 No newline at end of file
55
56 if self.var_Dtype == '': No newline at end of file
56 if self.var_Dtype == '':
57 return No newline at end of file
57 return
58 No newline at end of file
58
59 var_cmd="find " + str(self.var_Dpath) + " -name *."+ str(self.var_Dtype) +" | awk -F/ '{print substr($NF,2,7)}' | sort| uniq" No newline at end of file
59 var_cmd="find " + str(self.var_Dpath) + " -name *."+ str(self.var_Dtype) +" | awk -F/ '{print substr($NF,2,7)}' | sort| uniq"
60 output=commands.getstatusoutput(var_cmd)[1] No newline at end of file
60 output=commands.getstatusoutput(var_cmd)[1]
61 No newline at end of file
61
62 #Si no se encuentra ningun archivo No newline at end of file
62 #Si no se encuentra ningun archivo
63 if len(output) == 0: No newline at end of file
63 if len(output) == 0:
64 self.txtInfo.append("No se encontraron archivos") No newline at end of file
64 self.txtInfo.append("No se encontraron archivos")
65 self.btnGbkp.setEnabled(False) No newline at end of file
65 self.btnGbkp.setEnabled(False)
66 return No newline at end of file
66 return
67 No newline at end of file
67
68 #Se cargan las listas para seleccionar StartDay y StopDay (QComboBox) No newline at end of file
68 #Se cargan las listas para seleccionar StartDay y StopDay (QComboBox)
69 for i in range(0, (len(output)+1)/8): No newline at end of file
69 for i in range(0, (len(output)+1)/8):
70 self.var_list.append(output[8*i:8*(i+1)-1]) No newline at end of file
70 self.var_list.append(output[8*i:8*(i+1)-1])
71 No newline at end of file
71
72 for i in self.var_list: No newline at end of file
72 for i in self.var_list:
73 self.lstStartDay.addItem(i) No newline at end of file
73 self.lstStartDay.addItem(i)
74 self.lstStopDay.addItem(i) No newline at end of file
74 self.lstStopDay.addItem(i)
75 self.lstStopDay.setCurrentIndex(self.lstStartDay.count()-1) No newline at end of file
75 self.lstStopDay.setCurrentIndex(self.lstStartDay.count()-1)
76 No newline at end of file
76
77 get_sub_list(self) No newline at end of file
77 get_sub_list(self)
78 self.btnGbkp.setEnabled(True) No newline at end of file
78 self.btnGbkp.setEnabled(True)
79 No newline at end of file
79
80 No newline at end of file
80
81 #Verifica que los parametros No newline at end of file
81 #Verifica que los parametros
82 def validate_parameters(self): No newline at end of file
82 def validate_parameters(self):
83 #Verifica que las rutas sean validas No newline at end of file
83 #Verifica que las rutas sean validas
84 if self.statusRpath == False: No newline at end of file
84 if self.statusRpath == False:
85 self.txtInfo.append("Ruta de proyecto no valida") No newline at end of file
85 self.txtInfo.append("Ruta de proyecto no valida")
86 return False No newline at end of file
86 return False
87 No newline at end of file
87
88 #Verifica la etiqueta No newline at end of file
88 #Verifica la etiqueta
89 if len(self.var_Elabel) == 0: No newline at end of file
89 if len(self.var_Elabel) == 0:
90 self.txtInfo.append("Debe ingresar el nombre de la etiqueta") No newline at end of file
90 self.txtInfo.append("Debe ingresar el nombre de la etiqueta")
91 return False No newline at end of file
91 return False
92 No newline at end of file
92
93 return True No newline at end of file
93 return True
94 No newline at end of file
94
95 No newline at end of file
95
96 #Obtiene el rango de las fechas seleccionadas No newline at end of file
96 #Obtiene el rango de las fechas seleccionadas
97 def get_sub_list(self): No newline at end of file
97 def get_sub_list(self):
98 self.var_sublist=[] No newline at end of file
98 self.var_sublist=[]
99 for i in self.var_list[self.lstStartDay.currentIndex():self.lstStartDay.currentIndex() + self.lstStopDay.currentIndex()+1]: No newline at end of file
99 for i in self.var_list[self.lstStartDay.currentIndex():self.lstStartDay.currentIndex() + self.lstStopDay.currentIndex()+1]:
100 self.var_sublist.append(i) No newline at end of file
100 self.var_sublist.append(i)
101 if len(self.var_sublist) == 0: No newline at end of file
101 if len(self.var_sublist) == 0:
102 self.txtInfo.append("No existen archivos encontrados") No newline at end of file
102 self.txtInfo.append("No existen archivos encontrados")
103 No newline at end of file
103
104 No newline at end of file
104
105 #Busca los archivos con los parametros de busqueda No newline at end of file
105 #Busca los archivos con los parametros de busqueda
106 def list_files(self): No newline at end of file
106 def list_files(self):
107 var_files_list=[] No newline at end of file
107 var_files_list=[]
108 for var_doy in self.var_sublist: No newline at end of file
108 for var_doy in self.var_sublist:
109 var_cmd="find " + str(self.var_Dpath) + " -name ?"+var_doy+"???."+ str(self.var_Dtype) + " |sort" No newline at end of file
109 var_cmd="find " + str(self.var_Dpath) + " -name ?"+var_doy+"???."+ str(self.var_Dtype) + " |sort"
110 var_output=commands.getstatusoutput(var_cmd)[1] No newline at end of file
110 var_output=commands.getstatusoutput(var_cmd)[1]
111 for var_file in var_output.split(): No newline at end of file
111 for var_file in var_output.split():
112 var_files_list.append(var_file) #Almacena cada archivo en la lista No newline at end of file
112 var_files_list.append(var_file) #Almacena cada archivo en la lista
113 return var_files_list No newline at end of file
113 return var_files_list
114 No newline at end of file
114
115 No newline at end of file
115
116 #Genera la lista de archivos .dat que contienen los archivos a grabar en cada DVD No newline at end of file
116 #Genera la lista de archivos .dat que contienen los archivos a grabar en cada DVD
117 def make_files_dat(var_files_list, self): No newline at end of file
117 def make_files_dat(var_files_list, self):
118 var_Rpath_ppath=self.var_Rpath+"/ppath" #Ruta de los archivos a grabar No newline at end of file
118 var_Rpath_ppath=self.var_Rpath+"/ppath" #Ruta de los archivos a grabar
119 var_n=1 #Numero del DVD actual No newline at end of file
119 var_n=1 #Numero del DVD actual
120 var_tmp=0 #Se usa para acumular el tamaΓ±o de los archivos de la lista No newline at end of file
120 var_tmp=0 #Se usa para acumular el tamaΓ±o de los archivos de la lista
121 var_files_list_2=[] #Se usa para almacenar la lista de archivos agrbar en cada DVD No newline at end of file
121 var_files_list_2=[] #Se usa para almacenar la lista de archivos agrbar en cada DVD
122 No newline at end of file
122
123 for i in var_files_list: #Se asignan en i los archivos de la lista No newline at end of file
123 for i in var_files_list: #Se asignan en i los archivos de la lista
124 self.txtInfo.append(i) No newline at end of file
124 self.txtInfo.append(i)
125 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 No newline at end of file
125 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
126 var_tmp += var_size_i #Se acumulan el tamaΓ±o de los archivos de la lista No newline at end of file
126 var_tmp += var_size_i #Se acumulan el tamaΓ±o de los archivos de la lista
127 No newline at end of file
127
128 #Si el tamaΓ±o acumulado es mayor que el de el DVD
128 #Si el tamaΓ±o acumulado es mayor que el de el DVD
No newline at end of file
129 if var_tmp > (self.var_Dcapacity * 1024): No newline at end of file
129 if var_tmp > self.var_Dcapacity: No newline at end of file
130 var_tmp -= var_size_i #se quita el tamaΓ±o sumado para mostrar el tamaΓ±o real No newline at end of file
130 var_tmp -= var_size_i #se quita el tamaΓ±o sumado para mostrar el tamaΓ±o real
131 #se crea un archivo con numeral en el sufijo y extension .dat No newline at end of file
131 #se crea un archivo con numeral en el sufijo y extension .dat
132 var_file = open(var_Rpath_ppath+"/"+self.var_Elabel+"_"+i2s(var_n)+".dat","w") No newline at end of file
132 var_file = open(var_Rpath_ppath+"/"+self.var_Elabel+"_"+i2s(var_n)+".dat","w")
133 #Se aΓ±ade la lista de archivos a grabar en el DVD al archivo .dat No newline at end of file
133 #Se aΓ±ade la lista de archivos a grabar en el DVD al archivo .dat
134 for line in var_files_list_2: No newline at end of file
134 for line in var_files_list_2:
135 var_tmp_path=(line.split(self.var_Dpath)[1]).split('/') No newline at end of file
135 var_tmp_path=(line.split(self.var_Dpath)[1]).split('/')
136 var_tmp_path2="/" No newline at end of file
136 var_tmp_path2="/"
137 for l in range(0, len(var_tmp_path)-1): No newline at end of file
137 for l in range(0, len(var_tmp_path)-1):
138 var_tmp_path2=var_tmp_path2+str(var_tmp_path[l])+"/" No newline at end of file
138 var_tmp_path2=var_tmp_path2+str(var_tmp_path[l])+"/"
139 var_file.write(var_tmp_path2+'=') No newline at end of file
139 var_file.write(var_tmp_path2+'=')
140 var_file.write(line+'\n') No newline at end of file
140 var_file.write(line+'\n')
141 var_file.close() No newline at end of file
141 var_file.close()
142 No newline at end of file
142
143 var_tmp = var_size_i #Se asigna a la variable el tamaΓ±o del archivo actual No newline at end of file
143 var_tmp = var_size_i #Se asigna a la variable el tamaΓ±o del archivo actual
144 var_files_list_2=[] #Se reinicia la lista No newline at end of file
144 var_files_list_2=[] #Se reinicia la lista
145 var_n += 1 No newline at end of file
145 var_n += 1
146 var_files_list_2.append(i) No newline at end of file
146 var_files_list_2.append(i)
147 No newline at end of file
147
148 #se crea un archivo con numeral en el sufijo y extension .dat No newline at end of file
148 #se crea un archivo con numeral en el sufijo y extension .dat
149 var_file = open(var_Rpath_ppath+"/"+self.var_Elabel+"_"+i2s(var_n)+".dat","w") No newline at end of file
149 var_file = open(var_Rpath_ppath+"/"+self.var_Elabel+"_"+i2s(var_n)+".dat","w")
150 #Se aΓ±ade la lista de archivos a grabar en el DVD al archivo .dat No newline at end of file
150 #Se aΓ±ade la lista de archivos a grabar en el DVD al archivo .dat
151 for line in var_files_list_2: No newline at end of file
151 for line in var_files_list_2:
152 var_tmp_path=(line.split(self.var_Dpath)[1]).split('/') No newline at end of file
152 var_tmp_path=(line.split(self.var_Dpath)[1]).split('/')
153 var_tmp_path2="/" No newline at end of file
153 var_tmp_path2="/"
154 for l in range(0, len(var_tmp_path)-1): No newline at end of file
154 for l in range(0, len(var_tmp_path)-1):
155 var_tmp_path2=var_tmp_path2+str(var_tmp_path[l])+"/" No newline at end of file
155 var_tmp_path2=var_tmp_path2+str(var_tmp_path[l])+"/"
156 var_file.write(var_tmp_path2+'=') No newline at end of file
156 var_file.write(var_tmp_path2+'=')
157 var_file.write(line+'\n') No newline at end of file
157 var_file.write(line+'\n')
158 var_file.close() No newline at end of file
158 var_file.close()
159 No newline at end of file
159
160 return var_n No newline at end of file
160 return var_n
161 No newline at end of file
161
162 No newline at end of file
162
163 #Genera los archivos .print con los cuales se creara los postscript No newline at end of file
163 #Genera los archivos .print con los cuales se creara los postscript
164 def make_files_print(self): No newline at end of file
164 def make_files_print(self):
165 No newline at end of file
165
166 var_Rpath_ppath=self.var_Rpath+"/ppath" #Ruta de los archivos a grabar No newline at end of file
166 var_Rpath_ppath=self.var_Rpath+"/ppath" #Ruta de los archivos a grabar
167 No newline at end of file
167
168 # Se leen todos los archivos .dat creados para crear las etiquetas en los archivos .print No newline at end of file
168 # Se leen todos los archivos .dat creados para crear las etiquetas en los archivos .print
169 for var_n in range(1, self.var_n_discs + 1): No newline at end of file
169 for var_n in range(1, self.var_n_discs + 1):
170 #se abren los archivos .dat en modo lectura No newline at end of file
170 #se abren los archivos .dat en modo lectura
171 var_file = open(var_Rpath_ppath+"/"+self.var_Elabel+"_"+i2s(var_n)+".dat","r") No newline at end of file
171 var_file = open(var_Rpath_ppath+"/"+self.var_Elabel+"_"+i2s(var_n)+".dat","r")
172 lines=var_file.readlines() # Se lee las lineas en el archivo y se almacenan en la lista No newline at end of file
172 lines=var_file.readlines() # Se lee las lineas en el archivo y se almacenan en la lista
173 # Se crea el archivo .print No newline at end of file
173 # Se crea el archivo .print
174 var_file_print = open(var_Rpath_ppath+"/"+self.var_Elabel+"_"+i2s(var_n)+".print","w") No newline at end of file
174 var_file_print = open(var_Rpath_ppath+"/"+self.var_Elabel+"_"+i2s(var_n)+".print","w")
175 var_file_print.write(self.var_Elabel+" "+i2s(var_n)+"/"+i2s(self.var_n_discs)+"\n") No newline at end of file
175 var_file_print.write(self.var_Elabel+" "+i2s(var_n)+"/"+i2s(self.var_n_discs)+"\n")
176 var_file_print.write("Year Doy Folder Set Time range\n") No newline at end of file
176 var_file_print.write("Year Doy Folder Set Time range\n")
177 No newline at end of file
177
178 var_first_folder = lines[0].split('=')[0] No newline at end of file
178 var_first_folder = lines[0].split('=')[0]
179 var_first_file = (lines[0].split('=')[1])[:-1] No newline at end of file
179 var_first_file = (lines[0].split('=')[1])[:-1]
180 var_date_first_file=commands.getstatusoutput("date -r "+var_first_file+" +'%T'")[1] No newline at end of file
180 var_date_first_file=commands.getstatusoutput("date -r "+var_first_file+" +'%T'")[1]
181 No newline at end of file
181
182 for j in range(1, len(lines)-1): No newline at end of file
182 for j in range(1, len(lines)-1):
183 var_tmp_folder = lines[j].split('=')[0] No newline at end of file
183 var_tmp_folder = lines[j].split('=')[0]
184 var_tmp_file = (lines[j].split('=')[1])[:-1] No newline at end of file
184 var_tmp_file = (lines[j].split('=')[1])[:-1]
185 No newline at end of file
185
186 # Si el subfolder superior o la fecha del archivo cambia se genera una nueva linea No newline at end of file
186 # Si el subfolder superior o la fecha del archivo cambia se genera una nueva linea
187 if (var_tmp_folder != var_first_folder) or (var_tmp_file[0:-5] != var_first_file[0:-5]): No newline at end of file
187 if (var_tmp_folder != var_first_folder) or (var_tmp_file[0:-5] != var_first_file[0:-5]):
188 var_last_file = (lines[j-1].split('=')[1])[:-1] No newline at end of file
188 var_last_file = (lines[j-1].split('=')[1])[:-1]
189 var_date_last_file=commands.getstatusoutput("date -r "+var_last_file+" +'%T'")[1] No newline at end of file
189 var_date_last_file=commands.getstatusoutput("date -r "+var_last_file+" +'%T'")[1]
190 # Si el archivo se grabara directamente en la / del DVD y no en un /directorio/ No newline at end of file
190 # Si el archivo se grabara directamente en la / del DVD y no en un /directorio/
191 # se usa la etiqueta para indicar la parte de la etiqueta donde va el subdirectorio No newline at end of file
191 # se usa la etiqueta para indicar la parte de la etiqueta donde va el subdirectorio
192 if var_first_folder == '/': No newline at end of file
192 if var_first_folder == '/':
193 var_folder = self.var_Elabel No newline at end of file
193 var_folder = self.var_Elabel
194 else: No newline at end of file
194 else:
195 var_folder = var_first_folder.split('/')[1] No newline at end of file
195 var_folder = var_first_folder.split('/')[1]
196 No newline at end of file
196
197 var_file_print.write(var_first_file[-12:-8]+" "+var_first_file[-8:-5]+" "+var_folder +" "+var_first_file[-5:-2]+" " No newline at end of file
197 var_file_print.write(var_first_file[-12:-8]+" "+var_first_file[-8:-5]+" "+var_folder +" "+var_first_file[-5:-2]+" "
198 +var_last_file[-5:-2]+" "+var_date_first_file+" "+var_date_last_file+"\n") No newline at end of file
198 +var_last_file[-5:-2]+" "+var_date_first_file+" "+var_date_last_file+"\n")
199 No newline at end of file
199
200 var_first_folder = lines[j].split('=')[0] No newline at end of file
200 var_first_folder = lines[j].split('=')[0]
201 var_first_file = (lines[j].split('=')[1])[:-1] No newline at end of file
201 var_first_file = (lines[j].split('=')[1])[:-1]
202 var_date_first_file=commands.getstatusoutput("date -r "+var_first_file+" +'%T'")[1] No newline at end of file
202 var_date_first_file=commands.getstatusoutput("date -r "+var_first_file+" +'%T'")[1]
203 No newline at end of file
203
204 var_last_file = (lines[-1].split('=')[1])[:-1] No newline at end of file
204 var_last_file = (lines[-1].split('=')[1])[:-1]
205 var_date_last_file=commands.getstatusoutput("date -r "+var_last_file+" +'%T'")[1] No newline at end of file
205 var_date_last_file=commands.getstatusoutput("date -r "+var_last_file+" +'%T'")[1]
206 No newline at end of file
206
207 if var_first_folder == '/': No newline at end of file
207 if var_first_folder == '/':
208 var_folder = self.txtElabel.text() No newline at end of file
208 var_folder = self.txtElabel.text()
209 else: No newline at end of file
209 else:
210 var_folder = var_first_folder.split('/')[1] No newline at end of file
210 var_folder = var_first_folder.split('/')[1]
211 No newline at end of file
211
212 var_file_print.write(var_first_file[-12:-8]+" "+var_first_file[-8:-5]+" "+var_folder +" "+var_first_file[-5:-2]+" " No newline at end of file
212 var_file_print.write(var_first_file[-12:-8]+" "+var_first_file[-8:-5]+" "+var_folder +" "+var_first_file[-5:-2]+" "
213 +var_last_file[-5:-2]+" "+var_date_first_file+" "+var_date_last_file+"\n") No newline at end of file
213 +var_last_file[-5:-2]+" "+var_date_first_file+" "+var_date_last_file+"\n")
214 No newline at end of file
214
215 var_file.close() No newline at end of file
215 var_file.close()
216 var_file_print.close() No newline at end of file
216 var_file_print.close()
@@ -1,67 +1,103
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 from subprocess import * No newline at end of file
4 from subprocess import *
5 import sys No newline at end of file
5 import sys
6 import os No newline at end of file
6 import os
7 import subprocess No newline at end of file
7 import subprocess
8 import commands No newline at end of file
8 import commands
9 No newline at end of file
9
10 No newline at end of file
10
11 def set_parameters(self): No newline at end of file
11 def set_parameters(self):
12 """ No newline at end of file
12 """
13 Se usa para inicializar ciertos parametros para pruebas No newline at end of file
13 Se usa para inicializar ciertos parametros para pruebas
14 """ No newline at end of file
14 """
15 #self.txtDpath.setText('/home/ricardoar/optional/STORAGE/Data/RAW_EXP/JASMET/') No newline at end of file
15 #self.txtDpath.setText('/home/ricardoar/optional/STORAGE/Data/RAW_EXP/JASMET/')
16 #self.txtRpath.setText('/home/ricardoar/optional/STORAGE/prueba1_jro_backup_manager/') No newline at end of file
16 #self.txtRpath.setText('/home/ricardoar/optional/STORAGE/prueba1_jro_backup_manager/')
17 self.txtDpath.setText('/home/ricardoar/optional/STORAGE/EW_DRIFTS/') No newline at end of file
17 self.txtDpath.setText('/home/ricardoar/optional/STORAGE/EW_DRIFTS/')
18 self.txtRpath.setText('/home/ricardoar/optional/prueba1_jro_backup_manager/') No newline at end of file
18 self.txtRpath.setText('/home/ricardoar/optional/prueba1_jro_backup_manager/')
19 self.txtElabel.setText('EW_DRIFTS') No newline at end of file
19 self.txtElabel.setText('EW_DRIFTS')
20 self.statusDpath = True No newline at end of file
20 self.statusDpath = True
21 self.statusRpath = True No newline at end of file
21 self.statusRpath = True
22 self.lstDcapacity.setCurrentIndex(4) No newline at end of file
22 self.lstDcapacity.setCurrentIndex(4)
23 self.txtDcapacity.setValue(100.0) No newline at end of file
23 self.txtDcapacity.setValue(100.0)
24 self.txtDcapacity.setReadOnly(False) No newline at end of file
24 self.txtDcapacity.setReadOnly(False)
25 No newline at end of file
25
26 No newline at end of file
26
27 def detect_devices(self): No newline at end of file
27 def detect_devices(self):
28 """ No newline at end of file
28 """
29 Deteccion de los dispositvos de grabacion No newline at end of file
29 Deteccion de los dispositvos de grabacion
30 """ No newline at end of file
30 """
31 #var_cmd="wodim --devices | grep /dev/ | awk -F\' '{print $2}'" #Funciona en consola pero no en python ΒΏ? No newline at end of file
31 #var_cmd="wodim --devices | grep /dev/ | awk -F\' '{print $2}'" #Funciona en consola pero no en python ΒΏ?
32 var_cmd="wodim --devices | grep /dev/ | awk '{print $2}' | awk -F= '{print $2}'" No newline at end of file
32 var_cmd="wodim --devices | grep /dev/ | awk '{print $2}' | awk -F= '{print $2}'"
33 var_output = commands.getstatusoutput(var_cmd) No newline at end of file
33 var_output = commands.getstatusoutput(var_cmd)
34 if var_output[0] != 0: No newline at end of file
34 if var_output[0] != 0:
35 self.txtInfo.append("No se pudo encontrar los dispositivos de grabacion, output_error:" + str(var_output)) No newline at end of file
35 self.txtInfo.append("No se pudo encontrar los dispositivos de grabacion, output_error:" + str(var_output))
36 else: No newline at end of file
36 else:
37 self.txtInfo.append("dispositivos encontrados") No newline at end of file
37 self.txtInfo.append("dispositivos encontrados")
38 var_devices = var_output[1].split('\n') No newline at end of file
38 var_devices = var_output[1].split('\n')
39 No newline at end of file
39
40 var_tmp=[] No newline at end of file
40 var_tmp=[]
41 for i in range(0, 4): No newline at end of file
41 for i in range(0, 4):
42 if i < len(var_devices): No newline at end of file
42 if i < len(var_devices):
43 var_len = len(var_devices[i]) No newline at end of file
43 var_len = len(var_devices[i])
44 var_tmp.append(var_devices[i][1:var_len - 1]) No newline at end of file
44 var_tmp.append(var_devices[i][1:var_len - 1])
45 else: No newline at end of file
45 else:
46 var_tmp.append('') No newline at end of file
46 var_tmp.append('')
47 No newline at end of file
47
48 #Se escriben los dispostivos correspodientes, si existen No newline at end of file
48 #Se escriben los dispostivos correspodientes, si existen
49 self.txtDeviceA.setText(str(var_tmp[0])) No newline at end of file
49 self.txtDeviceA.setText(str(var_tmp[0]))
50 self.txtDeviceB.setText(str(var_tmp[1])) No newline at end of file
50 self.txtDeviceB.setText(str(var_tmp[1]))
51 self.txtDeviceC.setText(str(var_tmp[2])) No newline at end of file
51 self.txtDeviceC.setText(str(var_tmp[2]))
52 self.txtDeviceD.setText(str(var_tmp[3])) No newline at end of file
52 self.txtDeviceD.setText(str(var_tmp[3]))
53 #Se desactivan los que no existen No newline at end of file
53 #Se desactivan los que no existen
54 if len(var_tmp[0]) == 0 : No newline at end of file
54 if len(var_tmp[0]) == 0 :
55 self.chkDevA.setChecked(False) No newline at end of file
55 self.chkDevA.setChecked(False)
56 self.chkDevA.setEnabled(False) No newline at end of file
56 self.chkDevA.setEnabled(False)
57 if len(var_tmp[1]) == 0 : No newline at end of file
57 if len(var_tmp[1]) == 0 :
58 self.chkDevB.setChecked(False) No newline at end of file
58 self.chkDevB.setChecked(False)
59 self.chkDevB.setEnabled(False) No newline at end of file
59 self.chkDevB.setEnabled(False)
60 if len(var_tmp[2]) == 0 : No newline at end of file
60 if len(var_tmp[2]) == 0 :
61 self.chkDevC.setChecked(False) No newline at end of file
61 self.chkDevC.setChecked(False)
62 self.chkDevC.setEnabled(False) No newline at end of file
62 self.chkDevC.setEnabled(False)
63 if len(var_tmp[3]) == 0 : No newline at end of file
63 if len(var_tmp[3]) == 0 :
64 self.chkDevD.setChecked(False) No newline at end of file
64 self.chkDevD.setChecked(False)
65 self.chkDevD.setEnabled(False) No newline at end of file
65 self.chkDevD.setEnabled(False)
66 No newline at end of file
66
67 def enabled_items1(var_bool, self):
No newline at end of file
68 self.tabParameters.setEnabled(not(var_bool))
No newline at end of file
69 self.lstDcapacity.setEnabled(not(var_bool))
No newline at end of file
70 self.txtDcapacity.setEnabled(not(var_bool))
No newline at end of file
71 self.btnGbkp.setEnabled(not(var_bool))
No newline at end of file
72 self.btnRestart.setEnabled(var_bool)
No newline at end of file
73 self.btnStartburn.setEnabled(var_bool) No newline at end of file
67 No newline at end of file
74
75 def make_parameters_conf(self):
No newline at end of file
76 var_file = open("parameters.conf","w")
No newline at end of file
77
No newline at end of file
78 var_file.write(self.var_Dpath+"\n")
No newline at end of file
79 var_file.write(self.var_Rpath+"\n")
No newline at end of file
80 var_file.write(str(self.var_lstDtype)+"\n")
No newline at end of file
81 var_file.write(self.var_Dtype+"\n")
No newline at end of file
82 var_file.write(self.var_Elabel+"\n")
No newline at end of file
83 var_file.write(str(self.var_Copys)+"\n")
No newline at end of file
84 var_file.write(str(self.var_lstDcapacity)+"\n")
No newline at end of file
85 var_file.write(str(self.var_Dcapacity)+"\n")
No newline at end of file
86
No newline at end of file
87 var_file.close()
No newline at end of file
88
No newline at end of file
89
No newline at end of file
90 def get_parameters_conf(self):
No newline at end of file
91 var_file = open("parameters.conf","w")
No newline at end of file
92
No newline at end of file
93 var_file.write(self.var_Dpath+"\n")
No newline at end of file
94 var_file.write(self.var_Rpath+"\n")
No newline at end of file
95 var_file.write(str(self.var_lstDtype)+"\n")
No newline at end of file
96 var_file.write(self.var_Dtype+"\n")
No newline at end of file
97 var_file.write(self.var_Elabel+"\n")
No newline at end of file
98 var_file.write(str(self.var_Copys)+"\n")
No newline at end of file
99 var_file.write(str(self.var_lstDcapacity)+"\n")
No newline at end of file
100 var_file.write(str(self.var_Dcapacity)+"\n")
No newline at end of file
101
No newline at end of file
102 var_file.close()
No newline at end of file
103 No newline at end of file
@@ -1,308 +1,312
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 from functions import functions No newline at end of file
16 from functions import functions
17 from functions import functions2 No newline at end of file
17 from functions import functions2
18 No newline at end of file
18
19 class MainWindow(QMainWindow, Ui_MainWindow): No newline at end of file
19 class MainWindow(QMainWindow, Ui_MainWindow):
20 """ No newline at end of file
20 """
21 Class documentation goes here. No newline at end of file
21 Class documentation goes here.
22 """ No newline at end of file
22 """
23 No newline at end of file
23
24 def __init__(self, parent = None): No newline at end of file
24 def __init__(self, parent = None):
25 QMainWindow.__init__(self, parent) No newline at end of file
25 QMainWindow.__init__(self, parent)
26 self.setupUi(self) No newline at end of file
26 self.setupUi(self)
27 self.setupUi2() No newline at end of file
27 self.setupUi2()
28 sys.stdout = self #redirige salida estandar No newline at end of file
28 sys.stdout = self #redirige salida estandar
29 No newline at end of file
29
30 def setupUi2(self): No newline at end of file
30 def setupUi2(self):
31 No newline at end of file
31
32 sys.stdout = self
No newline at end of file
33
No newline at end of file
34 var_tmp = os.path.isfile("parameters.conf")
No newline at end of file
35
No newline at end of file
36 if var_tmp == True:
No newline at end of file
37 self.txtInfo.append("Archivo de configuracion encontrado")
No newline at end of file
38 functions2.get_parameters_conf(self)
No newline at end of file
39
No newline at end of file
40 else:
No newline at end of file
41 self.txtInfo.append("Elija los parametros de configuracion")
No newline at end of file
42
No newline at end of file
43 # os.remove("parameters.conf")
No newline at end of file
44 No newline at end of file
32 self.statusDpath = False No newline at end of file
45 self.statusDpath = False
33 self.statusRpath = False No newline at end of file
46 self.statusRpath = False
34 No newline at end of file
47
35 functions2.set_parameters(self) #Establece ciertos parametros, para pruebas No newline at end of file
48 functions2.set_parameters(self) #Establece ciertos parametros, para pruebas
36 No newline at end of file
49
37 self.var_Dpath = self.txtDpath.text() No newline at end of file
50 self.var_Dpath = self.txtDpath.text()
38 self.var_Rpath = self.txtRpath.text() No newline at end of file
51 self.var_Rpath = self.txtRpath.text()
52 self.var_lstDtype = self.lstDtype.currentIndex() No newline at end of file
39 self.var_Dtype = self.txtDtype.text() No newline at end of file
53 self.var_Dtype = self.txtDtype.text()
40 self.var_Elabel = self.txtElabel.text() No newline at end of file
54 self.var_Elabel = self.txtElabel.text()
41 self.var_Copys = self.txtCopys.value()
55 self.var_Copys = self.txtCopys.value()
No newline at end of file
56 self.var_lstDcapacity = self.lstDcapacity.currentIndex()
42 self.var_Dcapacity = self.txtDcapacity.value() * 1024 No newline at end of file
No newline at end of file
57 self.var_Dcapacity = self.txtDcapacity.value() No newline at end of file
43 No newline at end of file
58
44 self.var_n_discs=0 No newline at end of file
59 self.var_n_discs=0
45 self.var_list=[] No newline at end of file
60 self.var_list=[]
46 self.var_sublist=[] No newline at end of file
61 self.var_sublist=[]
47 No newline at end of file
62
48 functions2.detect_devices(self) #busca los dispositivos de grabacion No newline at end of file
63 functions2.detect_devices(self) #busca los dispositivos de grabacion
49 functions.load_days(self) No newline at end of file
64 functions.load_days(self)
50 No newline at end of file
65
51 No newline at end of file
66
52 No newline at end of file
67
53 def write(self, txt): No newline at end of file
68 def write(self, txt):
54 """ No newline at end of file
69 """
55 Escribe la salida estandar eb txtInfo No newline at end of file
70 Escribe la salida estandar eb txtInfo
56 """ No newline at end of file
71 """
57 self.txtInfo.append(str(txt)) No newline at end of file
72 self.txtInfo.append(str(txt))
58 No newline at end of file
73
59 No newline at end of file
74
60 @pyqtSignature("") No newline at end of file
75 @pyqtSignature("")
61 def on_btnDpath_clicked(self): No newline at end of file
76 def on_btnDpath_clicked(self):
62 """ No newline at end of file
77 """
63 Permite seleccionar graficamente el direcorio de los datos a grabar No newline at end of file
78 Permite seleccionar graficamente el direcorio de los datos a grabar
64 """ No newline at end of file
79 """
65 self.var_Dpath= QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly) No newline at end of file
80 self.var_Dpath= QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)
66 self.txtDpath.setText(self.var_Dpath) No newline at end of file
81 self.txtDpath.setText(self.var_Dpath)
67 self.on_txtDpath_editingFinished() #llamada a funcion No newline at end of file
82 self.on_txtDpath_editingFinished() #llamada a funcion
68 No newline at end of file
83
69 No newline at end of file
84
70 @pyqtSignature("") No newline at end of file
85 @pyqtSignature("")
71 def on_btnRpath_clicked(self): No newline at end of file
86 def on_btnRpath_clicked(self):
72 """ No newline at end of file
87 """
73 Permite seleccionar graficamente el direcorio del proyecto No newline at end of file
88 Permite seleccionar graficamente el direcorio del proyecto
74 """ No newline at end of file
89 """
75 self.var_Rpath = QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly) No newline at end of file
90 self.var_Rpath = QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)
76 self.txtRpath.setText(self.var_Rpath) No newline at end of file
91 self.txtRpath.setText(self.var_Rpath)
77 self.on_txtRpath_editingFinished() #llamada a funcion No newline at end of file
92 self.on_txtRpath_editingFinished() #llamada a funcion
78 No newline at end of file
93
79 No newline at end of file
94
80 @pyqtSignature("") No newline at end of file
95 @pyqtSignature("")
81 def on_txtDpath_editingFinished(self): No newline at end of file
96 def on_txtDpath_editingFinished(self):
82 """ No newline at end of file
97 """
83 Permite buscar los archivos de extension seleccionada en la ruta de de datos No newline at end of file
98 Permite buscar los archivos de extension seleccionada en la ruta de de datos
84 y cargar los valores para el rango de tiempo a ser grabado No newline at end of file
99 y cargar los valores para el rango de tiempo a ser grabado
85 """ No newline at end of file
100 """
86 self.var_Dpath=self.txtDpath.text() #Se carga la variable con la ruta recien editada No newline at end of file
101 self.var_Dpath=self.txtDpath.text() #Se carga la variable con la ruta recien editada
87 self.statusDpath = functions.dir_exists(self.var_Dpath, self) No newline at end of file
102 self.statusDpath = functions.dir_exists(self.var_Dpath, self)
88 functions.load_days(self) No newline at end of file
103 functions.load_days(self)
89 No newline at end of file
104
90 No newline at end of file
105
91 @pyqtSignature("") No newline at end of file
106 @pyqtSignature("")
92 def on_txtRpath_editingFinished(self): No newline at end of file
107 def on_txtRpath_editingFinished(self):
93 """ No newline at end of file
108 """
94 Valida la ruta del proyecto No newline at end of file
109 Valida la ruta del proyecto
95 """ No newline at end of file
110 """
96 self.var_Rpath=self.txtRpath.text() #Se carga la variable con la ruta recien editada No newline at end of file
111 self.var_Rpath=self.txtRpath.text() #Se carga la variable con la ruta recien editada
97 self.statusRpath = functions.dir_exists(self.var_Rpath, self) No newline at end of file
112 self.statusRpath = functions.dir_exists(self.var_Rpath, self)
98 No newline at end of file
113
99 No newline at end of file
114
100 @pyqtSignature("int") No newline at end of file
115 @pyqtSignature("int")
101 def on_lstDtype_activated(self, index): No newline at end of file
116 def on_lstDtype_activated(self, index):
102 """ No newline at end of file
117 """
103 Permite elegir entre los tipos de archivos No newline at end of file
118 Permite elegir entre los tipos de archivos
104 """ No newline at end of file
119 """
105 self.txtDtype.setReadOnly(True) No newline at end of file
120 self.txtDtype.setReadOnly(True)
106 if index == 0: No newline at end of file
121 if index == 0:
107 var_type='r' No newline at end of file
122 var_type='r'
108 elif index == 1: No newline at end of file
123 elif index == 1:
109 var_type='pdata' No newline at end of file
124 var_type='pdata'
110 elif index == 2: No newline at end of file
125 elif index == 2:
111 var_type='sswma' No newline at end of file
126 var_type='sswma'
112 else : No newline at end of file
127 else :
113 var_type='' No newline at end of file
128 var_type=''
114 self.txtDtype.setReadOnly(False) No newline at end of file
129 self.txtDtype.setReadOnly(False)
115 No newline at end of file
130
116 self.txtDtype.setText(var_type) No newline at end of file
131 self.txtDtype.setText(var_type)
117 self.on_txtDtype_editingFinished() No newline at end of file
132 self.on_txtDtype_editingFinished()
118 No newline at end of file
133
119 No newline at end of file
134
120 @pyqtSignature("") No newline at end of file
135 @pyqtSignature("")
121 def on_txtDtype_editingFinished(self): No newline at end of file
136 def on_txtDtype_editingFinished(self):
122 self.var_Dtype=self.txtDtype.text() No newline at end of file
137 self.var_Dtype=self.txtDtype.text()
123 functions.load_days(self) #llamada a funcion No newline at end of file
138 functions.load_days(self) #llamada a funcion
124 No newline at end of file
139
125 No newline at end of file
140
126 @pyqtSignature("") No newline at end of file
141 @pyqtSignature("")
127 def on_txtElabel_editingFinished(self): No newline at end of file
142 def on_txtElabel_editingFinished(self):
128 self.var_Elabel = self.txtElabel.text() No newline at end of file
143 self.var_Elabel = self.txtElabel.text()
129 No newline at end of file
144
130 No newline at end of file
145
131 @pyqtSignature("") No newline at end of file
146 @pyqtSignature("")
132 def on_txtCopys_editingFinished(self): No newline at end of file
147 def on_txtCopys_editingFinished(self):
133 self.var_Copys = self.txtCopys.value() No newline at end of file
148 self.var_Copys = self.txtCopys.value()
134 No newline at end of file
149
135 No newline at end of file
150
136 @pyqtSignature("") No newline at end of file
151 @pyqtSignature("")
137 def on_txtDcapacity_editingFinished(self):
152 def on_txtDcapacity_editingFinished(self):
No newline at end of file
153 self.var_Dcapacity = self.txtDcapacity.value() No newline at end of file
138 self.var_Dcapacity = self.txtDcapacity.value() * 1024 #tamaΓ±o en KB No newline at end of file
139 No newline at end of file
154
140 No newline at end of file
155
141 @pyqtSignature("int") #CLOSED No newline at end of file
156 @pyqtSignature("int") #CLOSED
142 def on_lstStartDay_activated(self, index): No newline at end of file
157 def on_lstStartDay_activated(self, index):
143 """ No newline at end of file
158 """
144 Cambia la lista de opciones en lstStopDay No newline at end of file
159 Cambia la lista de opciones en lstStopDay
145 """ No newline at end of file
160 """
146 var_StopDay_index=self.lstStopDay.count() - self.lstStopDay.currentIndex() No newline at end of file
161 var_StopDay_index=self.lstStopDay.count() - self.lstStopDay.currentIndex()
147 self.lstStopDay.clear() No newline at end of file
162 self.lstStopDay.clear()
148 No newline at end of file
163
149 for i in self.var_list[index:]: No newline at end of file
164 for i in self.var_list[index:]:
150 self.lstStopDay.addItem(i) No newline at end of file
165 self.lstStopDay.addItem(i)
151 No newline at end of file
166
152 self.lstStopDay.setCurrentIndex(self.lstStopDay.count() - var_StopDay_index) No newline at end of file
167 self.lstStopDay.setCurrentIndex(self.lstStopDay.count() - var_StopDay_index)
153 No newline at end of file
168
154 functions.get_sub_list(self) No newline at end of file
169 functions.get_sub_list(self)
155 No newline at end of file
170
156 No newline at end of file
171
157 @pyqtSignature("int") #CLOSED No newline at end of file
172 @pyqtSignature("int") #CLOSED
158 def on_lstStopDay_activated(self, index): No newline at end of file
173 def on_lstStopDay_activated(self, index):
159 """ No newline at end of file
174 """
160 Cambia la lista de opciones en lstStartDay No newline at end of file
175 Cambia la lista de opciones en lstStartDay
161 """ No newline at end of file
176 """
162 var_StartDay_index=self.lstStartDay.currentIndex() No newline at end of file
177 var_StartDay_index=self.lstStartDay.currentIndex()
163 var_end_index = self.lstStopDay.count() - index No newline at end of file
178 var_end_index = self.lstStopDay.count() - index
164 self.lstStartDay.clear() No newline at end of file
179 self.lstStartDay.clear()
165 No newline at end of file
180
166 for i in self.var_list[:len(self.var_list) - var_end_index + 1]: No newline at end of file
181 for i in self.var_list[:len(self.var_list) - var_end_index + 1]:
167 self.lstStartDay.addItem(i) No newline at end of file
182 self.lstStartDay.addItem(i)
168 No newline at end of file
183
169 self.lstStartDay.setCurrentIndex(var_StartDay_index) No newline at end of file
184 self.lstStartDay.setCurrentIndex(var_StartDay_index)
170 No newline at end of file
185
171 functions.get_sub_list(self) No newline at end of file
186 functions.get_sub_list(self)
172 No newline at end of file
187
173 No newline at end of file
188
174 @pyqtSignature("int") #CLOSED No newline at end of file
189 @pyqtSignature("int") #CLOSED
175 def on_lstDcapacity_activated(self, index): No newline at end of file
190 def on_lstDcapacity_activated(self, index):
176 """ No newline at end of file
191 """
177 Permite elegir el tamaΓ±o del disco No newline at end of file
192 Permite elegir el tamaΓ±o del disco
178 """ No newline at end of file
193 """
179 if index == 0: No newline at end of file
194 if index == 0:
180 var_size=25.0 No newline at end of file
195 var_size=25.0
181 elif index == 1: No newline at end of file
196 elif index == 1:
182 var_size=8.5 No newline at end of file
197 var_size=8.5
183 elif index == 2: No newline at end of file
198 elif index == 2:
184 var_size=4.7 No newline at end of file
199 var_size=4.7
185 elif index == 3: No newline at end of file
200 elif index == 3:
186 var_size=0.7 No newline at end of file
201 var_size=0.7
187 No newline at end of file
202
188 if index != 4: No newline at end of file
203 if index != 4:
189 self.txtDcapacity.setValue(var_size*10**9/1024**2) No newline at end of file
204 self.txtDcapacity.setValue(var_size*10**9/1024**2)
190 self.txtDcapacity.setReadOnly(True) No newline at end of file
205 self.txtDcapacity.setReadOnly(True)
191 else: No newline at end of file
206 else:
192 self.txtDcapacity.setValue(100.0) No newline at end of file
207 self.txtDcapacity.setValue(100.0)
193 self.txtDcapacity.setReadOnly(False) No newline at end of file
208 self.txtDcapacity.setReadOnly(False)
194
209
No newline at end of file
210 self.var_Dcapacity = self.txtDcapacity.value() No newline at end of file
195 self.var_Dcapacity = self.txtDcapacity.value() * 1024 #tamaΓ±o en KB No newline at end of file
196 No newline at end of file
211
197 No newline at end of file
212
198 @pyqtSignature("") No newline at end of file
213 @pyqtSignature("")
199 def on_btnGbkp_clicked(self): No newline at end of file
214 def on_btnGbkp_clicked(self):
200 """ No newline at end of file
215 """
201 Cuando se presiona el boton btnGbkp No newline at end of file
216 Cuando se presiona el boton btnGbkp
202 """ No newline at end of file
217 """
203 No newline at end of file
218
204 if functions.validate_parameters(self) == False: No newline at end of file
219 if functions.validate_parameters(self) == False:
205 return No newline at end of file
220 return
206 No newline at end of file
221
207 #Crea las carpetas en la ruta del proyecto y verifica que se crearon correctamente No newline at end of file
222 #Crea las carpetas en la ruta del proyecto y verifica que se crearon correctamente
208 list_dirs=['gpath','iso','ppath'] No newline at end of file
223 list_dirs=['gpath','iso','ppath']
209 bool_make_dirs = functions.make_dirs(list_dirs, self) No newline at end of file
224 bool_make_dirs = functions.make_dirs(list_dirs, self)
210 if bool_make_dirs == False: No newline at end of file
225 if bool_make_dirs == False:
211 return No newline at end of file
226 return
212 No newline at end of file
227
213 var_files_list = functions.list_files(self) #Se obtiene la lista de archivos a grabar No newline at end of file
228 var_files_list = functions.list_files(self) #Se obtiene la lista de archivos a grabar
214 self.var_n_discs = functions.make_files_dat(var_files_list, self) #Se crean los archivos .dat No newline at end of file
229 self.var_n_discs = functions.make_files_dat(var_files_list, self) #Se crean los archivos .dat
215 No newline at end of file
230 functions.make_files_print(self) # Se crean los archivos .print
216 functions.make_files_print(self) # Se crean los archivos .print
231 functions2.make_parameters_conf(self) # se crea el archivo parameters.conf
No newline at end of file
232
217
No newline at end of file
No newline at end of file
233 #Se deshabilitan los parametros de configuracion
218 #Se deshabilita el Tab Parameters y el boton btnGbkp
No newline at end of file
No newline at end of file
234 functions2.enabled_items1(True, self)
219 self.tabParameters.setEnabled(False)
No newline at end of file
No newline at end of file
235 No newline at end of file
220 self.lstDcapacity.setEnabled(False)
No newline at end of file
221 self.txtDcapacity.setEnabled(False)
No newline at end of file
222 self.btnGbkp.setEnabled(False)
No newline at end of file
223 self.btnRestart.setEnabled(True)
No newline at end of file
224 self.btnStartburn.setEnabled(True)
No newline at end of file
225 No newline at end of file
226 No newline at end of file
236 @pyqtSignature("")
227 @pyqtSignature("") No newline at end of file
237 def on_btnRestart_clicked(self):
228 def on_btnRestart_clicked(self): No newline at end of file
238 """
229 """ No newline at end of file
239 Permite que se puedan cambiar los parametros
230 Permite que se puedan cambiar los parametros No newline at end of file
240 """
231 """
241 functions2.enabled_items1(False, self)
No newline at end of file
242 No newline at end of file
232 self.tabParameters.setEnabled(True)
No newline at end of file
233 self.lstDcapacity.setEnabled(True)
No newline at end of file
234 self.txtDcapacity.setEnabled(True)
No newline at end of file
235 self.btnGbkp.setEnabled(True)
No newline at end of file
236 self.btnRestart.setEnabled(False)
No newline at end of file
237 self.btnStartburn.setEnabled(False) No newline at end of file
238 No newline at end of file
243
239 No newline at end of file
244 @pyqtSignature("")
240 @pyqtSignature("") No newline at end of file
245 def on_btnStartburn_clicked(self):
241 def on_btnStartburn_clicked(self): No newline at end of file
246 """
242 """ No newline at end of file
247 Se inicia el proceso de grabacion
243 Se inicia el proceso de grabacion No newline at end of file
248 """
244 """ No newline at end of file
249 self.btnRestart.setEnabled(False)
245 self.btnRestart.setEnabled(False) No newline at end of file
250 self.btnStartburn.setEnabled(False)
246 self.btnStartburn.setEnabled(False) No newline at end of file
251 self.btnStopburn.setEnabled(True)
247 self.btnStopburn.setEnabled(True) No newline at end of file
252
248 No newline at end of file
253 sys.stdout = self
249 sys.stdout = self No newline at end of file
254 #sys.stderr = self
250 #sys.stderr = self No newline at end of file
255 print "stdout_!!!"
251 print "stdout_!!!" No newline at end of file
256
252 No newline at end of file
257 #Inicializando variables
253 #Inicializando variables No newline at end of file
258 var_Rpath_ppath=self.var_Rpath+"/ppath"
254 var_Rpath_ppath=self.var_Rpath+"/ppath" No newline at end of file
259 var_Rpath_iso=self.var_Rpath+"/iso"
255 var_Rpath_iso=self.var_Rpath+"/iso" No newline at end of file
260
256 No newline at end of file
261 # Se leen todos los archivos .dat creados para crear las etiquetas en los archivos .ps
257 # Se leen todos los archivos .dat creados para crear las etiquetas en los archivos .ps No newline at end of file
262 for var_n in range(1, self.var_n_discs+1):
258 for var_n in range(1, self.var_n_discs+1): No newline at end of file
263 self.txtInfo.append(str(var_n))
259 self.txtInfo.append(str(var_n)) No newline at end of file
264 file_iso=var_Rpath_iso+"/"+functions.i2s(var_n)+".iso"
260 file_iso=var_Rpath_iso+"/"+functions.i2s(var_n)+".iso" No newline at end of file
265 file_dat=var_Rpath_ppath+"/"+self.var_Elabel+"_"+functions.i2s(var_n)+".dat"
261 file_dat=var_Rpath_ppath+"/"+self.var_Elabel+"_"+functions.i2s(var_n)+".dat" No newline at end of file
266
262 No newline at end of file
267 var_cmd = 'genisoimage -hide-joliet-trans-tbl -joliet-long -r '
263 var_cmd = 'genisoimage -hide-joliet-trans-tbl -joliet-long -r ' No newline at end of file
268 var_cmd += ' -A '+self.var_Elabel+' -V '+self.var_Elabel
264 var_cmd += ' -A '+self.var_Elabel+' -V '+self.var_Elabel No newline at end of file
269 var_cmd += ' -graft-points -path-list '+ file_dat+' -o '+file_iso
265 var_cmd += ' -graft-points -path-list '+ file_dat+' -o '+file_iso No newline at end of file
270 self.txtInfo.append(var_cmd)
266 self.txtInfo.append(var_cmd)
271
No newline at end of file
272 var_output=commands.getstatusoutput(str(var_cmd))[0]
267 #
No newline at end of file
No newline at end of file
273 self.txtInfo.append(str(var_output))
268 # var_output=commands.getstatusoutput(str(var_cmd))[0]
No newline at end of file
No newline at end of file
274
269 # self.txtInfo.append(str(var_output))
No newline at end of file
No newline at end of file
275 #os.system(str(var_cmd)) No newline at end of file
270 # No newline at end of file
271 #os.system(str(var_cmd)) No newline at end of file
276 #p = subprocess.Popen(str('ls /'), shell=True, stdout=self)
272 #p = subprocess.Popen(str('ls /'), shell=True, stdout=self) No newline at end of file
277 #os.waitpid(p.pid, 0)
273 #os.waitpid(p.pid, 0) No newline at end of file
278 ####self.txtInfo.append(str(p.pid))
274 ####self.txtInfo.append(str(p.pid)) No newline at end of file
279
275 No newline at end of file
280
276 No newline at end of file
281 @pyqtSignature("")
277 @pyqtSignature("") No newline at end of file
282 def on_btnStopburn_clicked(self):
278 def on_btnStopburn_clicked(self): No newline at end of file
283 """
279 """ No newline at end of file
284 Slot documentation goes here.
280 Slot documentation goes here. No newline at end of file
285 """
281 """ No newline at end of file
286 self.btnRestart.setEnabled(True)
282 self.btnRestart.setEnabled(True) No newline at end of file
287 self.btnStartburn.setEnabled(True)
283 self.btnStartburn.setEnabled(True) No newline at end of file
288 self.btnStopburn.setEnabled(False)
284 self.btnStopburn.setEnabled(False) No newline at end of file
289
285 No newline at end of file
290 @pyqtSignature("")
286 @pyqtSignature("") No newline at end of file
291 def on_btnTdevA_clicked(self):
287 def on_btnTdevA_clicked(self): No newline at end of file
292 var_dev = str(self.txtDeviceA.text())
288 var_dev = str(self.txtDeviceA.text()) No newline at end of file
293 var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev
289 var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev No newline at end of file
294 commands.getstatusoutput(var_cmd)
290 commands.getstatusoutput(var_cmd) No newline at end of file
295
291 No newline at end of file
296 @pyqtSignature("")
292 @pyqtSignature("") No newline at end of file
297 def on_btnTdevB_clicked(self):
293 def on_btnTdevB_clicked(self): No newline at end of file
298 var_dev = str(self.txtDeviceB.text())
294 var_dev = str(self.txtDeviceB.text()) No newline at end of file
299 var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev
295 var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev No newline at end of file
300 commands.getstatusoutput(var_cmd)
296 commands.getstatusoutput(var_cmd) No newline at end of file
301
297 No newline at end of file
302 @pyqtSignature("")
298 @pyqtSignature("") No newline at end of file
303 def on_btnTdevC_clicked(self):
299 def on_btnTdevC_clicked(self): No newline at end of file
304 var_dev = str(self.txtDeviceC.text())
300 var_dev = str(self.txtDeviceC.text()) No newline at end of file
305 var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev
301 var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev No newline at end of file
306 commands.getstatusoutput(var_cmd)
302 commands.getstatusoutput(var_cmd) No newline at end of file
307
303 No newline at end of file
308 @pyqtSignature("")
304 @pyqtSignature("") No newline at end of file
309 def on_btnTdevD_clicked(self):
305 def on_btnTdevD_clicked(self): No newline at end of file
310 var_dev = str(self.txtDeviceD.text())
306 var_dev = str(self.txtDeviceD.text()) No newline at end of file
311 var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev
307 var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev No newline at end of file
312 commands.getstatusoutput(var_cmd)
308 commands.getstatusoutput(var_cmd) No newline at end of file
313
General Comments 0
You need to be logged in to leave comments. Login now