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