# SVN changeset patch # User ralonso # Date 2010-05-18 20:26:54.703517 # Revision 57 redefiniendo parte grabacion Index: bk_manager/trunk/functions/functions.py =================================================================== diff --git a/bk_manager/trunk/functions/functions.py b/bk_manager/trunk/functions/functions.py --- a/bk_manager/trunk/functions/functions.py (revision 56) +++ b/bk_manager/trunk/functions/functions.py (revision 57) @@ -130,12 +130,8 @@ var_file = open(var_Rpath_ppath+"/"+self.var_Elabel+"_"+i2s(var_n)+".dat","w") #Se añade la lista de archivos a grabar en el DVD al archivo .dat for line in var_files_list_2: - var_tmp_path=(line.split(self.var_Dpath)[1]).split('/') - var_tmp_path2="/" - for l in range(0, len(var_tmp_path)-1): - var_tmp_path2=var_tmp_path2+str(var_tmp_path[l])+"/" - var_file.write(var_tmp_path2+'=') - var_file.write(line+'\n') + var_tmp_path=line.split(self.var_Dpath)[1][:-13] + var_file.write(var_tmp_path+'='+line+'\n') var_file.close() var_tmp = var_size_i #Se asigna a la variable el tamaño del archivo actual @@ -147,14 +143,10 @@ var_file = open(var_Rpath_ppath+"/"+self.var_Elabel+"_"+i2s(var_n)+".dat","w") #Se añade la lista de archivos a grabar en el DVD al archivo .dat for line in var_files_list_2: - var_tmp_path=(line.split(self.var_Dpath)[1]).split('/') - var_tmp_path2="/" - for l in range(0, len(var_tmp_path)-1): - var_tmp_path2=var_tmp_path2+str(var_tmp_path[l])+"/" - var_file.write(var_tmp_path2+'=') - var_file.write(line+'\n') + var_tmp_path=line.split(self.var_Dpath)[1][:-13] + var_file.write(var_tmp_path+'='+line+'\n') var_file.close() - + return var_n @@ -190,7 +182,7 @@ if var_first_folder == '/': var_folder = self.var_Elabel else: - var_folder = var_first_folder.split('/')[1] + var_folder = var_first_folder.split('/')[-2] var_file_print.write(var_first_file[-12:-8]+" "+var_first_file[-8:-5]+" "+var_folder +" "+var_first_file[-5:-2]+" " +var_last_file[-5:-2]+" "+var_date_first_file+" "+var_date_last_file+"\n") @@ -205,7 +197,7 @@ if var_first_folder == '/': var_folder = self.txtElabel.text() else: - var_folder = var_first_folder.split('/')[1] + var_folder = var_first_folder.split('/')[-2] var_file_print.write(var_first_file[-12:-8]+" "+var_first_file[-8:-5]+" "+var_folder +" "+var_first_file[-5:-2]+" " +var_last_file[-5:-2]+" "+var_date_first_file+" "+var_date_last_file+"\n") Index: bk_manager/trunk/functions/functions2.py =================================================================== diff --git a/bk_manager/trunk/functions/functions2.py b/bk_manager/trunk/functions/functions2.py --- a/bk_manager/trunk/functions/functions2.py (revision 56) +++ b/bk_manager/trunk/functions/functions2.py (revision 57) @@ -6,19 +6,7 @@ import os import subprocess import commands - - -def set_parameters(self): - """ - Se usa para inicializar ciertos parametros para pruebas - """ - self.txtDpath.setText('/home/ricardoar/optional/STORAGE/EW_DRIFTS') - self.txtRpath.setText('/home/ricardoar/optional/prueba1_jro_backup_manager') - self.txtElabel.setText('EW_DRIFTS_pruebas') - self.lstDcapacity.setCurrentIndex(4) - self.txtDcapacity.setValue(250.0) - self.txtDcapacity.setReadOnly(False) - + def detect_devices(self): """ @@ -60,18 +48,20 @@ self.chkDevD.setChecked(False) self.chkDevD.setEnabled(False) -def enabled_items1(var_bool, self): - self.tabParameters.setEnabled(not(var_bool)) - self.lstDcapacity.setEnabled(not(var_bool)) - self.txtDcapacity.setEnabled(not(var_bool)) - self.btnGbkp.setEnabled(not(var_bool)) - self.btnRestart.setEnabled(var_bool) - self.btnStartburn.setEnabled(var_bool) +def set_parameters_test(self): + """ + Se usa para inicializar ciertos parametros para pruebas + """ + self.txtDpath.setText('/home/ricardoar/optional/STORAGE/EW_DRIFTS') + self.txtRpath.setText('/home/ricardoar/optional/prueba1_jro_backup_manager') + self.txtElabel.setText('EW_DRIFTS_pruebas') + self.lstDcapacity.setCurrentIndex(4) + self.txtDcapacity.setValue(250.0) + self.txtDcapacity.setReadOnly(False) def make_parameters_conf(self): var_file = open("parameters.conf","w") - var_file.write(self.var_Dpath+"\n") #0 var_file.write(self.var_Rpath+"\n") #1 var_file.write(str(self.var_lstDtype)+"\n") #2 @@ -80,14 +70,13 @@ var_file.write(str(self.var_Copys)+"\n") #5 var_file.write(str(self.var_lstDcapacity)+"\n") #6 var_file.write(str(self.var_Dcapacity)+"\n") #7 - + var_file.write(str(self.var_n_discs)) #8 var_file.close() def get_parameters_conf(self): var_file = open("parameters.conf","r") lines = var_file.readlines() - self.txtDpath.setText(lines[0][:-1]) #0 self.txtRpath.setText(lines[1][:-1]) #1 self.lstDtype.setCurrentIndex(int(lines[2])) #2 @@ -95,17 +84,32 @@ self.txtElabel.setText(lines[4][:-1]) #4 self.txtCopys.setValue(int(lines[5][:-1])) #5 self.lstDcapacity.setCurrentIndex(int(lines[6])) #6 - self.txtDcapacity.setValue(float(lines[7])) - + self.txtDcapacity.setValue(float(lines[7])) #7 + self.var_n_discs = int(lines[8]) # 8 var_file.close() + def set_vars(self): - self.var_Dpath = self.txtDpath.text() - self.var_Rpath = self.txtRpath.text() - self.var_lstDtype = self.lstDtype.currentIndex() - self.var_Dtype = self.txtDtype.text() - self.var_Elabel = self.txtElabel.text() - self.var_Copys = self.txtCopys.value() - self.var_lstDcapacity = self.lstDcapacity.currentIndex() - self.var_Dcapacity = self.txtDcapacity.value() - + self.var_Dpath = self.txtDpath.text() #0 + self.var_Rpath = self.txtRpath.text() #1 + self.var_lstDtype = self.lstDtype.currentIndex() #2 + self.var_Dtype = self.txtDtype.text() #3 + self.var_Elabel = self.txtElabel.text() #4 + self.var_Copys = self.txtCopys.value() #5 + self.var_lstDcapacity = self.lstDcapacity.currentIndex() #6 + self.var_Dcapacity = self.txtDcapacity.value() #7 + + +def enabled_items1(var_bool, self): + self.tabParameters.setEnabled(not(var_bool)) + self.lstDcapacity.setEnabled(not(var_bool)) + self.txtDcapacity.setEnabled(not(var_bool)) + self.btnGbkp.setEnabled(not(var_bool)) + self.btnRestart.setEnabled(var_bool) + self.btnStartburn.setEnabled(var_bool) + + +def enabled_items2(var_bool, self): + self.btnRestart.setEnabled(not(var_bool)) + self.btnStartburn.setEnabled(not(var_bool)) + self.btnStopburn.setEnabled(var_bool) Index: bk_manager/trunk/ui/MainWindow.py =================================================================== diff --git a/bk_manager/trunk/ui/MainWindow.py b/bk_manager/trunk/ui/MainWindow.py --- a/bk_manager/trunk/ui/MainWindow.py (revision 56) +++ b/bk_manager/trunk/ui/MainWindow.py (revision 57) @@ -12,7 +12,7 @@ from subprocess import * import sys import os -import subprocess +#import subprocess import commands from functions import functions from functions import functions2 @@ -32,23 +32,23 @@ functions2.detect_devices(self) #busca los dispositivos de grabacion + self.var_n_discs=0 + self.var_list=[] + self.var_sublist=[] + #Revisa si existe el archivo de confirguracion if os.path.isfile("parameters.conf"): self.txtInfo.append("Archivo de configuracion encontrado") functions2.get_parameters_conf(self) + self.txtInfo.append("El proyecto creara "+str(self.var_n_discs)+" DVDs") else: self.txtInfo.append("Elija los parametros de configuracion") - functions2.set_parameters(self) #Establece ciertos parametros, para pruebas + functions2.set_parameters_test(self) #Establece ciertos parametros, para pruebas functions2.set_vars(self) #Carga las variables de la clase con los parametros seleccionados self.statusDpath = functions.dir_exists(self.var_Dpath, self) self.statusRpath = functions.dir_exists(self.var_Rpath, self) - - self.var_n_discs=0 - self.var_list=[] - self.var_sublist=[] - functions.load_days(self) self.var_process = QtCore.QProcess() @@ -56,21 +56,22 @@ self.connect(self.var_process, QtCore.SIGNAL('readyReadStandardError()'), self.readError) self.connect(self.var_process, QtCore.SIGNAL('finished(int,QProcess::ExitStatus)'), self.finished) + + def write(self, txt): + self.txtInfo.append(str(txt)) + + +#----------------------------------------------------- Funciones del proceso --------------------------------------------------------------- + def readOuput(self): self.txtSburn.insertPlainText("stdout: " + QtCore.QString(self.var_process.readAllStandardOutput())) - def readError(self): self.txtSburn.insertPlainText("stderr: " + QtCore.QString(self.var_process.readAllStandardError())) - def finished(self): - self.txtInfo.append("proceso terminado finished()") - print self.var_process.exitCode() - - - def write(self, txt): - self.txtInfo.append(str(txt)) + self.txtInfo.append("proceso terminado finished() "+QtCore.QString(self.var_process.exitCode())) + #----------------------------------------------------- Obtencion de las ruta de los datos --------------------------------------------------------------- @@ -268,14 +269,14 @@ """ Se inicia el proceso de grabacion """ - self.btnRestart.setEnabled(False) - self.btnStartburn.setEnabled(False) - self.btnStopburn.setEnabled(True) + functions2.enabled_items2(True, self) sys.stdout = self #sys.stderr = self print "stdout_!!!" + + #Inicializando variables var_Rpath_ppath=self.var_Rpath+"/ppath" var_Rpath_iso=self.var_Rpath+"/iso" @@ -288,9 +289,7 @@ var_cmd += ' -A '+self.var_Elabel+' -V '+self.var_Elabel var_cmd += ' -graft-points -path-list '+ file_dat+' -o '+file_iso -# self.process.start(var_cmd) self.var_process.start(var_cmd) -# self.var_process.waitForFinished() self.txtInfo.append("ejecutandose") @@ -305,13 +304,6 @@ # var_cmd += ' -graft-points -path-list '+ file_dat+' -o '+file_iso # self.txtInfo.append(var_cmd) # -# var_output=commands.getstatusoutput(str(var_cmd))[0] -# self.txtInfo.append(str(var_output)) - - #os.system(str(var_cmd)) - #p = subprocess.Popen(str('ls /'), shell=True, stdout=self) - #os.waitpid(p.pid, 0) - ####self.txtInfo.append(str(p.pid)) #----------------------------------------------------- Detener proceso de grabacion --------------------------------------------------------------- @@ -321,10 +313,8 @@ """ Slot documentation goes here. """ - self.var_process.terminate() - self.btnRestart.setEnabled(True) - self.btnStartburn.setEnabled(True) - self.btnStopburn.setEnabled(False) + self.var_process.terminate() #Termina el proceso, si puede + functions2.enabled_items2(False, self) #----------------------------------------------------- Testeo de las unidades de grabacion ---------------------------------------------------------------