@@ -1,321 +1,331 | |||
|
1 | 1 | # -*- coding: utf-8 -*- No newline at end of file |
|
2 | 2 | No newline at end of file |
|
3 | 3 | #class BKmanager: No newline at end of file |
|
4 | 4 | # def __init__(self): No newline at end of file |
|
5 | 5 | No newline at end of file |
|
6 | 6 | from subprocess import * No newline at end of file |
|
7 | 7 | import sys No newline at end of file |
|
8 | 8 | import os No newline at end of file |
|
9 | 9 | import subprocess No newline at end of file |
|
10 | 10 | import commands No newline at end of file |
|
11 | 11 | import shutil No newline at end of file |
|
12 | import functions2 No newline at end of file | |
|
12 | 13 | No newline at end of file |
|
13 | 14 | #--------------------------------------------- Entero a cadena agregando ceros delante ------------------------------------------------- No newline at end of file |
|
14 | 15 | No newline at end of file |
|
15 | 16 | def i2s(var_n, var_length=4): No newline at end of file |
|
16 | 17 | var_n2=str(var_n) No newline at end of file |
|
17 | 18 | while len(var_n2) < var_length: No newline at end of file |
|
18 | 19 | var_n2 = "0"+var_n2 No newline at end of file |
|
19 | 20 | return var_n2 No newline at end of file |
|
20 | 21 | No newline at end of file |
|
21 | 22 | No newline at end of file |
|
22 | 23 | #----------------------------------------- Se verifica que la ruta exista y sea un directorio ------------------------------------------------- No newline at end of file |
|
23 | 24 | No newline at end of file |
|
24 | 25 | def dir_exists(var_dir, self): No newline at end of file |
|
25 | 26 | if os.path.isdir(var_dir): No newline at end of file |
|
26 | 27 | return True No newline at end of file |
|
27 | 28 | else: No newline at end of file |
|
28 | 29 | self.txtInfo.append("Incorrect path:" + str(var_dir)) No newline at end of file |
|
29 | 30 | return False No newline at end of file |
|
30 | 31 | No newline at end of file |
|
31 | 32 | No newline at end of file |
|
32 | 33 | #-------------------------------- Se buscan los archivos del tipo especificado y se cargan las fechas ----------------------------- No newline at end of file |
|
33 | 34 | No newline at end of file |
|
34 | 35 | def load_days(self): No newline at end of file |
|
35 | 36 | No newline at end of file |
|
36 | 37 | self.var_list=[] No newline at end of file |
|
37 | 38 | self.lstStartDay.clear() No newline at end of file |
|
38 | 39 | self.lstStopDay.clear() No newline at end of file |
|
39 | 40 | No newline at end of file |
|
40 | 41 | if self.statusDpath == False: No newline at end of file |
|
41 | 42 | self.btnGbkp.setEnabled(False) No newline at end of file |
|
42 | 43 | return No newline at end of file |
|
43 | 44 | No newline at end of file |
|
44 | 45 | if self.var_Dtype == '': No newline at end of file |
|
45 | 46 | return No newline at end of file |
|
46 | 47 | No newline at end of file |
|
47 | 48 | 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 |
|
48 | 49 | output=commands.getstatusoutput(var_cmd)[1] No newline at end of file |
|
49 | 50 | No newline at end of file |
|
50 | 51 | #Si no se encuentra ningun archivo No newline at end of file |
|
51 | 52 | if len(output) == 0: No newline at end of file |
|
52 | 53 | self.txtInfo.append("File not found") No newline at end of file |
|
53 | 54 | self.btnGbkp.setEnabled(False) No newline at end of file |
|
54 | 55 | return No newline at end of file |
|
55 | 56 | No newline at end of file |
|
56 | 57 | #Se cargan las listas para seleccionar StartDay y StopDay (QComboBox) No newline at end of file |
|
57 | 58 | for i in range(0, (len(output)+1)/8): No newline at end of file |
|
58 | 59 | self.var_list.append(output[8*i:8*(i+1)-1]) No newline at end of file |
|
59 | 60 | No newline at end of file |
|
60 | 61 | for i in self.var_list: No newline at end of file |
|
61 | 62 | self.lstStartDay.addItem(i) No newline at end of file |
|
62 | 63 | self.lstStopDay.addItem(i) No newline at end of file |
|
63 | 64 | self.lstStopDay.setCurrentIndex(self.lstStartDay.count()-1) No newline at end of file |
|
64 | 65 | No newline at end of file |
|
65 | 66 | get_sub_list(self) No newline at end of file |
|
66 | 67 | self.btnGbkp.setEnabled(True) No newline at end of file |
|
67 | 68 | No newline at end of file |
|
68 | 69 | No newline at end of file |
|
69 | 70 | #-------------------------------------------------- Obtiene el rango de las fechas seleccionadas ----------------------------------------- No newline at end of file |
|
70 | 71 | No newline at end of file |
|
71 | 72 | def get_sub_list(self): No newline at end of file |
|
72 | 73 | self.var_sublist=[] No newline at end of file |
|
73 | 74 | for i in self.var_list[self.lstStartDay.currentIndex():self.lstStartDay.currentIndex() + self.lstStopDay.currentIndex()+1]: No newline at end of file |
|
74 | 75 | self.var_sublist.append(i) No newline at end of file |
|
75 | 76 | No newline at end of file |
|
76 | 77 | No newline at end of file |
|
77 | 78 | #----------------------------------------------------- Verifica los parametros faltantes ----------------------------------------------------------- No newline at end of file |
|
78 | 79 | No newline at end of file |
|
79 | 80 | def validate_parameters(self): No newline at end of file |
|
80 | 81 | #Verifica que las ruta del proyecto sea valida No newline at end of file |
|
81 | 82 | if self.statusRpath == False: No newline at end of file |
|
82 | 83 | self.txtInfo.append("Incorrect proyect path") No newline at end of file |
|
83 | 84 | return False No newline at end of file |
|
84 | 85 | No newline at end of file |
|
85 | 86 | #Verifica la etiqueta No newline at end of file |
|
86 | 87 | if len(self.var_Elabel) == 0: No newline at end of file |
|
87 | 88 | self.txtInfo.append("Enter label") No newline at end of file |
|
88 | 89 | return False No newline at end of file |
|
89 | 90 | No newline at end of file |
|
90 | 91 | return True No newline at end of file |
|
91 | 92 | No newline at end of file |
|
92 | 93 | No newline at end of file |
|
93 | 94 | #------------------------------------------------- Crea directorios en la ruta indicada ----------------------------------------------------------- No newline at end of file |
|
94 | 95 | No newline at end of file |
|
95 | 96 | def make_dirs(list_dirs, self): No newline at end of file |
|
96 | 97 | """ No newline at end of file |
|
97 | 98 | No newline at end of file |
|
98 | 99 | """ No newline at end of file |
|
99 | 100 | No newline at end of file |
|
100 | 101 | for var_dir in list_dirs: No newline at end of file |
|
101 | 102 | shutil.rmtree(self.var_Rpath+'/'+var_dir, True) No newline at end of file |
|
102 | 103 | var_output=commands.getstatusoutput("mkdir -p "+self.var_Rpath+'/'+var_dir)[0] No newline at end of file |
|
103 | 104 | if var_output != 0: No newline at end of file |
|
104 | 105 | self.txtInfo.append("Error creating directory: "+var_dir+", output_error:" + str(var_output)) No newline at end of file |
|
105 | 106 | return False No newline at end of file |
|
106 | 107 | self.txtInfo.append('Directories created correctly') No newline at end of file |
|
107 | 108 | return True No newline at end of file |
|
108 | 109 | No newline at end of file |
|
109 | 110 | No newline at end of file |
|
110 | 111 | #-------------------------------------------- Busca los archivos con los parametros de busqueda --------------------------------------- No newline at end of file |
|
111 | 112 | No newline at end of file |
|
112 | 113 | def list_files(self): No newline at end of file |
|
113 | 114 | var_files_list=[] No newline at end of file |
|
114 | 115 | for var_doy in self.var_sublist: No newline at end of file |
|
115 | 116 | var_cmd="find " + str(self.var_Dpath) + " -name ?"+var_doy+"???."+ str(self.var_Dtype) + " |sort" No newline at end of file |
|
116 | 117 | var_output=commands.getstatusoutput(var_cmd)[1] No newline at end of file |
|
117 | 118 | for var_file in var_output.split(): No newline at end of file |
|
118 | 119 | var_files_list.append(var_file) #Almacena cada archivo en la lista No newline at end of file |
|
119 | 120 | return var_files_list No newline at end of file |
|
120 | 121 | No newline at end of file |
|
121 | 122 | No newline at end of file |
|
122 | 123 | #--------------- Genera la lista de archivos .dat que contienen los archivos a grabar en cada DVD ----------------------- No newline at end of file |
|
123 | 124 | No newline at end of file |
|
124 | 125 | def make_files_dat(var_files_list, self): No newline at end of file |
|
125 | 126 | var_Rpath_ppath=self.var_Rpath+"/ppath" #Ruta de los archivos a grabar No newline at end of file |
|
126 | 127 | var_n=1 #Numero del DVD actual No newline at end of file |
|
127 | 128 | var_tmp=0 #Se usa para acumular el tamaΓ±o de los archivos de la lista No newline at end of file |
|
128 | 129 | var_files_list_2=[] #Se usa para almacenar la lista de archivos agrbar en cada DVD No newline at end of file |
|
129 | 130 | No newline at end of file |
|
130 | 131 | for i in var_files_list: #Se asignan en i los archivos de la lista No newline at end of file |
|
131 | 132 | No newline at end of file |
|
132 | 133 | 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 |
|
133 | 134 | var_tmp += var_size_i #Se acumulan el tamaΓ±o de los archivos de la lista No newline at end of file |
|
134 | 135 | No newline at end of file |
|
135 | 136 | #Si el tamaΓ±o acumulado es mayor que el de el DVD No newline at end of file |
|
136 | 137 | if var_tmp > (self.var_Dcapacity * 1024): No newline at end of file |
|
137 | 138 | var_tmp -= var_size_i #se quita el tamaΓ±o sumado para mostrar el tamaΓ±o real No newline at end of file |
|
138 | 139 | #se crea un archivo con numeral en el sufijo y extension .dat No newline at end of file |
|
139 | 140 | var_file = open(var_Rpath_ppath+"/"+self.var_Elabel+"_"+i2s(var_n)+".dat","w") No newline at end of file |
|
140 | 141 | #Se aΓ±ade la lista de archivos a grabar en el DVD al archivo .dat No newline at end of file |
|
141 | 142 | for line in var_files_list_2: No newline at end of file |
|
142 | 143 | var_tmp_path=line.split(self.var_Dpath)[1][:-13] No newline at end of file |
|
143 | 144 | var_file.write(var_tmp_path+'='+line+'\n') No newline at end of file |
|
144 | 145 | var_file.close() No newline at end of file |
|
145 | 146 | No newline at end of file |
|
146 | 147 | var_tmp = var_size_i #Se asigna a la variable el tamaΓ±o del archivo actual No newline at end of file |
|
147 | 148 | var_files_list_2=[] #Se reinicia la lista No newline at end of file |
|
148 | 149 | var_n += 1 No newline at end of file |
|
149 | 150 | var_files_list_2.append(i) No newline at end of file |
|
150 | 151 | No newline at end of file |
|
151 | 152 | #se crea un archivo con numeral en el sufijo y extension .dat No newline at end of file |
|
152 | 153 | var_file = open(var_Rpath_ppath+"/"+self.var_Elabel+"_"+i2s(var_n)+".dat","w") No newline at end of file |
|
153 | 154 | #Se aΓ±ade la lista de archivos a grabar en el DVD al archivo .dat No newline at end of file |
|
154 | 155 | for line in var_files_list_2: No newline at end of file |
|
155 | 156 | var_tmp_path=line.split(self.var_Dpath)[1][:-13] No newline at end of file |
|
156 | 157 | var_file.write(var_tmp_path+'='+line+'\n') No newline at end of file |
|
157 | 158 | var_file.close() No newline at end of file |
|
158 | 159 | No newline at end of file |
|
159 | 160 | self.txtInfo.append("configuration files created") No newline at end of file |
|
160 | 161 | return var_n No newline at end of file |
|
161 | 162 | No newline at end of file |
|
162 | 163 | No newline at end of file |
|
163 | 164 | #------------------------------ Genera los archivos .print con los cuales se creara los postscript ----------------------------------- No newline at end of file |
|
164 | 165 | No newline at end of file |
|
165 | 166 | def make_files_print(self): No newline at end of file |
|
166 | 167 | No newline at end of file |
|
167 | 168 | var_Rpath_ppath=self.var_Rpath+"/ppath" #Ruta de los archivos a grabar No newline at end of file |
|
168 | 169 | var_Rpath_gpath=self.var_Rpath+"/gpath" #Ruta de los archivos postscript No newline at end of file |
|
169 | 170 | var_labels=[] No newline at end of file |
|
170 | 171 | for m in range (0, self.txtPSgraphic.value() - 1): No newline at end of file |
|
171 | 172 | var_lines = "\n" * 9 No newline at end of file |
|
172 | 173 | var_labels.append(var_lines) No newline at end of file |
|
173 | 174 | No newline at end of file |
|
174 | 175 | # Se leen todos los archivos .dat creados para crear las etiquetas en los archivos .print No newline at end of file |
|
175 | 176 | for var_n in range(1, self.var_Discs + 1): No newline at end of file |
|
176 | 177 | No newline at end of file |
|
177 | 178 | #se abren los archivos .dat en modo lectura No newline at end of file |
|
178 | 179 | var_file = open(var_Rpath_ppath+"/"+self.var_Elabel+"_"+i2s(var_n)+".dat","r") No newline at end of file |
|
179 | 180 | lines=var_file.readlines() # Se lee las lineas en el archivo y se almacenan en la lista No newline at end of file |
|
180 | 181 | var_file.close() No newline at end of file |
|
181 | 182 | list_files=[] No newline at end of file |
|
182 | 183 | var_lines=[] No newline at end of file |
|
183 | 184 | No newline at end of file |
|
184 | 185 | for j in range(0, len(lines)): No newline at end of file |
|
185 | 186 | No newline at end of file |
|
186 | 187 | if j == 0: No newline at end of file |
|
187 | 188 | var_first_folder = lines[j].split('=')[0] No newline at end of file |
|
188 | 189 | var_first_file = (lines[j].split('=')[1])[:-1] No newline at end of file |
|
189 | 190 | continue No newline at end of file |
|
190 | 191 | No newline at end of file |
|
191 | 192 | var_tmp_folder = lines[j].split('=')[0] No newline at end of file |
|
192 | 193 | var_tmp_file = (lines[j].split('=')[1])[:-1] No newline at end of file |
|
193 | 194 | No newline at end of file |
|
194 | 195 | # Si el subfolder superior o el DOY del archivo actual y el anterior son diferentes No newline at end of file |
|
195 | 196 | if (var_tmp_folder != var_first_folder) or (var_tmp_file[0:-5] != var_first_file[0:-5]): No newline at end of file |
|
196 | 197 | var_last_file = (lines[j-1].split('=')[1])[:-1] No newline at end of file |
|
197 | 198 | list_files.append([var_first_folder, var_first_file, var_last_file]) No newline at end of file |
|
198 | 199 | No newline at end of file |
|
199 | 200 | var_first_folder = lines[j].split('=')[0] No newline at end of file |
|
200 | 201 | var_first_file = (lines[j].split('=')[1])[:-1] No newline at end of file |
|
201 | 202 | No newline at end of file |
|
202 | 203 | var_last_file = (lines[-1].split('=')[1])[:-1] No newline at end of file |
|
203 | 204 | list_files.append([var_first_folder, var_first_file, var_last_file]) No newline at end of file |
|
204 | 205 | No newline at end of file |
|
205 | 206 | var_lines2 = lines_print(list_files, self.var_Elabel) No newline at end of file |
|
206 | 207 | No newline at end of file |
|
207 | 208 | for k in range(0, len(var_lines2) / 5): No newline at end of file |
|
208 | 209 | var_lines=["\n"] No newline at end of file |
|
209 | 210 | var_lines.append(" "+self.var_Elabel+" "+i2s(var_n)+"/"+i2s(self.var_Discs)+"\n") |
|
211 | No newline at end of file | |
|
210 | var_lines.append("Year Doy Folder"+" "*6+"Set"+" "*9+"Time range\n") No newline at end of file | |
|
211 | 212 | var_lines.extend(var_lines2[(5*k):(5*(k+1))]) No newline at end of file |
|
212 | 213 | var_lines.append("\n") No newline at end of file |
|
213 | 214 | var_labels.append(var_lines) No newline at end of file |
|
214 | 215 | No newline at end of file |
|
215 | 216 | for i in range(0, (len(var_labels) // 33) +1 ): No newline at end of file |
|
216 | 217 | var_file=var_Rpath_gpath+"/"+self.var_Elabel+"_"+i2s(i+1) No newline at end of file |
|
217 | 218 | file_ps = open(var_file+".print","w") No newline at end of file |
|
218 | 219 | if i == (len(var_labels) // 33): No newline at end of file |
|
219 | 220 | var_sub_labels = var_labels[33*i:] No newline at end of file |
|
220 | 221 | else: No newline at end of file |
|
221 | 222 | var_sub_labels = var_labels[33*i:33*(i+1)] No newline at end of file |
|
222 | 223 | No newline at end of file |
|
223 | 224 | for label in var_sub_labels: No newline at end of file |
|
224 | 225 | for line in label: No newline at end of file |
|
225 | 226 | file_ps.write(line) No newline at end of file |
|
226 | 227 | file_ps.close() No newline at end of file |
|
227 | 228 | var_cmd="enscript "+var_file+".print -p "+var_file+".ps -f Times-Roman7 " \ No newline at end of file |
|
228 | 229 | +" -3R -j -B --margins=21.25:20.4:25.51:20 --media=A4" No newline at end of file |
|
229 | 230 | var_output=commands.getstatusoutput(var_cmd)[0] No newline at end of file |
|
230 | 231 | No newline at end of file |
|
231 | 232 | No newline at end of file |
|
232 | 233 | def lines_print(list_files, var_Elabel): No newline at end of file |
|
233 | 234 | """ No newline at end of file |
|
234 | 235 | Devuelve las lineas del rango de archivos de cada etiqueta segun el formato No newline at end of file |
|
235 | 236 | """ No newline at end of file |
|
236 | 237 | var_lines=[] No newline at end of file |
|
237 | 238 | for i in list_files: No newline at end of file |
|
238 | 239 | No newline at end of file |
|
239 | 240 | # Si el archivo se grabara directamente en la / del DVD y no en un /directorio/ No newline at end of file |
|
240 | 241 | # se usa la etiqueta para indicar la parte de la etiqueta donde va el subdirectorio No newline at end of file |
|
241 | 242 | if i[0] == '/': No newline at end of file |
|
242 | 243 | var_folder = var_Elabel No newline at end of file |
|
243 | 244 | else: No newline at end of file |
|
244 | 245 | var_folder = i[0].split('/')[-2] No newline at end of file |
|
245 | 246 | No newline at end of file |
|
246 | 247 | var_first_file = i[1] No newline at end of file |
|
247 | 248 | var_last_file = i[2] No newline at end of file |
|
248 | 249 | No newline at end of file |
|
249 | 250 | var_date_first_file=commands.getstatusoutput("date -r "+var_first_file+" +'%T'")[1] No newline at end of file |
|
250 | 251 | var_date_last_file=commands.getstatusoutput("date -r "+var_last_file+" +'%T'")[1] No newline at end of file |
|
251 | 252 | No newline at end of file |
|
252 | 253 | var_lines.append(var_first_file[-12:-8]+" "+var_first_file[-8:-5]+" "+var_folder +" "+var_first_file[-5:-2]+"-" No newline at end of file |
|
253 | 254 | +var_last_file[-5:-2]+" "+var_date_first_file+"-"+var_date_last_file+"\n") No newline at end of file |
|
254 | 255 | #Nos aseguramos que sea un mutiplo de 5 No newline at end of file |
|
255 | 256 | while (len(var_lines) % 5) != 0: No newline at end of file |
|
256 | 257 | var_lines.append("\n") No newline at end of file |
|
257 | 258 | No newline at end of file |
|
258 | 259 | return var_lines No newline at end of file |
|
259 | 260 | No newline at end of file |
|
260 | 261 | #---------------------------------------comandos para el proceso de grabacion ------------------------------------------ No newline at end of file |
|
261 | 262 | def cmd_iso(self): No newline at end of file |
|
262 | 263 | var_Rpath_ppath=self.var_Rpath+"/ppath" No newline at end of file |
|
263 | 264 | var_Rpath_iso=self.var_Rpath+"/iso" No newline at end of file |
|
264 | 265 | #comando para la creacion del archivo.iso No newline at end of file |
|
265 | 266 | file_dat=var_Rpath_ppath+"/"+self.var_Elabel+"_"+i2s(self.var_disc_n)+".dat" No newline at end of file |
|
266 | 267 | file_iso=var_Rpath_iso+"/"+i2s(self.var_disc_n)+".iso" No newline at end of file |
|
267 | 268 | var_cmd = 'genisoimage -hide-joliet-trans-tbl -joliet-long -r ' No newline at end of file |
|
268 | 269 | var_cmd += ' -A '+self.var_Elabel+' -V '+self.var_Elabel No newline at end of file |
|
269 | 270 | var_cmd += ' -graft-points -path-list '+ file_dat+' -o '+file_iso No newline at end of file |
|
270 | 271 | return var_cmd No newline at end of file |
|
271 | 272 | No newline at end of file |
|
272 | 273 | def cmd_burn(self): No newline at end of file |
|
273 | 274 | var_Rpath_iso=self.var_Rpath+"/iso" |
|
275 | No newline at end of file | |
|
274 | file_iso=var_Rpath_iso+"/"+functions.i2s(self.var_disc_n)+".iso" No newline at end of file | |
|
275 | 276 | No newline at end of file |
|
276 | 277 | var_index = ( ( (self.var_disc_n - 1) * self.var_Copys) + (self.var_copy_n - 1) - self.var_burned_discs ) % len(self.var_devices) No newline at end of file |
|
277 | 278 | var_dev_tmp = self.var_devices[var_index] No newline at end of file |
|
278 | 279 | No newline at end of file |
|
279 | 280 | var_cmd = "wodim -v dev="+var_dev_tmp+" speed=16 "+ file_iso No newline at end of file |
|
280 | 281 | return var_cmd No newline at end of file |
|
281 | 282 | No newline at end of file |
|
283 | def cmd_check(self): | |
|
No newline at end of file | ||
|
284 | var_cmd = "echo 'function check'" | |
|
No newline at end of file | ||
|
285 | return var_cmd | |
|
No newline at end of file | ||
|
286 | No newline at end of file | |
|
282 | 287 | def remove_iso(self): No newline at end of file |
|
283 | 288 | var_Rpath_iso=self.var_Rpath+"/iso" |
|
289 | No newline at end of file | |
|
284 | file_iso=var_Rpath_iso+"/"+functions.i2s(self.var_disc_n)+".iso" | |
|
No newline at end of file | ||
|
290 | No newline at end of file | |
|
285 | ||
|
No newline at end of file | ||
|
286 | self.txtInfo.append("Deleting iso file: "+functions.i2s(self.var_disc_n)+".iso") | |
|
No newline at end of file | ||
|
287 | No newline at end of file | |
|
288 | 291 | if os.path.isfile(file_iso): No newline at end of file |
|
289 | 292 | os.remove(file_iso) No newline at end of file |
|
290 | 293 | No newline at end of file |
|
291 | 294 | #Si es el ultimo disco se termina el proceso No newline at end of file |
|
292 | 295 | def is_last_disc_and_copy(self): No newline at end of file |
|
293 | 296 | if self.var_disc_n == self.var_Discs and self.var_copy_n == self.var_Copys: No newline at end of file |
|
294 | 297 | self.function_final() No newline at end of file |
|
295 | 298 | else: No newline at end of file |
|
296 | 299 | next_disc(self) No newline at end of file |
|
297 | 300 | No newline at end of file |
|
298 | 301 | #Define cual es el siguiente disco a grabar y que paso seguir No newline at end of file |
|
299 | 302 | def next_disc(self, error = False): No newline at end of file |
|
300 | 303 | if self.var_copy_n == self.var_Copys: No newline at end of file |
|
304 | #borrado del iso | |
|
No newline at end of file | ||
|
305 | self.txtInfo.append("Deleting iso file: "+i2s(self.var_disc_n)+".iso") | |
|
No newline at end of file | ||
|
306 | remove_iso(self) | |
|
No newline at end of file | ||
|
307 | No newline at end of file | |
|
301 | 308 | self.var_disc_n += 1 No newline at end of file |
|
302 | 309 | self.var_copy_n = 1 No newline at end of file |
|
303 | 310 | self.var_step = 0 No newline at end of file |
|
304 | 311 | No newline at end of file |
|
305 | 312 | else: No newline at end of file |
|
306 | 313 | self.var_copy_n += 1 No newline at end of file |
|
307 | 314 | self.var_step = 1 No newline at end of file |
|
315 | ||
|
No newline at end of file | ||
|
316 | functions2.make_burning_conf(self) # Si el proceso no ha sido detenido manualmente | |
|
No newline at end of file | ||
|
317 | #crea el archivo burning.conf para el seguimiento de los discos grabados No newline at end of file | |
|
308 | 318 |
|
|
309 | 319 | var_index = ( ( (self.var_disc_n - 1) * self.var_Copys) + (self.var_copy_n - 1) - self.var_burned_discs ) % len(self.var_devices) No newline at end of file |
|
310 | 320 | No newline at end of file |
|
311 | 321 | self.txtInfo.append("NEXT DISC: "+str(self.var_disc_n)+" COPY: "+str(self.var_copy_n) No newline at end of file |
|
312 | 322 | +" INDEX: "+str(var_index)+" STEP: "+str(self.var_step)) No newline at end of file |
|
313 | 323 | self.txtInfo.append("\n") No newline at end of file |
|
314 | 324 | No newline at end of file |
|
315 | 325 | if var_index == 0 : No newline at end of file |
|
316 | 326 | self.function_eject() No newline at end of file |
|
317 | 327 | No newline at end of file |
|
318 | 328 | elif self.var_step == 0: No newline at end of file |
|
319 | 329 | self.function_iso() No newline at end of file |
|
320 | 330 | elif self.var_step == 1: No newline at end of file |
|
321 | 331 | self.function_burn() No newline at end of file |
@@ -1,246 +1,246 | |||
|
1 | 1 | # -*- coding: utf-8 -*- No newline at end of file |
|
2 | 2 | No newline at end of file |
|
3 | 3 | No newline at end of file |
|
4 | 4 | from subprocess import * No newline at end of file |
|
5 | 5 | import sys No newline at end of file |
|
6 | 6 | import os No newline at end of file |
|
7 | 7 | import subprocess No newline at end of file |
|
8 | 8 | import commands No newline at end of file |
|
9 | 9 | No newline at end of file |
|
10 | 10 | #----------------------------------------------------- Deteccion de los dispositivos de grabacion --------------------------------------------------------------- No newline at end of file |
|
11 | 11 | No newline at end of file |
|
12 | 12 | def detect_devices(self): No newline at end of file |
|
13 | 13 | """ No newline at end of file |
|
14 | 14 | Deteccion de los dispositvos de grabacion No newline at end of file |
|
15 | 15 | """ No newline at end of file |
|
16 | 16 | #var_cmd="wodim --devices | grep /dev/ | awk -F\' '{print $2}'" #Funciona en consola pero no en python ΒΏ? No newline at end of file |
|
17 | 17 | var_cmd="wodim --devices | grep /dev/ | awk '{print $2}' | awk -F= '{print $2}'" No newline at end of file |
|
18 | 18 | No newline at end of file |
|
19 | 19 | var_output = commands.getstatusoutput(var_cmd) No newline at end of file |
|
20 | 20 | if var_output[0] != 0: No newline at end of file |
|
21 | 21 | self.txtInfo.append("No recording devices") No newline at end of file |
|
22 | 22 | else: No newline at end of file |
|
23 | 23 | var_devices = var_output[1].split('\n') No newline at end of file |
|
24 | 24 | No newline at end of file |
|
25 | 25 | var_tmp=[] No newline at end of file |
|
26 | 26 | for i in range(0, 4): No newline at end of file |
|
27 | 27 | if i < len(var_devices): No newline at end of file |
|
28 | 28 | var_len = len(var_devices[i]) No newline at end of file |
|
29 | 29 | var_tmp.append(var_devices[i][1:var_len - 1]) No newline at end of file |
|
30 | 30 | else: No newline at end of file |
|
31 | 31 | var_tmp.append('') No newline at end of file |
|
32 | 32 | No newline at end of file |
|
33 | 33 | #Se escriben los dispostivos correspodientes, si existen No newline at end of file |
|
34 | 34 | self.txtDeviceA.setText(str(var_tmp[0])) No newline at end of file |
|
35 | 35 | self.txtDeviceB.setText(str(var_tmp[1])) No newline at end of file |
|
36 | 36 | self.txtDeviceC.setText(str(var_tmp[2])) No newline at end of file |
|
37 | 37 | self.txtDeviceD.setText(str(var_tmp[3])) No newline at end of file |
|
38 | 38 | #Se desactivan los que no existen No newline at end of file |
|
39 | 39 | if len(var_tmp[0]) == 0 : No newline at end of file |
|
40 | 40 | self.chkDevA.setChecked(False) No newline at end of file |
|
41 | 41 | self.chkDevA.setEnabled(False) No newline at end of file |
|
42 | 42 | if len(var_tmp[1]) == 0 : No newline at end of file |
|
43 | 43 | self.chkDevB.setChecked(False) No newline at end of file |
|
44 | 44 | self.chkDevB.setEnabled(False) No newline at end of file |
|
45 | 45 | if len(var_tmp[2]) == 0 : No newline at end of file |
|
46 | 46 | self.chkDevC.setChecked(False) No newline at end of file |
|
47 | 47 | self.chkDevC.setEnabled(False) No newline at end of file |
|
48 | 48 | if len(var_tmp[3]) == 0 : No newline at end of file |
|
49 | 49 | self.chkDevD.setChecked(False) No newline at end of file |
|
50 | 50 | self.chkDevD.setEnabled(False) No newline at end of file |
|
51 | 51 | No newline at end of file |
|
52 | 52 | #----------------------------------- expulsa los dispositivos de grabacion -------------------------------------------- No newline at end of file |
|
53 | 53 | No newline at end of file |
|
54 | 54 | def eject_devices(self): No newline at end of file |
|
55 | 55 | for var_dev in self.var_devices: No newline at end of file |
|
56 | 56 | var_cmd = 'eject ' + var_dev No newline at end of file |
|
57 | 57 | commands.getstatusoutput(var_cmd) No newline at end of file |
|
58 | 58 | No newline at end of file |
|
59 | 59 | #----------------------------------- listado de los dispositivos de grabacion seleccionados -------------------------------------------- No newline at end of file |
|
60 | 60 | No newline at end of file |
|
61 | 61 | def selected_devices(self): No newline at end of file |
|
62 | 62 | self.var_devices=[] No newline at end of file |
|
63 | 63 | if self.chkDevA.isChecked(): No newline at end of file |
|
64 | 64 | self.var_devices.append(str(self.txtDeviceA.text())) No newline at end of file |
|
65 | 65 | if self.chkDevB.isChecked(): No newline at end of file |
|
66 | 66 | self.var_devices.append(str(self.txtDeviceB.text())) No newline at end of file |
|
67 | 67 | if self.chkDevC.isChecked(): No newline at end of file |
|
68 | 68 | self.var_devices.append(str(self.txtDeviceC.text())) No newline at end of file |
|
69 | 69 | if self.chkDevD.isChecked(): No newline at end of file |
|
70 | 70 | self.var_devices.append(str(self.txtDeviceD.text())) No newline at end of file |
|
71 | 71 | No newline at end of file |
|
72 | 72 | if len(self.var_devices) == 0: No newline at end of file |
|
73 | 73 | return False No newline at end of file |
|
74 | 74 | else: No newline at end of file |
|
75 | 75 | return True No newline at end of file |
|
76 | 76 | No newline at end of file |
|
77 | 77 | No newline at end of file |
|
78 | 78 | #----------------------------------------------------- Inicializacion para pruebas--------------------------------------------------------------- No newline at end of file |
|
79 | 79 | No newline at end of file |
|
80 | 80 | def set_parameters_test(self): No newline at end of file |
|
81 | 81 | """ No newline at end of file |
|
82 | 82 | Se usa para inicializar ciertos parametros para pruebas No newline at end of file |
|
83 | 83 | """ No newline at end of file |
|
84 | 84 | self.txtDpath.setText('/home/ricardoar/optional/STORAGE/EW_DRIFTS') No newline at end of file |
|
85 | 85 | self.txtRpath.setText('/home/ricardoar/optional/prueba1_jro_backup_manager') No newline at end of file |
|
86 | 86 | self.txtElabel.setText('EW_DRIFTS_pruebas') No newline at end of file |
|
87 | 87 | self.lstDcapacity.setCurrentIndex(4) No newline at end of file |
|
88 | 88 | self.txtDcapacity.setValue(100.0) No newline at end of file |
|
89 | 89 | self.txtDcapacity.setReadOnly(False) No newline at end of file |
|
90 | 90 | No newline at end of file |
|
91 | 91 | def set_devices_test(self): No newline at end of file |
|
92 | 92 | self.txtDeviceA.setText("/dev/scd0") No newline at end of file |
|
93 | 93 | self.txtDeviceB.setText("/dev/scd1") No newline at end of file |
|
94 | 94 | self.txtDeviceC.setText("/dev/scd2") No newline at end of file |
|
95 | 95 | self.txtDeviceD.setText("/dev/scd3") No newline at end of file |
|
96 | 96 | No newline at end of file |
|
97 | 97 | No newline at end of file |
|
98 | 98 | No newline at end of file |
|
99 | 99 | #----------------------------------------------------- crea parameters.conf --------------------------------------------------------------- No newline at end of file |
|
100 | 100 | No newline at end of file |
|
101 | 101 | def make_parameters_conf(self): No newline at end of file |
|
102 | 102 | var_file = open("parameters.conf","w") No newline at end of file |
|
103 | 103 | var_file.write(self.var_Dpath+"\n") #0 Ruta de los datos No newline at end of file |
|
104 | 104 | var_file.write(self.var_Rpath+"\n") #1 Ruta del proyecto No newline at end of file |
|
105 | 105 | var_file.write(str(self.var_lstDtype)+"\n") #2 opcion Data Type No newline at end of file |
|
106 | 106 | var_file.write(self.var_Dtype+"\n") #3 extension Data Type No newline at end of file |
|
107 | 107 | var_file.write(self.var_Elabel+"\n") #4 etiqueta No newline at end of file |
|
108 | 108 | var_file.write(str(self.var_Copys)+"\n") #5 Numero de copias No newline at end of file |
|
109 | 109 | var_file.write(str(self.var_lstDcapacity)+"\n") #6 opcion Device Capacity No newline at end of file |
|
110 | 110 | var_file.write(str(self.var_Dcapacity)+"\n") #7 tamaΓ±o Device Capacity No newline at end of file |
|
111 | 111 | var_file.write(str(self.var_Discs)+"\n") #8 Numero de discos a grabar No newline at end of file |
|
112 | 112 | # var_file.write(str(self.lstStartDay.currentIndex())+"\n") #9 Indice fecha inicial No newline at end of file |
|
113 | 113 | # var_file.write(str(self.lstStopDay.currentIndex())+"\n") #10 Indice fecha final No newline at end of file |
|
114 | 114 | var_file.close() No newline at end of file |
|
115 | 115 | No newline at end of file |
|
116 | 116 | #----------------------------------------------------- carga parameters.conf --------------------------------------------------------------- No newline at end of file |
|
117 | 117 | No newline at end of file |
|
118 | 118 | def get_parameters_conf(self): No newline at end of file |
|
119 | 119 | var_file = open("parameters.conf","r") No newline at end of file |
|
120 | 120 | lines = var_file.readlines() No newline at end of file |
|
121 | 121 | self.txtDpath.setText(lines[0][:-1]) #0 No newline at end of file |
|
122 | 122 | self.txtRpath.setText(lines[1][:-1]) #1 No newline at end of file |
|
123 | 123 | self.lstDtype.setCurrentIndex(int(lines[2])) #2 No newline at end of file |
|
124 | 124 | self.txtDtype.setText(lines[3][:-1]) #3 No newline at end of file |
|
125 | 125 | self.txtElabel.setText(lines[4][:-1]) #4 No newline at end of file |
|
126 | 126 | self.txtCopys.setValue(int(lines[5][:-1])) #5 No newline at end of file |
|
127 | 127 | self.lstDcapacity.setCurrentIndex(int(lines[6])) #6 No newline at end of file |
|
128 | 128 | self.txtDcapacity.setValue(float(lines[7])) #7 No newline at end of file |
|
129 | 129 | self.var_Discs = int(lines[8]) #8 No newline at end of file |
|
130 | 130 | # var_StartDay = int(lines[6]) #9 No newline at end of file |
|
131 | 131 | # var_StopDay = int(lines[7]) #10 No newline at end of file |
|
132 | 132 | ################################ No newline at end of file |
|
133 | 133 | self.var_Copys = self.txtCopys.value() #5 No newline at end of file |
|
134 | 134 | ################################ No newline at end of file |
|
135 | 135 | No newline at end of file |
|
136 | 136 | var_file.close() No newline at end of file |
|
137 | 137 | No newline at end of file |
|
138 | 138 | No newline at end of file |
|
139 | 139 | #-------------------------- actualiza el valor de las variables con los parametros seleccionados ----------------------------- No newline at end of file |
|
140 | 140 | No newline at end of file |
|
141 | 141 | def set_vars(self): No newline at end of file |
|
142 | 142 | self.var_Dpath = str(self.txtDpath.text()) #0 No newline at end of file |
|
143 | 143 | self.var_Rpath = str(self.txtRpath.text()) #1 No newline at end of file |
|
144 | 144 | self.var_lstDtype = self.lstDtype.currentIndex() #2 No newline at end of file |
|
145 | 145 | self.var_Dtype = str(self.txtDtype.text()) #3 No newline at end of file |
|
146 | 146 | self.var_Elabel = str(self.txtElabel.text()) #4 No newline at end of file |
|
147 | 147 | self.var_Copys = self.txtCopys.value() #5 No newline at end of file |
|
148 | 148 | self.var_lstDcapacity = self.lstDcapacity.currentIndex() #6 No newline at end of file |
|
149 | 149 | self.var_Dcapacity = self.txtDcapacity.value() #7 No newline at end of file |
|
150 | 150 | self.var_Discs = self.var_Discs #8 No newline at end of file |
|
151 | 151 | No newline at end of file |
|
152 | 152 | No newline at end of file |
|
153 | 153 | #-------------------------- crea burning.conf ----------------------------- No newline at end of file |
|
154 | 154 | No newline at end of file |
|
155 | 155 | def make_burning_conf(self): No newline at end of file |
|
156 | 156 | var_file = open("burning.conf","w") |
|
157 | No newline at end of file | |
|
157 | var_n_burned_discs = ( ( (self.var_disc_n - 1) * self.var_Copys) + self.var_copy_n -1 ) No newline at end of file | |
|
158 | 158 | var_file.write(str(var_n_burned_discs)+"\n") #0 Numero de discos ya grabados No newline at end of file |
|
159 | 159 | var_file.write(str(self.var_disc_n)+"\n") #1 Disco actual para grabar No newline at end of file |
|
160 | 160 | var_file.write(str(self.var_copy_n)+"\n") #2 Numero de copia actual para grabar No newline at end of file |
|
161 | 161 | var_file.close() No newline at end of file |
|
162 | 162 | No newline at end of file |
|
163 | 163 | #----------------------------------------------------- carga burning.conf --------------------------------------------------------------- No newline at end of file |
|
164 | 164 | No newline at end of file |
|
165 | 165 | def get_burning_conf(self): No newline at end of file |
|
166 | 166 | var_file = open("burning.conf","r") No newline at end of file |
|
167 | 167 | lines = var_file.readlines() No newline at end of file |
|
168 | 168 | self.var_burned_discs = int(lines[0]) #0 No newline at end of file |
|
169 | 169 | self.var_disc_n = int(lines[1]) No newline at end of file |
|
170 | 170 | self.var_copy_n = int(lines[2]) No newline at end of file |
|
171 | 171 | var_file.close() No newline at end of file |
|
172 | 172 | No newline at end of file |
|
173 | 173 | #---------------------------------------------- Habilitacion y deshabilitacion de items ------------------------------------------------------- No newline at end of file |
|
174 | 174 | No newline at end of file |
|
175 | 175 | def enabled_items1(var_bool, self): No newline at end of file |
|
176 | 176 | self.tabParameters.setEnabled(not(var_bool)) No newline at end of file |
|
177 | 177 | self.lstDcapacity.setEnabled(not(var_bool)) No newline at end of file |
|
178 | 178 | self.txtDcapacity.setEnabled(not(var_bool)) No newline at end of file |
|
179 | 179 | self.actionChange_Parameters.setEnabled(var_bool) No newline at end of file |
|
180 | 180 | self.btnGbkp.setEnabled(not(var_bool)) No newline at end of file |
|
181 | 181 | self.btnRestart.setEnabled(var_bool) No newline at end of file |
|
182 | 182 | self.btnStartburn.setEnabled(var_bool) No newline at end of file |
|
183 | 183 | No newline at end of file |
|
184 | 184 | No newline at end of file |
|
185 | 185 | def enabled_items2(var_bool, self): No newline at end of file |
|
186 | 186 | self.btnRestart.setEnabled(not(var_bool)) No newline at end of file |
|
187 | 187 | self.btnStartburn.setEnabled(not(var_bool)) No newline at end of file |
|
188 | 188 | self.btnStopburn.setEnabled(var_bool) No newline at end of file |
|
189 | 189 | self.chkCheck.setEnabled(not(var_bool)) No newline at end of file |
|
190 | 190 | self.actionChange_Parameters.setEnabled(False) No newline at end of file |
|
191 | 191 | No newline at end of file |
|
192 | 192 | No newline at end of file |
|
193 | 193 | No newline at end of file |
|
194 | 194 | No newline at end of file |
|
195 | 195 | #---------------------------------------------- Actualiza estado en los labels ------------------------------------------------------- No newline at end of file |
|
196 | 196 | No newline at end of file |
|
197 | 197 | def update_message(type, message, self, index=0): No newline at end of file |
|
198 | 198 | if index == 0: No newline at end of file |
|
199 | 199 | var_index = ( ( (self.var_disc_n - 1) * self.var_Copys) + (self.var_copy_n - 1) - self.var_burned_discs ) % len(self.var_devices) No newline at end of file |
|
200 | 200 | else: No newline at end of file |
|
201 | 201 | var_index = index No newline at end of file |
|
202 | 202 | No newline at end of file |
|
203 | 203 | var_message = message No newline at end of file |
|
204 | 204 | # var_message = "BURNING" No newline at end of file |
|
205 | 205 | # var_message = "COMPLETED" No newline at end of file |
|
206 | 206 | # var_message = "ERROR" No newline at end of file |
|
207 | 207 | # var_message = "CHECKING" No newline at end of file |
|
208 | 208 | # var_message = "CHECKED" No newline at end of file |
|
209 | 209 | No newline at end of file |
|
210 | 210 | if type == 1: No newline at end of file |
|
211 | 211 | No newline at end of file |
|
212 | 212 | if var_index == 0: No newline at end of file |
|
213 | 213 | self.txtBstatusA.setText(var_message) No newline at end of file |
|
214 | 214 | self.txtBdiscA.setText(str(self.var_disc_n)) No newline at end of file |
|
215 | 215 | self.txtBcopyA.setText(str(self.var_copy_n)) No newline at end of file |
|
216 | 216 | No newline at end of file |
|
217 | 217 | if var_index == 1: No newline at end of file |
|
218 | 218 | self.txtBstatusB.setText(var_message) No newline at end of file |
|
219 | 219 | self.txtBdiscB.setText(str(self.var_disc_n)) No newline at end of file |
|
220 | 220 | self.txtBcopyB.setText(str(self.var_copy_n)) No newline at end of file |
|
221 | 221 | No newline at end of file |
|
222 | 222 | if var_index == 2: No newline at end of file |
|
223 | 223 | self.txtBstatusC.setText(var_message) No newline at end of file |
|
224 | 224 | self.txtBdiscC.setText(str(self.var_disc_n)) No newline at end of file |
|
225 | 225 | self.txtBcopyC.setText(str(self.var_copy_n)) No newline at end of file |
|
226 | 226 | No newline at end of file |
|
227 | 227 | if var_index == 3: No newline at end of file |
|
228 | 228 | self.txtBstatusD.setText(var_message) No newline at end of file |
|
229 | 229 | self.txtBdiscD.setText(str(self.var_disc_n)) No newline at end of file |
|
230 | 230 | self.txtBcopyD.setText(str(self.var_copy_n)) No newline at end of file |
|
231 | 231 | No newline at end of file |
|
232 | 232 | if type == 2: No newline at end of file |
|
233 | 233 | No newline at end of file |
|
234 | 234 | if var_index == 0: No newline at end of file |
|
235 | 235 | self.txtCHstatusA.setText(var_message) No newline at end of file |
|
236 | 236 | No newline at end of file |
|
237 | 237 | if var_index == 1: No newline at end of file |
|
238 | 238 | self.txtCHstatusB.setText(var_message) No newline at end of file |
|
239 | 239 | No newline at end of file |
|
240 | 240 | if var_index == 2: No newline at end of file |
|
241 | 241 | self.txtCHstatusC.setText(var_message) No newline at end of file |
|
242 | 242 | No newline at end of file |
|
243 | 243 | if var_index == 3: No newline at end of file |
|
244 | 244 | self.txtCHstatusD.setText(var_message) No newline at end of file |
|
245 | 245 | No newline at end of file |
|
246 | 246 | No newline at end of file |
@@ -1,607 +1,616 | |||
|
1 | 1 | # -*- coding: utf-8 -*- No newline at end of file |
|
2 | 2 | No newline at end of file |
|
3 | 3 | """ No newline at end of file |
|
4 | 4 | Module implementing MainWindow. No newline at end of file |
|
5 | 5 | """ No newline at end of file |
|
6 | 6 | No newline at end of file |
|
7 | 7 | from PyQt4.QtGui import QMainWindow No newline at end of file |
|
8 | 8 | from PyQt4.QtCore import pyqtSignature No newline at end of file |
|
9 | 9 | from PyQt4 import QtCore No newline at end of file |
|
10 | 10 | from Ui_MainWindow import Ui_MainWindow No newline at end of file |
|
11 | 11 | from Ui_Parameters import Ui_Parameters No newline at end of file |
|
12 | 12 | from Ui_About import Ui_About No newline at end of file |
|
13 | 13 | from PyQt4 import QtGui No newline at end of file |
|
14 | 14 | from subprocess import * No newline at end of file |
|
15 | 15 | import sys No newline at end of file |
|
16 | 16 | import os No newline at end of file |
|
17 | 17 | #import subprocess No newline at end of file |
|
18 | 18 | import time No newline at end of file |
|
19 | 19 | import commands No newline at end of file |
|
20 | 20 | from functions import functions No newline at end of file |
|
21 | 21 | from functions import functions2 No newline at end of file |
|
22 | 22 | No newline at end of file |
|
23 | 23 | class MainWindow(QMainWindow, Ui_MainWindow): No newline at end of file |
|
24 | 24 | """ No newline at end of file |
|
25 | 25 | Class documentation goes here. No newline at end of file |
|
26 | 26 | """ No newline at end of file |
|
27 | 27 | No newline at end of file |
|
28 | 28 | def __init__(self, parent = None): No newline at end of file |
|
29 | 29 | QMainWindow.__init__(self, parent) No newline at end of file |
|
30 | 30 | self.setupUi(self) No newline at end of file |
|
31 | 31 | self.setupUi2() No newline at end of file |
|
32 | 32 | No newline at end of file |
|
33 | 33 | def setupUi2(self): No newline at end of file |
|
34 | 34 | |
|
35 | No newline at end of file | |
|
35 | self.var_real = False | |
|
No newline at end of file | ||
|
36 | No newline at end of file | |
|
36 | No newline at end of file | |
|
No newline at end of file | ||
|
37 | self.var_real_check = False | |
|
No newline at end of file | ||
|
38 | self.var_real_eject = False No newline at end of file | |
|
37 | 39 | # Reconocimiento de los dispositivos de grabacion No newline at end of file |
|
38 | 40 | # functions2.detect_devices(self) #busca los dispositivos de grabacion No newline at end of file |
|
39 | 41 | #################################### No newline at end of file |
|
40 | 42 | functions2.set_devices_test(self) ############ No newline at end of file |
|
41 | 43 | #################################### No newline at end of file |
|
42 | 44 | No newline at end of file |
|
43 | 45 | #Inicialiazacion de variables No newline at end of file |
|
44 | 46 | self.var_Discs = 0 #Numero de discos del proyecto No newline at end of file |
|
45 | 47 | self.var_Copys = 0 #Numero de copias No newline at end of file |
|
46 | 48 | self.var_disc_n = 0 # disco actual No newline at end of file |
|
47 | 49 | self.var_copy_n = 0 # copia actual No newline at end of file |
|
48 | 50 | self.var_burned_discs = 0 #numero de discos ya grabados No newline at end of file |
|
49 | 51 | No newline at end of file |
|
50 | 52 | self.bool_first_iso = False No newline at end of file |
|
51 | 53 | self.var_step = 0 # numero de paso en el proceso No newline at end of file |
|
52 | 54 | self.bool_state_burning = False #si es True se puede grabar No newline at end of file |
|
53 | 55 | self.blank_discs = False # Si es true significa que se acaban de ingresar discos en blanco No newline at end of file |
|
54 | 56 | No newline at end of file |
|
55 | 57 | self.var_list=[] # Lista de DOYs No newline at end of file |
|
56 | 58 | self.var_sublist=[] # Sub-lista de DOYs seleccionados No newline at end of file |
|
57 | 59 | self.var_devices=[] #Lista de dispositivos seleccionados No newline at end of file |
|
58 | 60 | No newline at end of file |
|
59 | 61 | #Revisa si existe el archivo de confirguracion y lo carga No newline at end of file |
|
60 | 62 | if os.path.isfile("parameters.conf"): No newline at end of file |
|
61 | 63 | functions2.get_parameters_conf(self) No newline at end of file |
|
62 | 64 | self.bool_first_iso = True No newline at end of file |
|
63 | 65 | self.txtInfo.append("Parameters were loaded from configuration file") No newline at end of file |
|
64 | 66 | self.txtInfo.append("Total number of discs for recording: "+str(self.var_Discs * self.var_Copys)) No newline at end of file |
|
65 | 67 | No newline at end of file |
|
66 | 68 | else: No newline at end of file |
|
67 | 69 | functions2.set_parameters_test(self) #Establece ciertos parametros, para pruebas No newline at end of file |
|
68 | 70 | No newline at end of file |
|
69 | 71 | functions2.set_vars(self) #Carga las variables de la clase con los parametros seleccionados No newline at end of file |
|
70 | 72 | No newline at end of file |
|
71 | 73 | self.statusDpath = functions.dir_exists(self.var_Dpath, self) No newline at end of file |
|
72 | 74 | self.statusRpath = functions.dir_exists(self.var_Rpath, self) No newline at end of file |
|
73 | 75 | functions.load_days(self) No newline at end of file |
|
74 | 76 | No newline at end of file |
|
75 | 77 | if os.path.isfile("parameters.conf"): No newline at end of file |
|
76 | 78 | functions2.enabled_items1(True, self) #Se bloquean los parametros de configuracion No newline at end of file |
|
77 | 79 | No newline at end of file |
|
78 | 80 | if os.path.isfile("burning.conf"): No newline at end of file |
|
79 | 81 | functions2.get_burning_conf(self) No newline at end of file |
|
80 | 82 | self.txtInfo.append("Current disc: "+str(self.var_disc_n)) No newline at end of file |
|
81 | 83 | self.txtInfo.append("Current copy: "+str(self.var_copy_n)) No newline at end of file |
|
82 | 84 | self.txtInfo.append("Burned discs: "+str(self.var_burned_discs)) No newline at end of file |
|
83 | 85 | self.btnStartburn.setText("Continue") |
|
86 | No newline at end of file | |
|
84 | ||
|
No newline at end of file | ||
|
85 | No newline at end of file | |
|
86 | 87 | No newline at end of file |
|
87 | 88 | self.connect(self.actionChange_Parameters, QtCore.SIGNAL("triggered()"), self.changeParameters) No newline at end of file |
|
88 | 89 | self.connect(self.actionAbout, QtCore.SIGNAL("triggered()"), self.about) No newline at end of file |
|
89 | 90 | No newline at end of file |
|
90 | 91 | self.process_iso = QtCore.QProcess() No newline at end of file |
|
91 | 92 | self.connect(self.process_iso, QtCore.SIGNAL('readyReadStandardOutput()'), self.readOuput_iso) No newline at end of file |
|
92 | 93 | self.connect(self.process_iso, QtCore.SIGNAL('readyReadStandardError()'), self.readError_iso) No newline at end of file |
|
93 | 94 | self.connect(self.process_iso, QtCore.SIGNAL('finished(int,QProcess::ExitStatus)'), self.finished_iso) No newline at end of file |
|
94 | 95 | No newline at end of file |
|
95 | 96 | self.process_burn = QtCore.QProcess() No newline at end of file |
|
96 | 97 | self.connect(self.process_burn, QtCore.SIGNAL('readyReadStandardOutput()'), self.readOuput_burn) No newline at end of file |
|
97 | 98 | self.connect(self.process_burn, QtCore.SIGNAL('readyReadStandardError()'), self.readError_burn) No newline at end of file |
|
98 | 99 | self.connect(self.process_burn, QtCore.SIGNAL('finished(int,QProcess::ExitStatus)'), self.finished_burn) No newline at end of file |
|
99 | 100 | No newline at end of file |
|
100 | 101 | self.process_check = QtCore.QProcess() No newline at end of file |
|
101 | 102 | self.connect(self.process_check, QtCore.SIGNAL('readyReadStandardOutput()'), self.readOuput_check) No newline at end of file |
|
102 | 103 | self.connect(self.process_check, QtCore.SIGNAL('readyReadStandardError()'), self.readError_check) No newline at end of file |
|
103 | 104 | self.connect(self.process_check, QtCore.SIGNAL('finished(int,QProcess::ExitStatus)'), self.finished_check) No newline at end of file |
|
104 | 105 | No newline at end of file |
|
105 | 106 | No newline at end of file |
|
106 | 107 | def changeParameters(self): No newline at end of file |
|
107 | 108 | dlg=QtGui.QDialog() No newline at end of file |
|
108 | 109 | dlgui=Ui_Parameters() No newline at end of file |
|
109 | 110 | dlgui.setupUi(dlg) No newline at end of file |
|
110 | 111 | if (dlg.exec_() == QtGui.QDialog.Accepted): No newline at end of file |
|
111 | 112 | if dlgui.txtDisc.value() > self.var_Discs or dlgui.txtCopy.value() > dlgui.txtNcopys.value(): No newline at end of file |
|
112 | 113 | self.txtInfo.append("Wrong parameters") No newline at end of file |
|
113 | 114 | else: No newline at end of file |
|
114 | 115 | self.var_Copys = dlgui.txtNcopys.value() No newline at end of file |
|
115 | 116 | self.var_disc_n = dlgui.txtDisc.value() No newline at end of file |
|
116 | 117 | self.var_copy_n = dlgui.txtCopy.value() No newline at end of file |
|
117 | 118 | self.txtInfo.append("Changed parameters") No newline at end of file |
|
118 | 119 | self.var_burned_discs = ( ( (self.var_disc_n - 1) * self.var_Copys) + self.var_copy_n -1 ) No newline at end of file |
|
119 | 120 | self.bool_first_iso = True No newline at end of file |
|
121 | self.txtInfo.append("Current disc: "+str(self.var_disc_n)) | |
|
No newline at end of file | ||
|
122 | self.txtInfo.append("Current copy: "+str(self.var_copy_n)) | |
|
No newline at end of file | ||
|
123 | self.txtInfo.append("Nro Copys: "+str(self.var_Copys)) | |
|
No newline at end of file | ||
|
124 | functions2.make_parameters_conf(self) | |
|
No newline at end of file | ||
|
125 | self.txtCopys.setValue(self.var_Copys) #Actualizo mananualmente el valor Copys No newline at end of file | |
|
120 | 126 | No newline at end of file |
|
121 | 127 | No newline at end of file |
|
122 | 128 | No newline at end of file |
|
123 | 129 | def about(self): No newline at end of file |
|
124 | 130 | dlg_about=QtGui.QDialog() No newline at end of file |
|
125 | 131 | dlgui_about=Ui_About() No newline at end of file |
|
126 | 132 | dlgui_about.setupUi(dlg_about) No newline at end of file |
|
127 | 133 | dlg_about.exec_() No newline at end of file |
|
128 | 134 | No newline at end of file |
|
129 | 135 | No newline at end of file |
|
130 | 136 | #============================================================================== No newline at end of file |
|
131 | 137 | # Manejo de los eventos No newline at end of file |
|
132 | 138 | #============================================================================== No newline at end of file |
|
133 | 139 | No newline at end of file |
|
134 | 140 | #----------------------------------------------------- Obtencion de la ruta de los datos --------------------------------------------------------------- No newline at end of file |
|
135 | 141 | No newline at end of file |
|
136 | 142 | @pyqtSignature("") No newline at end of file |
|
137 | 143 | def on_btnDpath_clicked(self): No newline at end of file |
|
138 | 144 | """ No newline at end of file |
|
139 | 145 | Permite seleccionar graficamente el direcorio de los datos a grabar No newline at end of file |
|
140 | 146 | """ No newline at end of file |
|
141 | 147 | self.var_Dpath= str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) No newline at end of file |
|
142 | 148 | self.txtDpath.setText(self.var_Dpath) No newline at end of file |
|
143 | 149 | self.statusDpath = functions.dir_exists(self.var_Dpath, self) No newline at end of file |
|
144 | 150 | functions.load_days(self) No newline at end of file |
|
145 | 151 | No newline at end of file |
|
146 | 152 | No newline at end of file |
|
147 | 153 | @pyqtSignature("") No newline at end of file |
|
148 | 154 | def on_txtDpath_editingFinished(self): No newline at end of file |
|
149 | 155 | """ No newline at end of file |
|
150 | 156 | Carga la ruta editada y verifica que sea correcta y carga la lista de dias No newline at end of file |
|
151 | 157 | """ No newline at end of file |
|
152 | 158 | self.var_Dpath=str(self.txtDpath.text()) #Se carga la variable con la ruta recien editada No newline at end of file |
|
153 | 159 | self.statusDpath = functions.dir_exists(self.var_Dpath, self) No newline at end of file |
|
154 | 160 | functions.load_days(self) No newline at end of file |
|
155 | 161 | No newline at end of file |
|
156 | 162 | No newline at end of file |
|
157 | 163 | #----------------------------------------------------- Obtencion de las ruta del proyecto --------------------------------------------------------------- No newline at end of file |
|
158 | 164 | No newline at end of file |
|
159 | 165 | @pyqtSignature("") No newline at end of file |
|
160 | 166 | def on_btnRpath_clicked(self): No newline at end of file |
|
161 | 167 | """ No newline at end of file |
|
162 | 168 | Permite seleccionar graficamente el direcorio del proyecto No newline at end of file |
|
163 | 169 | """ No newline at end of file |
|
164 | 170 | self.var_Rpath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) No newline at end of file |
|
165 | 171 | self.txtRpath.setText(self.var_Rpath) No newline at end of file |
|
166 | 172 | self.statusRpath = functions.dir_exists(self.var_Rpath, self) No newline at end of file |
|
167 | 173 | No newline at end of file |
|
168 | 174 | No newline at end of file |
|
169 | 175 | @pyqtSignature("") No newline at end of file |
|
170 | 176 | def on_txtRpath_editingFinished(self): No newline at end of file |
|
171 | 177 | """ No newline at end of file |
|
172 | 178 | Valida la ruta del proyecto No newline at end of file |
|
173 | 179 | """ No newline at end of file |
|
174 | 180 | self.var_Rpath = str(self.txtRpath.text()) #Se carga la variable con la ruta recien editada No newline at end of file |
|
175 | 181 | self.statusRpath = functions.dir_exists(self.var_Rpath, self) No newline at end of file |
|
176 | 182 | No newline at end of file |
|
177 | 183 | No newline at end of file |
|
178 | 184 | #----------------------------------------------------- Tipo de datos --------------------------------------------------------------- No newline at end of file |
|
179 | 185 | No newline at end of file |
|
180 | 186 | @pyqtSignature("int") No newline at end of file |
|
181 | 187 | def on_lstDtype_activated(self, index): No newline at end of file |
|
182 | 188 | """ No newline at end of file |
|
183 | 189 | Permite elegir entre los tipos de archivos No newline at end of file |
|
184 | 190 | """ No newline at end of file |
|
185 | 191 | self.txtDtype.setReadOnly(True) No newline at end of file |
|
186 | 192 | if index == 0: No newline at end of file |
|
187 | 193 | self.var_Dtype ='r' No newline at end of file |
|
188 | 194 | elif index == 1: No newline at end of file |
|
189 | 195 | self.var_Dtype ='pdata' No newline at end of file |
|
190 | 196 | elif index == 2: No newline at end of file |
|
191 | 197 | self.var_Dtype ='sswma' No newline at end of file |
|
192 | 198 | else : No newline at end of file |
|
193 | 199 | self.var_Dtype ='' No newline at end of file |
|
194 | 200 | self.txtDtype.setReadOnly(False) No newline at end of file |
|
195 | 201 | No newline at end of file |
|
196 | 202 | self.txtDtype.setText(self.var_Dtype) No newline at end of file |
|
197 | 203 | functions.load_days(self) #llamada a funcion No newline at end of file |
|
198 | 204 | No newline at end of file |
|
199 | 205 | @pyqtSignature("") No newline at end of file |
|
200 | 206 | def on_txtDtype_editingFinished(self): No newline at end of file |
|
201 | 207 | self.var_Dtype=str(self.txtDtype.text()) No newline at end of file |
|
202 | 208 | functions.load_days(self) #llamada a funcion No newline at end of file |
|
203 | 209 | No newline at end of file |
|
204 | 210 | No newline at end of file |
|
205 | 211 | #----------------------------------------------------- Etiqueta --------------------------------------------------------------- No newline at end of file |
|
206 | 212 | No newline at end of file |
|
207 | 213 | @pyqtSignature("") No newline at end of file |
|
208 | 214 | def on_txtElabel_editingFinished(self): No newline at end of file |
|
209 | 215 | self.var_Elabel = str(self.txtElabel.text()) No newline at end of file |
|
210 | 216 | No newline at end of file |
|
211 | 217 | #----------------------------------------------------- Numero de copias --------------------------------------------------------------- No newline at end of file |
|
212 | 218 | @pyqtSignature("") No newline at end of file |
|
213 | 219 | def on_txtCopys_editingFinished(self): No newline at end of file |
|
214 | 220 | self.var_Copys = self.txtCopys.value() No newline at end of file |
|
215 | 221 | No newline at end of file |
|
216 | 222 | #----------------------------------------------------- Seleccion del rango de fechas --------------------------------------------------------------- No newline at end of file |
|
217 | 223 | No newline at end of file |
|
218 | 224 | @pyqtSignature("int") #CLOSED No newline at end of file |
|
219 | 225 | def on_lstStartDay_activated(self, index): No newline at end of file |
|
220 | 226 | """ No newline at end of file |
|
221 | 227 | Cambia la lista de opciones en lstStopDay No newline at end of file |
|
222 | 228 | """ No newline at end of file |
|
223 | 229 | var_StopDay_index=self.lstStopDay.count() - self.lstStopDay.currentIndex() No newline at end of file |
|
224 | 230 | self.lstStopDay.clear() No newline at end of file |
|
225 | 231 | No newline at end of file |
|
226 | 232 | for i in self.var_list[index:]: No newline at end of file |
|
227 | 233 | self.lstStopDay.addItem(i) No newline at end of file |
|
228 | 234 | No newline at end of file |
|
229 | 235 | self.lstStopDay.setCurrentIndex(self.lstStopDay.count() - var_StopDay_index) No newline at end of file |
|
230 | 236 | No newline at end of file |
|
231 | 237 | functions.get_sub_list(self) No newline at end of file |
|
232 | 238 | No newline at end of file |
|
233 | 239 | No newline at end of file |
|
234 | 240 | @pyqtSignature("int") #CLOSED No newline at end of file |
|
235 | 241 | def on_lstStopDay_activated(self, index): No newline at end of file |
|
236 | 242 | """ No newline at end of file |
|
237 | 243 | Cambia la lista de opciones en lstStartDay No newline at end of file |
|
238 | 244 | """ No newline at end of file |
|
239 | 245 | var_StartDay_index=self.lstStartDay.currentIndex() No newline at end of file |
|
240 | 246 | var_end_index = self.lstStopDay.count() - index No newline at end of file |
|
241 | 247 | self.lstStartDay.clear() No newline at end of file |
|
242 | 248 | No newline at end of file |
|
243 | 249 | for i in self.var_list[:len(self.var_list) - var_end_index + 1]: No newline at end of file |
|
244 | 250 | self.lstStartDay.addItem(i) No newline at end of file |
|
245 | 251 | No newline at end of file |
|
246 | 252 | self.lstStartDay.setCurrentIndex(var_StartDay_index) No newline at end of file |
|
247 | 253 | No newline at end of file |
|
248 | 254 | functions.get_sub_list(self) No newline at end of file |
|
249 | 255 | No newline at end of file |
|
250 | 256 | No newline at end of file |
|
251 | 257 | #----------------------------------------------------- Capacidad del dispositivo de grabacion --------------------------------------------------------------- No newline at end of file |
|
252 | 258 | No newline at end of file |
|
253 | 259 | @pyqtSignature("") No newline at end of file |
|
254 | 260 | def on_txtDcapacity_editingFinished(self): No newline at end of file |
|
255 | 261 | self.var_Dcapacity = self.txtDcapacity.value() No newline at end of file |
|
256 | 262 | No newline at end of file |
|
257 | 263 | No newline at end of file |
|
258 | 264 | @pyqtSignature("int") #CLOSED No newline at end of file |
|
259 | 265 | def on_lstDcapacity_activated(self, index): No newline at end of file |
|
260 | 266 | """ No newline at end of file |
|
261 | 267 | Permite elegir el tamaΓ±o del disco No newline at end of file |
|
262 | 268 | """ No newline at end of file |
|
263 | 269 | if index == 0: No newline at end of file |
|
264 | 270 | var_size=25.0 No newline at end of file |
|
265 | 271 | elif index == 1: No newline at end of file |
|
266 | 272 | var_size=8.5 No newline at end of file |
|
267 | 273 | elif index == 2: No newline at end of file |
|
268 | 274 | var_size=4.7 No newline at end of file |
|
269 | 275 | elif index == 3: No newline at end of file |
|
270 | 276 | var_size=0.7 No newline at end of file |
|
271 | 277 | No newline at end of file |
|
272 | 278 | if index != 4: No newline at end of file |
|
273 | 279 | self.txtDcapacity.setValue(var_size*10**9/1024**2) No newline at end of file |
|
274 | 280 | self.txtDcapacity.setReadOnly(True) No newline at end of file |
|
275 | 281 | else: No newline at end of file |
|
276 | 282 | self.txtDcapacity.setValue(100.0) No newline at end of file |
|
277 | 283 | self.txtDcapacity.setReadOnly(False) No newline at end of file |
|
278 | 284 | No newline at end of file |
|
279 | 285 | self.var_lstDcapacity = self.lstDcapacity.currentIndex() No newline at end of file |
|
280 | 286 | self.var_Dcapacity = self.txtDcapacity.value() No newline at end of file |
|
281 | 287 | No newline at end of file |
|
282 | 288 | #----------------------------------------------------- Testeo de las unidades de grabacion --------------------------------------------------------------- No newline at end of file |
|
283 | 289 | No newline at end of file |
|
284 | 290 | @pyqtSignature("") No newline at end of file |
|
285 | 291 | def on_btnTdevA_clicked(self): No newline at end of file |
|
286 | 292 | var_dev = str(self.txtDeviceA.text()) No newline at end of file |
|
287 | 293 | var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev No newline at end of file |
|
288 | 294 | commands.getstatusoutput(var_cmd) No newline at end of file |
|
289 | 295 | No newline at end of file |
|
290 | 296 | @pyqtSignature("") No newline at end of file |
|
291 | 297 | def on_btnTdevB_clicked(self): No newline at end of file |
|
292 | 298 | var_dev = str(self.txtDeviceB.text()) No newline at end of file |
|
293 | 299 | var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev No newline at end of file |
|
294 | 300 | commands.getstatusoutput(var_cmd) No newline at end of file |
|
295 | 301 | No newline at end of file |
|
296 | 302 | @pyqtSignature("") No newline at end of file |
|
297 | 303 | def on_btnTdevC_clicked(self): No newline at end of file |
|
298 | 304 | var_dev = str(self.txtDeviceC.text()) No newline at end of file |
|
299 | 305 | var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev No newline at end of file |
|
300 | 306 | commands.getstatusoutput(var_cmd) No newline at end of file |
|
301 | 307 | No newline at end of file |
|
302 | 308 | @pyqtSignature("") No newline at end of file |
|
303 | 309 | def on_btnTdevD_clicked(self): No newline at end of file |
|
304 | 310 | var_dev = str(self.txtDeviceD.text()) No newline at end of file |
|
305 | 311 | var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev No newline at end of file |
|
306 | 312 | commands.getstatusoutput(var_cmd) No newline at end of file |
|
307 | 313 | No newline at end of file |
|
308 | 314 | No newline at end of file |
|
309 | 315 | #============================================================================== No newline at end of file |
|
310 | 316 | # Botones para la generacion de los archivos de configuracion No newline at end of file |
|
311 | 317 | #============================================================================== No newline at end of file |
|
312 | 318 | No newline at end of file |
|
313 | 319 | #----------------------------------------------------- Generacion de la configuracion usando los parametros --------------------------------------------------------------- No newline at end of file |
|
314 | 320 | No newline at end of file |
|
315 | 321 | @pyqtSignature("") No newline at end of file |
|
316 | 322 | def on_btnGbkp_clicked(self): No newline at end of file |
|
317 | 323 | """ No newline at end of file |
|
318 | 324 | Generacion de archivos de configuracion usando los parametros No newline at end of file |
|
319 | 325 | """ No newline at end of file |
|
320 | 326 | No newline at end of file |
|
321 | 327 | if functions.validate_parameters(self) == False: No newline at end of file |
|
322 | 328 | return No newline at end of file |
|
323 | 329 | No newline at end of file |
|
324 | 330 | #Crea las carpetas en la ruta del proyecto y verifica que se crearon correctamente No newline at end of file |
|
325 | 331 | list_dirs=['gpath','iso','ppath', 'tmpdata'] No newline at end of file |
|
326 | 332 | bool_make_dirs = functions.make_dirs(list_dirs, self) No newline at end of file |
|
327 | 333 | if bool_make_dirs == False: No newline at end of file |
|
328 | 334 | return No newline at end of file |
|
329 | 335 | No newline at end of file |
|
330 | 336 | var_files_list = functions.list_files(self) #Se obtiene la lista de archivos a grabar No newline at end of file |
|
331 | 337 | No newline at end of file |
|
332 | 338 | self.var_Discs = functions.make_files_dat(var_files_list, self) #Se crean los archivos .dat No newline at end of file |
|
333 | 339 | No newline at end of file |
|
334 | 340 | functions.make_files_print(self) # Se crean los archivos .print No newline at end of file |
|
335 | 341 | No newline at end of file |
|
336 | 342 | functions2.make_parameters_conf(self) # se crea el archivo parameters.conf No newline at end of file |
|
337 | 343 | No newline at end of file |
|
338 | 344 | self.txtInfo.append("Total number of discs for recording: "+str(self.var_Discs * self.var_Copys)) No newline at end of file |
|
339 | 345 | No newline at end of file |
|
340 | 346 | #Se bloquean los parametros de configuracion No newline at end of file |
|
341 | 347 | functions2.enabled_items1(True, self) No newline at end of file |
|
342 | 348 | self.var_disc_n = 1 No newline at end of file |
|
343 | 349 | self.var_copy_n = 1 No newline at end of file |
|
344 | 350 | self.bool_first_iso = True No newline at end of file |
|
345 | 351 | self.var_burned_discs = 0 #numero de discos grabados No newline at end of file |
|
346 | 352 | No newline at end of file |
|
347 | 353 | No newline at end of file |
|
348 | 354 | #----------------------------------------------------- Permite reiniciar la configuracion --------------------------------------------------------------- No newline at end of file |
|
349 | 355 | No newline at end of file |
|
350 | 356 | @pyqtSignature("") No newline at end of file |
|
351 | 357 | def on_btnRestart_clicked(self): No newline at end of file |
|
352 | 358 | """ No newline at end of file |
|
353 | 359 | Permite que se puedan cambiar los parametros No newline at end of file |
|
354 | 360 | """ No newline at end of file |
|
355 | 361 | if os.path.isfile("parameters.conf"): No newline at end of file |
|
356 | 362 | os.remove("parameters.conf") No newline at end of file |
|
357 | 363 | if os.path.isfile("burning.conf"): No newline at end of file |
|
358 | 364 | os.remove("burning.conf") No newline at end of file |
|
359 | 365 | No newline at end of file |
|
360 | 366 | functions2.enabled_items1(False, self) No newline at end of file |
|
361 | 367 | self.btnStartburn.setText("Start Burn") No newline at end of file |
|
362 | 368 | No newline at end of file |
|
363 | 369 | No newline at end of file |
|
364 | 370 | No newline at end of file |
|
365 | 371 | #============================================================================== No newline at end of file |
|
366 | 372 | # Acciones de los procesos No newline at end of file |
|
367 | 373 | #============================================================================== No newline at end of file |
|
368 | 374 | No newline at end of file |
|
369 | 375 | #------------------------------------------------ Funciones del proceso de creacion del iso ------------------------------------------------------ No newline at end of file |
|
370 | 376 | No newline at end of file |
|
371 | 377 | def readOuput_iso(self): No newline at end of file |
|
372 | 378 | self.txtProgress.setText("stdout iso: " + QtCore.QString(self.process_iso.readAllStandardOutput())) No newline at end of file |
|
373 | 379 | No newline at end of file |
|
374 | 380 | def readError_iso(self): No newline at end of file |
|
375 | 381 | self.txtProgress.setText("stderr iso: " + QtCore.QString(self.process_iso.readAllStandardError())) No newline at end of file |
|
376 | 382 | No newline at end of file |
|
377 | 383 | def finished_iso(self): No newline at end of file |
|
378 | 384 | self.txtProgress.clear() No newline at end of file |
|
379 | 385 | No newline at end of file |
|
380 | 386 | if not(self.bool_state_burning): No newline at end of file |
|
381 | 387 | return No newline at end of file |
|
382 | 388 | No newline at end of file |
|
383 | 389 | if self.process_iso.exitCode() == 0: |
|
390 | No newline at end of file | |
|
384 | self.txtInfo.append("------Iso file: "+functions.i2s(self.var_disc_n)+" created successfully") No newline at end of file | |
|
385 | 391 | self.var_step = 1 No newline at end of file |
|
386 | 392 | self.function_burn() No newline at end of file |
|
387 | 393 | No newline at end of file |
|
388 | 394 | else: No newline at end of file |
|
389 | 395 | self.txtInfo.append("#####Error creating iso file "+function.i2s(self.var_disc_n) No newline at end of file |
|
390 | 396 | +" , code "+QtCore.QString(self.process_iso.exitCode())) No newline at end of file |
|
391 | 397 | self.txtInfo.append("Please check the data") No newline at end of file |
|
392 | 398 | self.txtInfo.append("FATAL ERROR") No newline at end of file |
|
393 | 399 | #----------------------------------------------------- Funciones del proceso de grabado --------------------------------------------------------------- No newline at end of file |
|
394 | 400 | No newline at end of file |
|
395 | 401 | def readOuput_burn(self): No newline at end of file |
|
396 | 402 | self.txtProgress.setText("stdout burn: " + QtCore.QString(self.process_burn.readAllStandardOutput())) No newline at end of file |
|
397 | 403 | No newline at end of file |
|
398 | 404 | def readError_burn(self): No newline at end of file |
|
399 | 405 | self.txtProgress.setText("stderr burn: " + QtCore.QString(self.process_burn.readAllStandardError())) No newline at end of file |
|
400 | 406 | No newline at end of file |
|
401 | 407 | def finished_burn(self): No newline at end of file |
|
402 | 408 | self.txtProgress.clear() No newline at end of file |
|
403 | 409 | No newline at end of file |
|
404 | 410 | #Si se paro el proceso manualmente se termina No newline at end of file |
|
405 | 411 | if not(self.bool_state_burning): No newline at end of file |
|
406 | 412 | return |
|
No newline at end of file | ||
|
407 | ||
|
No newline at end of file | ||
|
408 | functions2.make_burning_conf(self) # Si el proceso no ha sido detenido manualmente | |
|
No newline at end of file | ||
|
409 | #crea el archivo burning.conf para el seguimiento de los discos grabados No newline at end of file | |
|
410 | 413 | No newline at end of file |
|
411 | 414 | if self.process_burn.exitCode() == 0: No newline at end of file |
|
412 | 415 | self.txtInfo.append("-----Complete recording, disc: "+str(self.var_disc_n)+" copy: "+str(self.var_copy_n)) No newline at end of file |
|
413 | 416 | functions2.update_message(1, "COMPLETED", self) No newline at end of file |
|
414 | 417 | self.var_step = 2 No newline at end of file |
|
415 | 418 |
self. |
|
416 | 419 | No newline at end of file |
|
417 | 420 |
|
|
418 | 421 | self.txtInfo.append("#######Error recording, disc: "+function.i2s(self.var_disc_n)+" copy: " No newline at end of file |
|
419 | 422 | +function.i2s(self.var_copy_n)+", code "+QtCore.QString(self.process_burn.exitCode())) No newline at end of file |
|
420 | 423 | functions2.update_message(1, "ERROR", self) No newline at end of file |
|
421 | 424 | No newline at end of file |
|
422 | 425 | functions.is_last_disc_and_copy(self) No newline at end of file |
|
423 | 426 | No newline at end of file |
|
424 | 427 | No newline at end of file |
|
425 | 428 | #----------------------------------------------------- Funciones del proceso de verificacion --------------------------------------------------------------- No newline at end of file |
|
426 | 429 | No newline at end of file |
|
427 | 430 | def readOuput_check(self): No newline at end of file |
|
428 | 431 | self.txtProgress.setText("stdout check: " + QtCore.QString(self.process_check.readAllStandardOutput())) No newline at end of file |
|
429 | 432 | No newline at end of file |
|
430 | 433 | def readError_check(self): No newline at end of file |
|
431 | 434 | self.txtProgress.setText("stderr check: " + QtCore.QString(self.process_check.readAllStandardError())) No newline at end of file |
|
432 | 435 | No newline at end of file |
|
433 | 436 | def finished_check(self): No newline at end of file |
|
434 | 437 | self.txtProgress.clear() No newline at end of file |
|
435 | 438 | No newline at end of file |
|
436 | 439 | if not(self.bool_state_burning): No newline at end of file |
|
437 | 440 | return No newline at end of file |
|
438 | 441 | No newline at end of file |
|
439 | 442 | if self.process_check.exitCode() == 0: No newline at end of file |
|
440 | 443 | self.txtInfo.append("--------Complete checking, disc: "+str(self.var_disc_n)+" copy: "+str(self.var_copy_n)) No newline at end of file |
|
441 | 444 | functions2.update_message(2, "CHECKED", self) No newline at end of file |
|
442 | 445 | No newline at end of file |
|
443 | 446 |
|
|
444 | 447 | self.txtInfo.append("#######Error checking, disc: "+function.i2s(self.var_disc_n)+" copy: " No newline at end of file |
|
445 | 448 | +function.i2s(self.var_copy_n)+", code "+QtCore.QString(self.process_check.exitCode())) No newline at end of file |
|
446 | 449 | functions2.update_message(2, "ERROR", self) No newline at end of file |
|
447 | 450 | No newline at end of file |
|
448 | 451 | functions.is_last_disc_and_copy(self) No newline at end of file |
|
449 | 452 | No newline at end of file |
|
450 | 453 | No newline at end of file |
|
451 | 454 | No newline at end of file |
|
452 | 455 | #============================================================================== No newline at end of file |
|
453 | 456 | # Botones para el proceso de grabacion No newline at end of file |
|
454 | 457 | #============================================================================== No newline at end of file |
|
455 | 458 | No newline at end of file |
|
456 | 459 | #----------------------------------------------------- Iniciar proceso de grabacion --------------------------------------------------------------- No newline at end of file |
|
457 | 460 | No newline at end of file |
|
458 | 461 | @pyqtSignature("") No newline at end of file |
|
459 | 462 | def on_btnStartburn_clicked(self): No newline at end of file |
|
460 | 463 | """ No newline at end of file |
|
461 | 464 | Se inicia el proceso de grabacion No newline at end of file |
|
462 | 465 | """ No newline at end of file |
|
463 | 466 | #Verifica que exista algun dispositivo de grabacion seleccionado No newline at end of file |
|
464 | 467 | if not(functions2.selected_devices(self)): No newline at end of file |
|
465 | 468 | self.txtInfo.append("There is no recording device selected") No newline at end of file |
|
466 | 469 | return No newline at end of file |
|
467 | 470 | No newline at end of file |
|
468 | 471 | # #Lista los dispositivos de grabacion a usar No newline at end of file |
|
469 | 472 | # for dev in self.var_devices: No newline at end of file |
|
470 | 473 | # self.txtInfo.append("recording device :"+dev) No newline at end of file |
|
471 | 474 | No newline at end of file |
|
472 | 475 | self.bool_state_burning = True No newline at end of file |
|
473 | 476 | functions2.enabled_items2(True, self) No newline at end of file |
|
474 | 477 | No newline at end of file |
|
475 | 478 | if self.bool_first_iso == True: No newline at end of file |
|
476 | 479 | self.txtInfo.append("BUTTON: on_btnStartburn_clicked") No newline at end of file |
|
477 | 480 | self.var_step = 4 No newline at end of file |
|
478 | 481 |
self. |
|
479 | 482 | return No newline at end of file |
|
480 | 483 | No newline at end of file |
|
481 | 484 | if self.var_step == 0: No newline at end of file |
|
482 | 485 | self.function_iso() No newline at end of file |
|
483 | 486 |
|
|
484 | 487 | No newline at end of file |
|
485 | 488 | if self.var_step == 1: No newline at end of file |
|
486 | 489 | self.function_burn() No newline at end of file |
|
487 | 490 |
|
|
488 | 491 | No newline at end of file |
|
489 | 492 | #----------------------------------------------------- Funcion para el grabado --------------------------------------------------------------- No newline at end of file |
|
490 | 493 | No newline at end of file |
|
491 | 494 | def function_iso(self): No newline at end of file |
|
492 | 495 | #Creacion del archivo.iso para la grabacion No newline at end of file |
|
493 | 496 | if self.var_step == 0: No newline at end of file |
|
494 | 497 | self.txtInfo.append("########## Disc number: "+str(self.var_disc_n)+"##########") No newline at end of file |
|
495 | 498 |
self.txtInfo.append(" |
|
496 | 499 | |
|
500 | No newline at end of file | |
|
497 | if self.var_real == True: No newline at end of file | |
|
498 | 501 | var_cmd = functions.cmd_iso(self) No newline at end of file |
|
499 | 502 | else: No newline at end of file |
|
500 | 503 | self.txtInfo.append('**function_iso') No newline at end of file |
|
501 | 504 |
|
|
502 | 505 | No newline at end of file |
|
503 | 506 | self.process_iso.start(var_cmd) No newline at end of file |
|
504 | 507 | No newline at end of file |
|
505 | 508 | def function_burn(self): No newline at end of file |
|
506 | 509 | #Grabacion de los DVDs No newline at end of file |
|
507 | 510 | if self.var_step == 1: |
|
511 | No newline at end of file | |
|
508 | self.txtInfo.append("------Recording disc: "+str(self.var_copy_n)+", copy:"+str(self.var_copy_n)) No newline at end of file | |
|
509 | 512 | functions2.update_message(1, "BURNING", self) No newline at end of file |
|
510 | 513 | |
|
514 | No newline at end of file | |
|
511 | if self.var_real == True: No newline at end of file | |
|
512 | 515 | var_cmd = functions.cmd_burn(self) No newline at end of file |
|
516 | if self.var_real_burn == True: | |
|
No newline at end of file | ||
|
517 | var_cmd = functions.cmd_burn(self) | |
|
No newline at end of file | ||
|
518 | ######################################### | |
|
No newline at end of file | ||
|
519 | return###################################### No newline at end of file | |
|
513 | 520 | else: No newline at end of file |
|
514 | 521 | self.txtInfo.append('**function_burn') No newline at end of file |
|
515 | 522 | var_cmd="echo 'function_burn'" No newline at end of file |
|
516 | 523 | No newline at end of file |
|
517 | 524 | self.process_burn.start(var_cmd) No newline at end of file |
|
518 | 525 | No newline at end of file |
|
519 | 526 | def function_check(self): No newline at end of file |
|
520 | 527 | #Verificacion de los discos No newline at end of file |
|
521 | 528 | if self.var_step == 2: |
|
529 | No newline at end of file | |
|
522 | self.txtInfo.append("-----------checking disc:"+str(self.var_copy_n)+", copy:"+str(self.var_copy_n)) No newline at end of file | |
|
523 | 530 | functions2.update_message(2, "CHECKING", self) No newline at end of file |
|
524 | 531 | |
|
532 | No newline at end of file | |
|
525 | if self.var_real == True: No newline at end of file | |
|
526 | 533 | var_cmd = functions.cmd_check(self) No newline at end of file |
|
527 | 534 | else: No newline at end of file |
|
528 | 535 |
self |
|
529 | 536 | var_cmd="echo 'function_check'" No newline at end of file |
|
530 | 537 | No newline at end of file |
|
531 | 538 | self.process_check.start(var_cmd) No newline at end of file |
|
532 | 539 | No newline at end of file |
|
533 | 540 | #OK No newline at end of file |
|
534 | 541 | def function_eject(self): No newline at end of file |
|
535 | 542 | self.txtInfo.append("Ejecting recording devices") No newline at end of file |
|
536 | 543 | self.txtInfo.append("Please insert blank discs") No newline at end of file |
|
537 | 544 | |
|
545 | No newline at end of file | |
|
538 | if self.var_real == True: No newline at end of file | |
|
539 | 546 | functions2.eject_devices(self) # Expulsa las bandejas de los dispostivos de grabacion No newline at end of file |
|
540 | 547 | else: No newline at end of file |
|
541 | 548 | self.txtInfo.append("**functions2.eject_devices") No newline at end of file |
|
542 | 549 |
|
|
543 | 550 | self.btnStartburn.setText("Continue") No newline at end of file |
|
544 | 551 | self.btnStartburn.setEnabled(True) No newline at end of file |
|
545 | 552 | No newline at end of file |
|
546 | 553 | if self.bool_first_iso == True: No newline at end of file |
|
547 | 554 | self.bool_first_iso = False No newline at end of file |
|
548 | 555 | self.var_step = 0 No newline at end of file |
|
549 | 556 | No newline at end of file |
|
550 | 557 |
|
|
551 | 558 | self.var_step = 0 No newline at end of file |
|
552 | 559 | No newline at end of file |
|
553 | 560 | else: No newline at end of file |
|
554 | 561 | self.var_step = 1 No newline at end of file |
|
555 | 562 | No newline at end of file |
|
556 | 563 | def function_final(self): No newline at end of file |
|
557 | 564 | self.txtInfo.append("Recording process is complete") No newline at end of file |
|
558 | 565 | No newline at end of file |
|
559 | 566 | No newline at end of file |
|
560 | 567 | No newline at end of file |
|
561 | 568 | #----------------------------------------------------- Detener proceso de grabacion --------------------------------------------------------------- No newline at end of file |
|
562 | 569 | No newline at end of file |
|
563 | 570 | @pyqtSignature("") No newline at end of file |
|
564 | 571 | def on_btnStopburn_clicked(self): No newline at end of file |
|
565 | 572 | """ No newline at end of file |
|
566 | 573 | Slot documentation goes here. No newline at end of file |
|
567 | 574 |
|
|
568 | 575 | self.bool_state_burning = False No newline at end of file |
|
569 | 576 |
|
|
570 | 577 | if self.var_step == 0: No newline at end of file |
|
571 | 578 | self.process_iso.terminate() #Termina el proceso, si puede No newline at end of file |
|
572 | 579 | # self.process_iso.kill() #Mata el proceso, no es la forma adecuada, solo usar si terminate() no funciona No newline at end of file |
|
573 | 580 | elif self.var_step == 1: No newline at end of file |
|
574 | 581 | self.process_burn.terminate() No newline at end of file |
|
575 | 582 |
elif self.var_step == |
|
576 | 583 |
self.process_ |
|
577 | 584 | No newline at end of file |
|
578 | 585 | self.txtInfo.append("Stopped recording") No newline at end of file |
|
579 | 586 | functions2.enabled_items2(False, self) No newline at end of file |
|
580 | 587 | self.bool_first_iso = True No newline at end of file |
|
581 | 588 | No newline at end of file |
|
582 | 589 | No newline at end of file |
|
583 | 590 | No newline at end of file |
|
584 | 591 | #============================================================================== No newline at end of file |
|
585 | 592 | # Proceso verificacion manual No newline at end of file |
|
586 | 593 | #============================================================================== No newline at end of file |
|
587 | 594 | No newline at end of file |
|
588 | 595 | No newline at end of file |
|
589 | 596 | #----------------------------------------------------- Proceso de verificaion manual --------------------------------------------------------------- No newline at end of file |
|
590 | 597 | No newline at end of file |
|
591 | 598 | No newline at end of file |
|
592 | 599 | @pyqtSignature("") No newline at end of file |
|
593 | 600 | def on_btnTDpath_clicked(self): No newline at end of file |
|
594 | 601 | """ No newline at end of file |
|
595 | 602 | Slot documentation goes here. No newline at end of file |
|
596 | 603 |
|
|
597 | 604 | self.var_TDpath= str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) No newline at end of file |
|
598 | 605 | self.txtTDpath.setText(self.var_TDpath) No newline at end of file |
|
599 | 606 | self.statusTDpath = functions.dir_exists(self.var_TDpath, self) No newline at end of file |
|
600 | 607 | No newline at end of file |
|
601 | 608 | No newline at end of file |
|
602 | 609 | @pyqtSignature("") No newline at end of file |
|
603 | 610 | def on_btnCHstart_clicked(self): No newline at end of file |
|
604 | 611 | """ No newline at end of file |
|
605 | 612 | Slot documentation goes here. No newline at end of file |
|
606 | 613 |
|
|
607 | 614 | pass No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now