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