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