# SVN changeset patch # User ralonso # Date 2010-05-26 20:07:52.835563 # Revision 84 #para prueba de verificacion de datos en el proceso de 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 83) +++ b/bk_manager/trunk/functions/functions.py (revision 84) @@ -94,20 +94,35 @@ #------------------------------------------------- Crea directorios en la ruta indicada ----------------------------------------------------------- def make_dirs(list_dirs, self): - """ - - """ - + for var_dir in list_dirs: shutil.rmtree(self.var_Rpath+'/'+var_dir, True) - var_output=commands.getstatusoutput("mkdir -p "+self.var_Rpath+'/'+var_dir)[0] - if var_output != 0: - self.txtInfo.append("Error creating directory: "+var_dir+", output_error:" + str(var_output)) + var_output=commands.getstatusoutput("mkdir -p "+self.var_Rpath+'/'+var_dir) + if var_output[0] != 0: + self.txtInfo.append("Error creating directory: "+var_dir+", output_error:" + str(var_output[0])) return False self.txtInfo.append('Directories created correctly') return True - +def remove_dir(var_dir, self): + var_output = commands.getstatusoutput('chmod -R 777 '+var_dir) + if var_output[0] != 0: + self.txtInfo.append("Error changing permissions: "+var_dir+", output_error:" + str(var_output[0])) + return False + + var_output = commands.getstatusoutput('rm -rf '+var_dir) + if var_output[0] != 0: + self.txtInfo.append("Error deleting directory: "+var_dir+", output_error:" + str(var_output[0])) + return False + return True + +def make_dir(var_dir, self): + var_output = commands.getstatusoutput('mkdir '+var_dir) + if var_output[0] != 0: + self.txtInfo.append("Error deleting directory: "+var_dir+", output_error:" + str(var_output[0])) + return False + return True + #-------------------------------------------- Busca los archivos con los parametros de busqueda --------------------------------------- def list_files(self): @@ -281,9 +296,18 @@ var_cmd = "growisofs -dvd-compat -Z "+var_dev_tmp+"="+ file_iso return var_cmd -def cmd_check(self): - var_cmd = "echo 'function check'" - return var_cmd + +def cmd_check(dev_sr, self): + + var_Rpath_tmpdata=self.var_Rpath+"/tmpdata" + + var_output=commands.getstatusoutput('df -hT | grep '+dev_sr) + if var_output[0] != 0: + return "FATAL ERROR" + else: + var_cmd = "cp -rfv "+var_output[1] .split()[-1]+"/ "+var_Rpath_tmpdata+"/" + return var_cmd + def remove_iso(self): var_Rpath_iso=self.var_Rpath+"/iso" 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 83) +++ b/bk_manager/trunk/functions/functions2.py (revision 84) @@ -56,6 +56,31 @@ var_cmd = 'eject ' + var_dev commands.getstatusoutput(var_cmd) +#Expulsa el dispositivo de grabacion actual +def eject_one_device(self): + var_index = ( ( (self.var_disc_n - 1) * self.var_Copys) + (self.var_copy_n - 1) - self.var_burned_discs ) % len(self.var_devices) + var_dev = self.var_devices[var_index] + var_cmd = 'eject ' + var_dev + commands.getstatusoutput(var_cmd) + +def eject_t_one_device(self): + var_index = ( ( (self.var_disc_n - 1) * self.var_Copys) + (self.var_copy_n - 1) - self.var_burned_discs ) % len(self.var_devices) + var_dev = self.var_devices[var_index] + var_cmd = 'eject -t ' + var_dev + commands.getstatusoutput(var_cmd) + +def get_dev_sr(self): + var_index = ( ( (self.var_disc_n - 1) * self.var_Copys) + (self.var_copy_n - 1) - self.var_burned_discs ) % len(self.var_devices) + var_dev = self.var_devices[var_index] + var_output=commands.getstatusoutput('ls -lh '+var_dev) + if var_output[0] != 0: + return "FATAL ERROR" + else: + var_dev_sr = "/dev/"+var_output[1] .split()[-1] + return var_dev_sr + + + #----------------------------------- listado de los dispositivos de grabacion seleccionados -------------------------------------------- def selected_devices(self): @@ -187,14 +212,17 @@ self.btnStartburn.setEnabled(not(var_bool)) self.btnStopburn.setEnabled(var_bool) self.chkCheck.setEnabled(not(var_bool)) + self.chkCheck.setChecked(False) + self.actionChange_Parameters.setEnabled(False) + #---------------------------------------------- Actualiza estado en los labels ------------------------------------------------------- -def update_message(type, message, self, index=0): +def update_message(type, message, self, index=0, ): if index == 0: var_index = ( ( (self.var_disc_n - 1) * self.var_Copys) + (self.var_copy_n - 1) - self.var_burned_discs ) % len(self.var_devices) else: 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 83) +++ b/bk_manager/trunk/ui/MainWindow.py (revision 84) @@ -32,10 +32,9 @@ def setupUi2(self): - self.txtInfo.append("cambio") - - - self.allTrue = True + self.txtInfo.append("cambio 1") + + self.allTrue = False if self.allTrue == True: self.var_real_principal = True @@ -47,11 +46,11 @@ self.var_real_show_cmd = True else: - self.var_real_principal = True + self.var_real_principal = False self.var_real_detect_devices = False - self.var_real_iso = True + self.var_real_iso = False self.var_real_burn = False - self.var_real_check = False + self.var_real_check = True self.var_real_eject = False self.var_real_show_cmd = True @@ -459,7 +458,7 @@ if not(self.bool_state_burning): return - + if self.process_check.exitCode() == 0: self.txtInfo.append("--------Complete checking, disc: "+str(self.var_disc_n)+" copy: "+str(self.var_copy_n)) functions2.update_message(2, "CHECKED", self) @@ -468,7 +467,22 @@ self.txtInfo.append("#######Error checking, disc: "+functions.i2s(self.var_disc_n)+" copy: " +functions.i2s(self.var_copy_n)+", code "+QtCore.QString(self.process_check.exitCode())) functions2.update_message(2, "ERROR", self) - + + #borrar el contenido de tmpdata + var_tmpdata=self.var_Rpath+"/tmpdata" + + bool_return = functions.remove_dir(var_tmpdata, self) + if not(bool_return): + self.txtInfo.append("Error deleting directory: "+var_tmpdata) + self.bool_state_burning = False + return + + bool_return = functions.make_dir(var_tmpdata, self) + if not(bool_return): + self.txtInfo.append("Error creating directory:"+ var_tmpdata) + self.bool_state_burning = False + return + functions.is_last_disc_and_copy(self) @@ -551,9 +565,16 @@ #Verificacion de los discos if self.var_step == 2: self.txtInfo.append("-----------checking disc:"+str(self.var_disc_n)+", copy:"+str(self.var_copy_n)) + + functions2.eject_one_device(self) + functions2.eject_t_one_device(self) + self.txtInfo.append("Waiting ...") + time .sleep(20) + functions2.update_message(2, "CHECKING", self) - - var_cmd = functions.cmd_check(self) + + dev_sr = functions2.get_dev_sr(self) + var_cmd = functions.cmd_check(dev_sr, self) if self.var_real_show_cmd == True: self.txtInfo.append("CMD: "+var_cmd) Index: bk_manager/trunk/ui/MainWindow.ui =================================================================== diff --git a/bk_manager/trunk/ui/MainWindow.ui b/bk_manager/trunk/ui/MainWindow.ui --- a/bk_manager/trunk/ui/MainWindow.ui (revision 83) +++ b/bk_manager/trunk/ui/MainWindow.ui (revision 84) @@ -1002,6 +1002,9 @@ false + + + true