# SVN changeset patch # User ralonso # Date 2010-05-18 16:14:27.493653 # Revision 54 OK_probado_con_/ ahora se hara prueba sin / 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 53) +++ b/bk_manager/trunk/functions/functions.py (revision 54) @@ -32,14 +32,12 @@ #Se verifica que la ruta exista y sea un directorio def dir_exists(var_dir, self): - var_cmd="test -d "+str(var_dir) - var_output=commands.getstatusoutput(var_cmd)[0] - if var_output != 0: - self.txtInfo.append("Ruta no valida, output_error:" + str(var_output)) - return False - else: + if os.path.isdir(var_dir): self.txtInfo.append("Ruta valida, sin error:" + str(var_dir)) return True + else: + self.txtInfo.append("Ruta no valida, output_error:" + str(var_dir)) + return False #Se buscan los archivos del tipo especificado 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 53) +++ b/bk_manager/trunk/functions/functions2.py (revision 54) @@ -12,13 +12,9 @@ """ Se usa para inicializar ciertos parametros para pruebas """ - #self.txtDpath.setText('/home/ricardoar/optional/STORAGE/Data/RAW_EXP/JASMET/') - #self.txtRpath.setText('/home/ricardoar/optional/STORAGE/prueba1_jro_backup_manager/') self.txtDpath.setText('/home/ricardoar/optional/STORAGE/EW_DRIFTS/') self.txtRpath.setText('/home/ricardoar/optional/prueba1_jro_backup_manager/') - self.txtElabel.setText('EW_DRIFTS') - self.statusDpath = True - self.statusRpath = True + self.txtElabel.setText('EW_DRIFTS_pruebas') self.lstDcapacity.setCurrentIndex(4) self.txtDcapacity.setValue(250.0) self.txtDcapacity.setReadOnly(False) @@ -72,6 +68,7 @@ self.btnRestart.setEnabled(var_bool) self.btnStartburn.setEnabled(var_bool) + def make_parameters_conf(self): var_file = open("parameters.conf","w") @@ -102,3 +99,13 @@ 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() + 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 53) +++ b/bk_manager/trunk/ui/MainWindow.py (revision 54) @@ -30,52 +30,44 @@ def setupUi2(self): - #sys.stdout = self - - var_tmp = os.path.isfile("parameters.conf") - - if var_tmp == True: + functions2.detect_devices(self) #busca los dispositivos de grabacion + + #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) - else: self.txtInfo.append("Elija los parametros de configuracion") - - self.statusDpath = False - self.statusRpath = False - - functions2.set_parameters(self) #Establece ciertos parametros, para pruebas - - 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() + functions2.set_parameters(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=[] - functions2.detect_devices(self) #busca los dispositivos de grabacion - functions.load_days(self) + functions.load_days(self) self.var_process = QtCore.QProcess() self.connect(self.var_process, QtCore.SIGNAL('readyReadStandardOutput()'), self.readOuput) self.connect(self.var_process, QtCore.SIGNAL('readyReadStandardError()'), self.readError) - self.connect(self.var_process, QtCore.SIGNAL('finished(int,QProcess::ExitStatus)'), self.finished1) + self.connect(self.var_process, QtCore.SIGNAL('finished(int,QProcess::ExitStatus)'), self.finished) def readOuput(self): - self.txtSburn.append("stdout: " + QtCore.QString(self.var_process.readAllStandardOutput())) + self.txtSburn.insertPlainText("stdout: " + QtCore.QString(self.var_process.readAllStandardOutput())) + def readError(self): - self.txtSburn.append("stderr: " + QtCore.QString(self.var_process.readAllStandardError())) - - def finished1(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))