@@ -8,9 +8,10 | |||||
8 | import os |
|
8 | import os | |
9 | import subprocess |
|
9 | import subprocess | |
10 | import commands |
|
10 | import commands | |
11 |
|
11 | import shutil | ||
12 |
|
12 | |||
13 | #Entero a cadena agregando ceros delante |
|
13 | #--------------------------------------------- Entero a cadena agregando ceros delante ------------------------------------------------- | |
|
14 | ||||
14 | def i2s(var_n, var_length=4): |
|
15 | def i2s(var_n, var_length=4): | |
15 | var_n2=str(var_n) |
|
16 | var_n2=str(var_n) | |
16 | while len(var_n2) < var_length: |
|
17 | while len(var_n2) < var_length: | |
@@ -18,19 +19,8 | |||||
18 | return var_n2 |
|
19 | return var_n2 | |
19 |
|
20 | |||
20 |
|
21 | |||
21 | #Crea directorios en la ruta indicada |
|
22 | #----------------------------------------- Se verifica que la ruta exista y sea un directorio ------------------------------------------------- | |
22 | def make_dirs(list_dirs, self): |
|
23 | ||
23 | var_cmd="mkdir -p "+str(self.var_Rpath) |
|
|||
24 | for var_dir in list_dirs: |
|
|||
25 | var_output=commands.getstatusoutput(var_cmd+'/'+var_dir)[0] |
|
|||
26 | if var_output != 0: |
|
|||
27 | self.txtInfo.append("Error al crear el directorio "+var_dir+", output_error:" + str(var_output)) |
|
|||
28 | return False |
|
|||
29 | self.txtInfo.append('Carpetas creadas correctamente') |
|
|||
30 | return True |
|
|||
31 |
|
||||
32 |
|
||||
33 | #Se verifica que la ruta exista y sea un directorio |
|
|||
34 | def dir_exists(var_dir, self): |
|
24 | def dir_exists(var_dir, self): | |
35 | if os.path.isdir(var_dir): |
|
25 | if os.path.isdir(var_dir): | |
36 | self.txtInfo.append("Ruta valida, sin error:" + str(var_dir)) |
|
26 | self.txtInfo.append("Ruta valida, sin error:" + str(var_dir)) | |
@@ -40,7 +30,8 | |||||
40 | return False |
|
30 | return False | |
41 |
|
31 | |||
42 |
|
32 | |||
43 | #Se buscan los archivos del tipo especificado |
|
33 | #-------------------------------- Se buscan los archivos del tipo especificado y se cargan las fechas ----------------------------- | |
|
34 | ||||
44 | def load_days(self): |
|
35 | def load_days(self): | |
45 |
|
36 | |||
46 | self.var_list=[] |
|
37 | self.var_list=[] | |
@@ -74,33 +65,50 | |||||
74 |
|
65 | |||
75 | get_sub_list(self) |
|
66 | get_sub_list(self) | |
76 | self.btnGbkp.setEnabled(True) |
|
67 | self.btnGbkp.setEnabled(True) | |
77 |
|
68 | |||
78 |
|
69 | |||
79 | #Verifica que los parametros |
|
70 | #-------------------------------------------------- Obtiene el rango de las fechas seleccionadas ----------------------------------------- | |
80 | def validate_parameters(self): |
|
71 | ||
81 | #Verifica que las rutas sean validas |
|
|||
82 | if self.statusRpath == False: |
|
|||
83 | self.txtInfo.append("Ruta de proyecto no valida") |
|
|||
84 | return False |
|
|||
85 |
|
||||
86 | #Verifica la etiqueta |
|
|||
87 | if len(self.var_Elabel) == 0: |
|
|||
88 | self.txtInfo.append("Debe ingresar el nombre de la etiqueta") |
|
|||
89 | return False |
|
|||
90 |
|
||||
91 | return True |
|
|||
92 |
|
||||
93 |
|
||||
94 | #Obtiene el rango de las fechas seleccionadas |
|
|||
95 | def get_sub_list(self): |
|
72 | def get_sub_list(self): | |
96 | self.var_sublist=[] |
|
73 | self.var_sublist=[] | |
97 | 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]: | |
98 | self.var_sublist.append(i) |
|
75 | self.var_sublist.append(i) | |
99 | if len(self.var_sublist) == 0: |
|
76 | if len(self.var_sublist) == 0: | |
100 | self.txtInfo.append("No existen archivos encontrados") |
|
77 | self.txtInfo.append("No existen archivos encontrados") | |
101 |
|
78 | |||
102 |
|
79 | |||
103 | #Busca los archivos con los parametros de busqueda |
|
80 | #----------------------------------------------------- Verifica los parametros faltantes ----------------------------------------------------------- | |
|
81 | ||||
|
82 | def validate_parameters(self): | |||
|
83 | #Verifica que las ruta del proyecto sea valida | |||
|
84 | if self.statusRpath == False: | |||
|
85 | self.txtInfo.append("Ruta de proyecto no valida") | |||
|
86 | return False | |||
|
87 | ||||
|
88 | #Verifica la etiqueta | |||
|
89 | if len(self.var_Elabel) == 0: | |||
|
90 | self.txtInfo.append("Debe ingresar el nombre de la etiqueta") | |||
|
91 | return False | |||
|
92 | ||||
|
93 | return True | |||
|
94 | ||||
|
95 | ||||
|
96 | #------------------------------------------------- Crea directorios en la ruta indicada ----------------------------------------------------------- | |||
|
97 | ||||
|
98 | def make_dirs(list_dirs, self): | |||
|
99 | ||||
|
100 | for var_dir in list_dirs: | |||
|
101 | shutil.rmtree(self.var_Rpath+'/'+var_dir, True) | |||
|
102 | var_output=commands.getstatusoutput("mkdir -p "+self.var_Rpath+'/'+var_dir)[0] | |||
|
103 | if var_output != 0: | |||
|
104 | self.txtInfo.append("Error al crear el directorio "+var_dir+", output_error:" + str(var_output)) | |||
|
105 | return False | |||
|
106 | self.txtInfo.append('Carpetas creadas correctamente') | |||
|
107 | return True | |||
|
108 | ||||
|
109 | ||||
|
110 | #-------------------------------------------- Busca los archivos con los parametros de busqueda --------------------------------------- | |||
|
111 | ||||
104 | def list_files(self): |
|
112 | def list_files(self): | |
105 | var_files_list=[] |
|
113 | var_files_list=[] | |
106 | for var_doy in self.var_sublist: |
|
114 | for var_doy in self.var_sublist: | |
@@ -111,7 +119,8 | |||||
111 | return var_files_list |
|
119 | return var_files_list | |
112 |
|
120 | |||
113 |
|
121 | |||
114 | #Genera la lista de archivos .dat que contienen los archivos a grabar en cada DVD |
|
122 | #--------------- Genera la lista de archivos .dat que contienen los archivos a grabar en cada DVD ----------------------- | |
|
123 | ||||
115 | def make_files_dat(var_files_list, self): |
|
124 | def make_files_dat(var_files_list, self): | |
116 | var_Rpath_ppath=self.var_Rpath+"/ppath" #Ruta de los archivos a grabar |
|
125 | var_Rpath_ppath=self.var_Rpath+"/ppath" #Ruta de los archivos a grabar | |
117 | var_n=1 #Numero del DVD actual |
|
126 | var_n=1 #Numero del DVD actual | |
@@ -119,7 +128,7 | |||||
119 | var_files_list_2=[] #Se usa para almacenar la lista de archivos agrbar en cada DVD |
|
128 | var_files_list_2=[] #Se usa para almacenar la lista de archivos agrbar en cada DVD | |
120 |
|
129 | |||
121 | for i in var_files_list: #Se asignan en i los archivos de la lista |
|
130 | for i in var_files_list: #Se asignan en i los archivos de la lista | |
122 | self.txtInfo.append(i) |
|
131 | ||
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 |
|
132 | 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 |
|
133 | var_tmp += var_size_i #Se acumulan el tamaño de los archivos de la lista | |
125 |
|
134 | |||
@@ -146,23 +155,25 | |||||
146 | var_tmp_path=line.split(self.var_Dpath)[1][:-13] |
|
155 | var_tmp_path=line.split(self.var_Dpath)[1][:-13] | |
147 | var_file.write(var_tmp_path+'='+line+'\n') |
|
156 | var_file.write(var_tmp_path+'='+line+'\n') | |
148 | var_file.close() |
|
157 | var_file.close() | |
149 |
|
158 | |||
|
159 | self.txtInfo.append("Archivos .dat creados") | |||
150 | return var_n |
|
160 | return var_n | |
151 |
|
161 | |||
152 |
|
162 | |||
153 | #Genera los archivos .print con los cuales se creara los postscript |
|
163 | #------------------------------ Genera los archivos .print con los cuales se creara los postscript ----------------------------------- | |
|
164 | ||||
154 | def make_files_print(self): |
|
165 | def make_files_print(self): | |
155 |
|
166 | |||
156 | var_Rpath_ppath=self.var_Rpath+"/ppath" #Ruta de los archivos a grabar |
|
167 | var_Rpath_ppath=self.var_Rpath+"/ppath" #Ruta de los archivos a grabar | |
157 |
|
168 | |||
158 | # Se leen todos los archivos .dat creados para crear las etiquetas en los archivos .print |
|
169 | # Se leen todos los archivos .dat creados para crear las etiquetas en los archivos .print | |
159 |
for var_n in range(1, self.var_ |
|
170 | for var_n in range(1, self.var_Discs + 1): | |
160 | #se abren los archivos .dat en modo lectura |
|
171 | #se abren los archivos .dat en modo lectura | |
161 | var_file = open(var_Rpath_ppath+"/"+self.var_Elabel+"_"+i2s(var_n)+".dat","r") |
|
172 | var_file = open(var_Rpath_ppath+"/"+self.var_Elabel+"_"+i2s(var_n)+".dat","r") | |
162 | lines=var_file.readlines() # Se lee las lineas en el archivo y se almacenan en la lista |
|
173 | lines=var_file.readlines() # Se lee las lineas en el archivo y se almacenan en la lista | |
163 | # Se crea el archivo .print |
|
174 | # Se crea el archivo .print | |
164 | var_file_print = open(var_Rpath_ppath+"/"+self.var_Elabel+"_"+i2s(var_n)+".print","w") |
|
175 | var_file_print = open(var_Rpath_ppath+"/"+self.var_Elabel+"_"+i2s(var_n)+".print","w") | |
165 |
var_file_print.write(self.var_Elabel+" "+i2s(var_n)+"/"+i2s(self.var_ |
|
176 | var_file_print.write(self.var_Elabel+" "+i2s(var_n)+"/"+i2s(self.var_Discs)+"\n") | |
166 | var_file_print.write("Year Doy Folder Set Time range\n") |
|
177 | var_file_print.write("Year Doy Folder Set Time range\n") | |
167 |
|
178 | |||
168 | var_first_folder = lines[0].split('=')[0] |
|
179 | var_first_folder = lines[0].split('=')[0] | |
@@ -195,7 +206,7 | |||||
195 | var_date_last_file=commands.getstatusoutput("date -r "+var_last_file+" +'%T'")[1] |
|
206 | var_date_last_file=commands.getstatusoutput("date -r "+var_last_file+" +'%T'")[1] | |
196 |
|
207 | |||
197 | if var_first_folder == '/': |
|
208 | if var_first_folder == '/': | |
198 |
var_folder = self. |
|
209 | var_folder = self.var_Elabel | |
199 | else: |
|
210 | else: | |
200 | var_folder = var_first_folder.split('/')[-2] |
|
211 | var_folder = var_first_folder.split('/')[-2] | |
201 |
|
212 |
@@ -7,6 +7,7 | |||||
7 | import subprocess |
|
7 | import subprocess | |
8 | import commands |
|
8 | import commands | |
9 |
|
9 | |||
|
10 | #----------------------------------------------------- Deteccion de los dispositivos de grabacion --------------------------------------------------------------- | |||
10 |
|
11 | |||
11 | def detect_devices(self): |
|
12 | def detect_devices(self): | |
12 | """ |
|
13 | """ | |
@@ -48,6 +49,28 | |||||
48 | self.chkDevD.setChecked(False) |
|
49 | self.chkDevD.setChecked(False) | |
49 | self.chkDevD.setEnabled(False) |
|
50 | self.chkDevD.setEnabled(False) | |
50 |
|
51 | |||
|
52 | ||||
|
53 | #----------------------------------- listado de los dispositivos de grabacion seleccionados -------------------------------------------- | |||
|
54 | ||||
|
55 | def selected_devices(self): | |||
|
56 | self.var_devices=[] | |||
|
57 | if self.chkDevA.isChecked(): | |||
|
58 | self.var_devices.append(str(self.txtDeviceA.text())) | |||
|
59 | if self.chkDevB.isChecked(): | |||
|
60 | self.var_devices.append(str(self.txtDeviceB.text())) | |||
|
61 | if self.chkDevC.isChecked(): | |||
|
62 | self.var_devices.append(str(self.txtDeviceC.text())) | |||
|
63 | if self.chkDevD.isChecked(): | |||
|
64 | self.var_devices.append(str(self.txtDeviceD.text())) | |||
|
65 | ||||
|
66 | if len(self.var_devices) == 0: | |||
|
67 | return False | |||
|
68 | else: | |||
|
69 | return True | |||
|
70 | ||||
|
71 | ||||
|
72 | #----------------------------------------------------- Inicializacion para pruebas--------------------------------------------------------------- | |||
|
73 | ||||
51 | def set_parameters_test(self): |
|
74 | def set_parameters_test(self): | |
52 | """ |
|
75 | """ | |
53 | Se usa para inicializar ciertos parametros para pruebas |
|
76 | Se usa para inicializar ciertos parametros para pruebas | |
@@ -60,19 +83,25 | |||||
60 | self.txtDcapacity.setReadOnly(False) |
|
83 | self.txtDcapacity.setReadOnly(False) | |
61 |
|
84 | |||
62 |
|
85 | |||
|
86 | #----------------------------------------------------- crea parameters.conf --------------------------------------------------------------- | |||
|
87 | ||||
63 | def make_parameters_conf(self): |
|
88 | def make_parameters_conf(self): | |
64 | var_file = open("parameters.conf","w") |
|
89 | var_file = open("parameters.conf","w") | |
65 | var_file.write(self.var_Dpath+"\n") #0 |
|
90 | var_file.write(self.var_Dpath+"\n") #0 Ruta de los datos | |
66 | var_file.write(self.var_Rpath+"\n") #1 |
|
91 | var_file.write(self.var_Rpath+"\n") #1 Ruta del proyecto | |
67 | var_file.write(str(self.var_lstDtype)+"\n") #2 |
|
92 | var_file.write(str(self.var_lstDtype)+"\n") #2 opcion Data Type | |
68 | var_file.write(self.var_Dtype+"\n") #3 |
|
93 | var_file.write(self.var_Dtype+"\n") #3 extension Data Type | |
69 | var_file.write(self.var_Elabel+"\n") #4 |
|
94 | var_file.write(self.var_Elabel+"\n") #4 etiqueta | |
70 | var_file.write(str(self.var_Copys)+"\n") #5 |
|
95 | var_file.write(str(self.var_Copys)+"\n") #5 Numero de copias | |
71 | var_file.write(str(self.var_lstDcapacity)+"\n") #6 |
|
96 | var_file.write(str(self.var_lstDcapacity)+"\n") #6 opcion Device Capacity | |
72 | var_file.write(str(self.var_Dcapacity)+"\n") #7 |
|
97 | var_file.write(str(self.var_Dcapacity)+"\n") #7 tamaño Device Capacity | |
73 |
var_file.write(str(self.var_ |
|
98 | var_file.write(str(self.var_Discs)+"\n") #8 Numero de discos a grabar | |
|
99 | # var_file.write(str(self.lstStartDay.currentIndex())+"\n") #9 Indice fecha inicial | |||
|
100 | # var_file.write(str(self.lstStopDay.currentIndex())+"\n") #10 Indice fecha final | |||
|
101 | ||||
74 | var_file.close() |
|
102 | var_file.close() | |
75 |
|
103 | |||
|
104 | #----------------------------------------------------- carga parameters.conf --------------------------------------------------------------- | |||
76 |
|
105 | |||
77 | def get_parameters_conf(self): |
|
106 | def get_parameters_conf(self): | |
78 | var_file = open("parameters.conf","r") |
|
107 | var_file = open("parameters.conf","r") | |
@@ -85,20 +114,27 | |||||
85 | self.txtCopys.setValue(int(lines[5][:-1])) #5 |
|
114 | self.txtCopys.setValue(int(lines[5][:-1])) #5 | |
86 | self.lstDcapacity.setCurrentIndex(int(lines[6])) #6 |
|
115 | self.lstDcapacity.setCurrentIndex(int(lines[6])) #6 | |
87 | self.txtDcapacity.setValue(float(lines[7])) #7 |
|
116 | self.txtDcapacity.setValue(float(lines[7])) #7 | |
88 |
self.var_ |
|
117 | self.var_Discs = int(lines[8]) #8 | |
|
118 | # var_StartDay = int(lines[6]) #9 | |||
|
119 | # var_StopDay = int(lines[7]) #10 | |||
89 | var_file.close() |
|
120 | var_file.close() | |
90 |
|
121 | |||
91 |
|
122 | |||
|
123 | ||||
|
124 | #-------------------------- actualiza el valor de las variables con los parametros seleccionados ----------------------------- | |||
|
125 | ||||
92 | def set_vars(self): |
|
126 | def set_vars(self): | |
93 | self.var_Dpath = self.txtDpath.text() #0 |
|
127 | self.var_Dpath = str(self.txtDpath.text()) #0 | |
94 | self.var_Rpath = self.txtRpath.text() #1 |
|
128 | self.var_Rpath = str(self.txtRpath.text()) #1 | |
95 | self.var_lstDtype = self.lstDtype.currentIndex() #2 |
|
129 | self.var_lstDtype = self.lstDtype.currentIndex() #2 | |
96 | self.var_Dtype = self.txtDtype.text() #3 |
|
130 | self.var_Dtype = str(self.txtDtype.text()) #3 | |
97 | self.var_Elabel = self.txtElabel.text() #4 |
|
131 | self.var_Elabel = str(self.txtElabel.text()) #4 | |
98 | self.var_Copys = self.txtCopys.value() #5 |
|
132 | self.var_Copys = self.txtCopys.value() #5 | |
99 | self.var_lstDcapacity = self.lstDcapacity.currentIndex() #6 |
|
133 | self.var_lstDcapacity = self.lstDcapacity.currentIndex() #6 | |
100 | self.var_Dcapacity = self.txtDcapacity.value() #7 |
|
134 | self.var_Dcapacity = self.txtDcapacity.value() #7 | |
|
135 | self.var_Discs = self.var_Discs #8 | |||
101 |
|
136 | |||
|
137 | #---------------------------------------------- Habilitacion y deshabilitacion de items ------------------------------------------------------- | |||
102 |
|
138 | |||
103 | def enabled_items1(var_bool, self): |
|
139 | def enabled_items1(var_bool, self): | |
104 | self.tabParameters.setEnabled(not(var_bool)) |
|
140 | self.tabParameters.setEnabled(not(var_bool)) |
@@ -32,18 +32,25 | |||||
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 |
|
35 | self.var_Discs = 0 #Numero de discos del proyecto | |
36 | self.var_disc=0 |
|
36 | self.var_Copys = 0 #Numero de copias | |
|
37 | self.var_disc_n = 0 | |||
|
38 | self.var_copy_n = 0 | |||
|
39 | ||||
37 | self.var_list=[] |
|
40 | self.var_list=[] | |
38 | self.var_sublist=[] |
|
41 | self.var_sublist=[] | |
39 | self.bool_iso = False |
|
42 | ||
40 | self.bool_burn = False |
|
43 | self.var_devices=[] | |
|
44 | ||||
|
45 | self.var_step = 0 | |||
|
46 | self.bool_state_burning = False | |||
|
47 | ||||
41 |
|
48 | |||
42 | #Revisa si existe el archivo de confirguracion |
|
49 | #Revisa si existe el archivo de confirguracion | |
43 | if os.path.isfile("parameters.conf"): |
|
50 | if os.path.isfile("parameters.conf"): | |
44 | self.txtInfo.append("Archivo de configuracion encontrado") |
|
51 | self.txtInfo.append("Archivo de configuracion encontrado") | |
45 | functions2.get_parameters_conf(self) |
|
52 | functions2.get_parameters_conf(self) | |
46 |
self.txtInfo.append("El proyecto |
|
53 | self.txtInfo.append("El proyecto es de "+str(self.var_Discs)+" discos") | |
47 | else: |
|
54 | else: | |
48 | self.txtInfo.append("Elija los parametros de configuracion") |
|
55 | self.txtInfo.append("Elija los parametros de configuracion") | |
49 | functions2.set_parameters_test(self) #Establece ciertos parametros, para pruebas |
|
56 | functions2.set_parameters_test(self) #Establece ciertos parametros, para pruebas | |
@@ -53,7 +60,11 | |||||
53 | self.statusDpath = functions.dir_exists(self.var_Dpath, self) |
|
60 | self.statusDpath = functions.dir_exists(self.var_Dpath, self) | |
54 | self.statusRpath = functions.dir_exists(self.var_Rpath, self) |
|
61 | self.statusRpath = functions.dir_exists(self.var_Rpath, self) | |
55 | functions.load_days(self) |
|
62 | functions.load_days(self) | |
56 |
|
63 | |||
|
64 | if os.path.isfile("parameters.conf"): | |||
|
65 | functions2.enabled_items1(True, self) #Se bloquean los parametros de configuracion | |||
|
66 | ||||
|
67 | ||||
57 | self.var_process = QtCore.QProcess() |
|
68 | self.var_process = QtCore.QProcess() | |
58 | self.connect(self.var_process, QtCore.SIGNAL('readyReadStandardOutput()'), self.readOuput) |
|
69 | self.connect(self.var_process, QtCore.SIGNAL('readyReadStandardOutput()'), self.readOuput) | |
59 | self.connect(self.var_process, QtCore.SIGNAL('readyReadStandardError()'), self.readError) |
|
70 | self.connect(self.var_process, QtCore.SIGNAL('readyReadStandardError()'), self.readError) | |
@@ -74,18 +85,18 | |||||
74 |
|
85 | |||
75 | def finished(self): |
|
86 | def finished(self): | |
76 | self.txtInfo.append("proceso terminado finished() "+QtCore.QString(self.var_process.exitCode())) |
|
87 | self.txtInfo.append("proceso terminado finished() "+QtCore.QString(self.var_process.exitCode())) | |
77 |
if self.var_disc <= self.var_ |
|
88 | if self.var_disc_n <= self.var_Discs and self.bool_state_burning: | |
78 | self.burning() |
|
89 | self.burning() | |
79 |
|
90 | |||
80 |
|
91 | |||
81 |
#----------------------------------------------------- Obtencion de la |
|
92 | #----------------------------------------------------- Obtencion de la ruta de los datos --------------------------------------------------------------- | |
82 |
|
93 | |||
83 | @pyqtSignature("") |
|
94 | @pyqtSignature("") | |
84 | def on_btnDpath_clicked(self): |
|
95 | def on_btnDpath_clicked(self): | |
85 | """ |
|
96 | """ | |
86 | Permite seleccionar graficamente el direcorio de los datos a grabar |
|
97 | Permite seleccionar graficamente el direcorio de los datos a grabar | |
87 | """ |
|
98 | """ | |
88 | self.var_Dpath= QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly) |
|
99 | self.var_Dpath= str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) | |
89 | self.txtDpath.setText(self.var_Dpath) |
|
100 | self.txtDpath.setText(self.var_Dpath) | |
90 | self.statusDpath = functions.dir_exists(self.var_Dpath, self) |
|
101 | self.statusDpath = functions.dir_exists(self.var_Dpath, self) | |
91 | functions.load_days(self) |
|
102 | functions.load_days(self) | |
@@ -96,7 +107,7 | |||||
96 | """ |
|
107 | """ | |
97 | Carga la ruta editada y verifica que sea correcta y carga la lista de dias |
|
108 | Carga la ruta editada y verifica que sea correcta y carga la lista de dias | |
98 | """ |
|
109 | """ | |
99 | self.var_Dpath=self.txtDpath.text() #Se carga la variable con la ruta recien editada |
|
110 | self.var_Dpath=str(self.txtDpath.text()) #Se carga la variable con la ruta recien editada | |
100 | self.statusDpath = functions.dir_exists(self.var_Dpath, self) |
|
111 | self.statusDpath = functions.dir_exists(self.var_Dpath, self) | |
101 | functions.load_days(self) |
|
112 | functions.load_days(self) | |
102 |
|
113 | |||
@@ -108,7 +119,7 | |||||
108 | """ |
|
119 | """ | |
109 | Permite seleccionar graficamente el direcorio del proyecto |
|
120 | Permite seleccionar graficamente el direcorio del proyecto | |
110 | """ |
|
121 | """ | |
111 | self.var_Rpath = QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly) |
|
122 | self.var_Rpath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)) | |
112 | self.txtRpath.setText(self.var_Rpath) |
|
123 | self.txtRpath.setText(self.var_Rpath) | |
113 | self.statusRpath = functions.dir_exists(self.var_Rpath, self) |
|
124 | self.statusRpath = functions.dir_exists(self.var_Rpath, self) | |
114 |
|
125 | |||
@@ -118,7 +129,7 | |||||
118 | """ |
|
129 | """ | |
119 | Valida la ruta del proyecto |
|
130 | Valida la ruta del proyecto | |
120 | """ |
|
131 | """ | |
121 | self.var_Rpath=self.txtRpath.text() #Se carga la variable con la ruta recien editada |
|
132 | self.var_Rpath = str(self.txtRpath.text()) #Se carga la variable con la ruta recien editada | |
122 | self.statusRpath = functions.dir_exists(self.var_Rpath, self) |
|
133 | self.statusRpath = functions.dir_exists(self.var_Rpath, self) | |
123 |
|
134 | |||
124 |
|
135 | |||
@@ -145,7 +156,7 | |||||
145 |
|
156 | |||
146 | @pyqtSignature("") |
|
157 | @pyqtSignature("") | |
147 | def on_txtDtype_editingFinished(self): |
|
158 | def on_txtDtype_editingFinished(self): | |
148 |
self.var_Dtype=self.txtDtype.text() |
|
159 | self.var_Dtype=str(self.txtDtype.text()) | |
149 | functions.load_days(self) #llamada a funcion |
|
160 | functions.load_days(self) #llamada a funcion | |
150 |
|
161 | |||
151 |
|
162 | |||
@@ -153,7 +164,7 | |||||
153 |
|
164 | |||
154 | @pyqtSignature("") |
|
165 | @pyqtSignature("") | |
155 | def on_txtElabel_editingFinished(self): |
|
166 | def on_txtElabel_editingFinished(self): | |
156 | self.var_Elabel = self.txtElabel.text() |
|
167 | self.var_Elabel = str(self.txtElabel.text()) | |
157 |
|
168 | |||
158 | #----------------------------------------------------- Numero de copias --------------------------------------------------------------- |
|
169 | #----------------------------------------------------- Numero de copias --------------------------------------------------------------- | |
159 | @pyqtSignature("") |
|
170 | @pyqtSignature("") | |
@@ -223,6 +234,7 | |||||
223 | self.txtDcapacity.setValue(100.0) |
|
234 | self.txtDcapacity.setValue(100.0) | |
224 | self.txtDcapacity.setReadOnly(False) |
|
235 | self.txtDcapacity.setReadOnly(False) | |
225 |
|
236 | |||
|
237 | self.var_lstDcapacity = self.lstDcapacity.currentIndex() | |||
226 | self.var_Dcapacity = self.txtDcapacity.value() |
|
238 | self.var_Dcapacity = self.txtDcapacity.value() | |
227 |
|
239 | |||
228 |
|
240 | |||
@@ -248,12 +260,13 | |||||
248 | return |
|
260 | return | |
249 |
|
261 | |||
250 | var_files_list = functions.list_files(self) #Se obtiene la lista de archivos a grabar |
|
262 | var_files_list = functions.list_files(self) #Se obtiene la lista de archivos a grabar | |
251 |
self.var_ |
|
263 | self.var_Discs = functions.make_files_dat(var_files_list, self) #Se crean los archivos .dat | |
252 | functions.make_files_print(self) # Se crean los archivos .print |
|
264 | functions.make_files_print(self) # Se crean los archivos .print | |
253 | functions2.make_parameters_conf(self) # se crea el archivo parameters.conf |
|
265 | functions2.make_parameters_conf(self) # se crea el archivo parameters.conf | |
254 |
|
266 | |||
255 | #Se bloquean los parametros de configuracion |
|
267 | #Se bloquean los parametros de configuracion | |
256 | functions2.enabled_items1(True, self) |
|
268 | functions2.enabled_items1(True, self) | |
|
269 | ||||
257 |
|
270 | |||
258 |
|
271 | |||
259 | #----------------------------------------------------- Permite reiniciar la configuracion --------------------------------------------------------------- |
|
272 | #----------------------------------------------------- Permite reiniciar la configuracion --------------------------------------------------------------- | |
@@ -274,58 +287,72 | |||||
274 | """ |
|
287 | """ | |
275 | Se inicia el proceso de grabacion |
|
288 | Se inicia el proceso de grabacion | |
276 | """ |
|
289 | """ | |
277 | functions2.enabled_items2(True, self) |
|
290 | ||
278 |
|
291 | #Verifica que exista algun dispositivo de grabacion seleccionado | ||
279 | sys.stdout = self |
|
292 | if not(functions2.selected_devices(self)): | |
280 | # #sys.stderr = self |
|
293 | self.txtInfo.append("No hay ningun dispositivo de grabacion seleccionado ") | |
281 | # print "stdout_!!!" |
|
|||
282 |
|
||||
283 | self.var_devices=[] |
|
|||
284 | if self.chkDevA.isChecked(): |
|
|||
285 | self.var_devices.append(self.txtDeviceA.text()) |
|
|||
286 | if self.chkDevB.isChecked(): |
|
|||
287 | self.var_devices.append(self.txtDeviceB.text()) |
|
|||
288 | if self.chkDevC.isChecked(): |
|
|||
289 | self.var_devices.append(self.txtDeviceC.text()) |
|
|||
290 | if self.chkDevD.isChecked(): |
|
|||
291 | self.var_devices.append(self.txtDeviceD.text()) |
|
|||
292 |
|
||||
293 | if len(self.var_devices) ==0: |
|
|||
294 | return |
|
294 | return | |
295 |
|
295 | |||
|
296 | #Lista los dispositivos de grabacion a usar | |||
296 | for dev in self.var_devices: |
|
297 | for dev in self.var_devices: | |
297 | self.txtInfo.append("dispositivo :"+dev) |
|
298 | self.txtInfo.append("dispositivo :"+dev) | |
298 |
|
299 | |||
299 | self.var_disc = 1 |
|
300 | #Asigna las variables con los valores iniciales | |
|
301 | self.var_disc_n = 0 # numero de disco actual para grabacion | |||
|
302 | self.var_copy_n = 0 | |||
|
303 | self.var_step = 0 | |||
|
304 | self.bool_state_burning = True | |||
|
305 | ||||
|
306 | functions2.enabled_items2(True, self) | |||
300 | self.burning() |
|
307 | self.burning() | |
301 |
|
308 | |||
302 | def burning(self): |
|
309 | def burning(self): | |
303 |
|
310 | |||
304 | var_Rpath_ppath=self.var_Rpath+"/ppath" |
|
311 | var_Rpath_ppath=self.var_Rpath+"/ppath" | |
305 | var_Rpath_iso=self.var_Rpath+"/iso" |
|
312 | var_Rpath_iso=self.var_Rpath+"/iso" | |
306 | file_iso=var_Rpath_iso+"/"+functions.i2s(self.var_disc)+".iso" |
|
313 | file_iso=var_Rpath_iso+"/"+functions.i2s(self.var_disc_n)+".iso" | |
307 |
|
314 | |||
308 | if not(self.bool_iso): |
|
315 | #Creacion del archivo.iso para la grabacion | |
309 | # self.bool_iso = True |
|
316 | if self.var_step == 0: | |
310 | self.bool_burn = False |
|
317 | self.var_disc_n += 1 # numero de disco actual para grabacion | |
311 | file_iso=var_Rpath_iso+"/"+functions.i2s(self.var_disc)+".iso" |
|
318 | self.txtInfo.append("Creando el iso del disco numero: "+self.var_disc_n) | |
312 | file_dat=var_Rpath_ppath+"/"+self.var_Elabel+"_"+functions.i2s(self.var_disc)+".dat" |
|
319 | ||
|
320 | #Si ya se grabaron todos los discos | |||
|
321 | if self.var_disc_n > self.var_Discs: | |||
|
322 | self.bool_state_burning = False | |||
|
323 | self.txtInfo.append("GRABACION TERMINADA") | |||
|
324 | return | |||
|
325 | ||||
|
326 | #comando para la creacion del archivo.iso | |||
|
327 | file_dat=var_Rpath_ppath+"/"+self.var_Elabel+"_"+functions.i2s(self.var_disc_n)+".dat" | |||
313 | var_cmd = 'genisoimage -hide-joliet-trans-tbl -joliet-long -r ' |
|
328 | var_cmd = 'genisoimage -hide-joliet-trans-tbl -joliet-long -r ' | |
314 | var_cmd += ' -A '+self.var_Elabel+' -V '+self.var_Elabel |
|
329 | var_cmd += ' -A '+self.var_Elabel+' -V '+self.var_Elabel | |
315 | var_cmd += ' -graft-points -path-list '+ file_dat+' -o '+file_iso |
|
330 | var_cmd += ' -graft-points -path-list '+ file_dat+' -o '+file_iso | |
316 |
|
331 | self.var_step = 1 #Se ira al paso de la grabacion en la siguiente llamada | ||
317 | elif not(self.bool_burn): |
|
332 | ||
318 | self.bool_iso = False |
|
333 | #Grabacion de los DVDs | |
319 | self.bool_burn = True |
|
334 | elif self.var_step == 1: | |
320 | var_dev_tmp=self.var_devices[ (self.var_disc-1) % len(self.var_devices) ] |
|
335 | self.var_copy_n += 1 # numero de copia actual | |
|
336 | self.txtInfo.append("Grabando la copia numero: "+self.var_copy_n) | |||
|
337 | ||||
|
338 | #Si esta es la ultima copia se pasara al siguiente disco en la siguiente llamada a la funcion | |||
|
339 | if self.var_copy_n == self.var_Copys: | |||
|
340 | self.var_step = 0 | |||
|
341 | ||||
|
342 | var_index = (((self.var_disc_n - 1) * self.var_Discs) + self.var_copy_n) % len(self.var_devices) | |||
|
343 | ||||
|
344 | if var_index == 0: | |||
|
345 | self.txtInfo.append("EXPULSANDO BANDEJAS") | |||
|
346 | ||||
|
347 | var_dev_tmp=self.var_devices[var_index] | |||
321 | var_cmd = "wodim -v dev="+var_dev_tmp+" speed=16 "+ file_iso |
|
348 | var_cmd = "wodim -v dev="+var_dev_tmp+" speed=16 "+ file_iso | |
322 | self.var_disc += 1 |
|
349 | ||
323 |
|
350 | |||
324 |
|
|
351 | self.var_process.start('ls') | |
325 |
|
|
352 | self.txtInfo.append(var_cmd) | |
326 |
|
353 | |||
327 | self.txtInfo.append("creando iso") |
|
354 | # self.txtInfo.append("creando iso") | |
328 | self.var_process.start(var_cmd) |
|
355 | # self.var_process.start(var_cmd) | |
329 |
|
356 | |||
330 |
|
357 | |||
331 | #----------------------------------------------------- Detener proceso de grabacion --------------------------------------------------------------- |
|
358 | #----------------------------------------------------- Detener proceso de grabacion --------------------------------------------------------------- | |
@@ -335,8 +362,9 | |||||
335 | """ |
|
362 | """ | |
336 | Slot documentation goes here. |
|
363 | Slot documentation goes here. | |
337 | """ |
|
364 | """ | |
338 | # self.var_process.terminate() #Termina el proceso, si puede |
|
365 | self.bool_state_burning = False | |
339 |
self.var_process. |
|
366 | self.var_process.terminate() #Termina el proceso, si puede | |
|
367 | # self.var_process.kill() #Mata el proceso, no es la forma adecuada | |||
340 | functions2.enabled_items2(False, self) |
|
368 | functions2.enabled_items2(False, self) | |
341 |
|
369 | |||
342 |
|
370 |
@@ -833,7 +833,7 | |||||
833 | <x>0</x> |
|
833 | <x>0</x> | |
834 | <y>0</y> |
|
834 | <y>0</y> | |
835 | <width>809</width> |
|
835 | <width>809</width> | |
836 |
<height>2 |
|
836 | <height>21</height> | |
837 | </rect> |
|
837 | </rect> | |
838 | </property> |
|
838 | </property> | |
839 | <widget class="QMenu" name="menuFile"> |
|
839 | <widget class="QMenu" name="menuFile"> |
@@ -2,8 +2,8 | |||||
2 |
|
2 | |||
3 | # Form implementation generated from reading ui file '/home/ricardoar/JRO_SVN/eric4/jro_backup_manager/ui/MainWindow.ui' |
|
3 | # Form implementation generated from reading ui file '/home/ricardoar/JRO_SVN/eric4/jro_backup_manager/ui/MainWindow.ui' | |
4 | # |
|
4 | # | |
5 |
# Created: Tue May 18 |
|
5 | # Created: Tue May 18 22:39:04 2010 | |
6 |
# by: PyQt4 UI code generator 4.7. |
|
6 | # by: PyQt4 UI code generator 4.7.2 | |
7 | # |
|
7 | # | |
8 | # WARNING! All changes made in this file will be lost! |
|
8 | # WARNING! All changes made in this file will be lost! | |
9 |
|
9 | |||
@@ -452,7 +452,7 | |||||
452 | self.verticalLayout.addLayout(self.horizontalLayout_2) |
|
452 | self.verticalLayout.addLayout(self.horizontalLayout_2) | |
453 | MainWindow.setCentralWidget(self.centralwidget) |
|
453 | MainWindow.setCentralWidget(self.centralwidget) | |
454 | self.menubar = QtGui.QMenuBar(MainWindow) |
|
454 | self.menubar = QtGui.QMenuBar(MainWindow) | |
455 |
self.menubar.setGeometry(QtCore.QRect(0, 0, 809, 2 |
|
455 | self.menubar.setGeometry(QtCore.QRect(0, 0, 809, 21)) | |
456 | self.menubar.setObjectName("menubar") |
|
456 | self.menubar.setObjectName("menubar") | |
457 | self.menuFile = QtGui.QMenu(self.menubar) |
|
457 | self.menuFile = QtGui.QMenu(self.menubar) | |
458 | self.menuFile.setObjectName("menuFile") |
|
458 | self.menuFile.setObjectName("menuFile") |
General Comments 0
You need to be logged in to leave comments.
Login now