|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
"""
|
|
|
Module implementing MainWindow.
|
|
|
"""
|
|
|
|
|
|
from PyQt4.QtGui import QMainWindow
|
|
|
from PyQt4.QtCore import pyqtSignature
|
|
|
from PyQt4 import QtCore
|
|
|
from Ui_MainWindow import Ui_MainWindow
|
|
|
from Ui_Parameters import Ui_Parameters
|
|
|
from Ui_About import Ui_About
|
|
|
from PyQt4 import QtGui
|
|
|
from subprocess import *
|
|
|
import sys
|
|
|
import os
|
|
|
#import subprocess
|
|
|
import time
|
|
|
import commands
|
|
|
from functions import functions
|
|
|
from functions import functions2
|
|
|
|
|
|
class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
"""
|
|
|
Class documentation goes here.
|
|
|
"""
|
|
|
|
|
|
def __init__(self, parent = None):
|
|
|
QMainWindow.__init__(self, parent)
|
|
|
self.setupUi(self)
|
|
|
self.setupUi2()
|
|
|
|
|
|
def setupUi2(self):
|
|
|
|
|
|
self.txtInfo.append("cambio 1")
|
|
|
|
|
|
self.allTrue = False
|
|
|
|
|
|
if self.allTrue == True:
|
|
|
self.var_real_principal = True
|
|
|
self.var_real_detect_devices = True
|
|
|
self.var_real_iso = True
|
|
|
self.var_real_burn = True
|
|
|
self.var_real_check = True
|
|
|
self.var_real_eject = True
|
|
|
self.var_real_manual_check = True
|
|
|
self.var_real_show_cmd = True
|
|
|
|
|
|
else:
|
|
|
self.var_real_principal = False
|
|
|
self.var_real_detect_devices = False
|
|
|
self.var_real_iso = False
|
|
|
self.var_real_burn = False
|
|
|
self.var_real_check = False
|
|
|
self.var_real_eject = False
|
|
|
self.var_real_manual_check = True
|
|
|
self.var_real_show_cmd = True
|
|
|
|
|
|
if self.var_real_detect_devices == True:
|
|
|
# Reconocimiento de los dispositivos de grabacion
|
|
|
functions2.detect_devices(self)
|
|
|
else:
|
|
|
functions2.set_devices_test(self)
|
|
|
|
|
|
#Inicialiazacion de variables
|
|
|
self.var_Discs = 0 #Numero de discos del proyecto
|
|
|
self.var_Copys = 0 #Numero de copias
|
|
|
self.var_disc_n = 0 # disco actual
|
|
|
self.var_copy_n = 0 # copia actual
|
|
|
self.var_burned_discs = 0 #numero de discos ya grabados
|
|
|
|
|
|
self.bool_first_iso = False
|
|
|
self.var_step = 0 # numero de paso en el proceso
|
|
|
self.bool_state_burning = False #si es True se puede grabar
|
|
|
self.blank_discs = False # Si es true significa que se acaban de ingresar discos en blanco
|
|
|
|
|
|
self.var_list=[] # Lista de DOYs
|
|
|
self.var_sublist=[] # Sub-lista de DOYs seleccionados
|
|
|
self.var_devices=[] #Lista de dispositivos seleccionados
|
|
|
|
|
|
#Revisa si existe el archivo de confirguracion y lo carga
|
|
|
if os.path.isfile("parameters.conf"):
|
|
|
functions2.get_parameters_conf(self)
|
|
|
self.bool_first_iso = True
|
|
|
self.txtInfo.append("Parameters were loaded from configuration file")
|
|
|
self.txtInfo.append("Total number of discs for recording: "+str(self.var_Discs * self.var_Copys))
|
|
|
|
|
|
elif self.var_real_principal == False:
|
|
|
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)
|
|
|
functions.load_days(self)
|
|
|
|
|
|
if os.path.isfile("parameters.conf"):
|
|
|
functions2.enabled_items1(True, self) #Se bloquean los parametros de configuracion
|
|
|
|
|
|
if os.path.isfile("burning.conf"):
|
|
|
functions2.get_burning_conf(self)
|
|
|
self.txtInfo.append("Current disc: "+str(self.var_disc_n))
|
|
|
self.txtInfo.append("Current copy: "+str(self.var_copy_n))
|
|
|
self.txtInfo.append("Burned discs: "+str(self.var_burned_discs))
|
|
|
self.btnStartburn.setText("Continue")
|
|
|
self.actionChange_Parameters.setEnabled(False)
|
|
|
|
|
|
self.connect(self.actionChange_Parameters, QtCore.SIGNAL("triggered()"), self.changeParameters)
|
|
|
self.connect(self.actionAbout, QtCore.SIGNAL("triggered()"), self.about)
|
|
|
|
|
|
self.process_iso = QtCore.QProcess()
|
|
|
self.connect(self.process_iso, QtCore.SIGNAL('readyReadStandardOutput()'), self.readOuput_iso)
|
|
|
self.connect(self.process_iso, QtCore.SIGNAL('readyReadStandardError()'), self.readError_iso)
|
|
|
self.connect(self.process_iso, QtCore.SIGNAL('finished(int,QProcess::ExitStatus)'), self.finished_iso)
|
|
|
|
|
|
self.process_burn = QtCore.QProcess()
|
|
|
self.connect(self.process_burn, QtCore.SIGNAL('readyReadStandardOutput()'), self.readOuput_burn)
|
|
|
self.connect(self.process_burn, QtCore.SIGNAL('readyReadStandardError()'), self.readError_burn)
|
|
|
self.connect(self.process_burn, QtCore.SIGNAL('finished(int,QProcess::ExitStatus)'), self.finished_burn)
|
|
|
|
|
|
self.process_check = QtCore.QProcess()
|
|
|
self.connect(self.process_check, QtCore.SIGNAL('readyReadStandardOutput()'), self.readOuput_check)
|
|
|
self.connect(self.process_check, QtCore.SIGNAL('readyReadStandardError()'), self.readError_check)
|
|
|
self.connect(self.process_check, QtCore.SIGNAL('finished(int,QProcess::ExitStatus)'), self.finished_check)
|
|
|
|
|
|
self.process_manual_check = QtCore.QProcess()
|
|
|
self.connect(self.process_manual_check, QtCore.SIGNAL('readyReadStandardOutput()'), self.readOuput_manual_check)
|
|
|
self.connect(self.process_manual_check, QtCore.SIGNAL('readyReadStandardError()'), self.readError_manual_check)
|
|
|
self.connect(self.process_manual_check, QtCore.SIGNAL('finished(int,QProcess::ExitStatus)'), self.finished_manual_check)
|
|
|
|
|
|
def changeParameters(self):
|
|
|
dlg=QtGui.QDialog()
|
|
|
dlgui=Ui_Parameters()
|
|
|
dlgui.setupUi(dlg)
|
|
|
if (dlg.exec_() == QtGui.QDialog.Accepted):
|
|
|
if dlgui.txtDisc.value() > self.var_Discs or dlgui.txtCopy.value() > dlgui.txtNcopys.value():
|
|
|
self.txtInfo.append("Wrong parameters")
|
|
|
else:
|
|
|
self.var_Copys = dlgui.txtNcopys.value()
|
|
|
self.var_disc_n = dlgui.txtDisc.value()
|
|
|
self.var_copy_n = dlgui.txtCopy.value()
|
|
|
self.txtInfo.append("Changed parameters")
|
|
|
self.var_burned_discs = ( ( (self.var_disc_n - 1) * self.var_Copys) + self.var_copy_n -1 )
|
|
|
self.bool_first_iso = True
|
|
|
self.txtInfo.append("Current disc: "+str(self.var_disc_n))
|
|
|
self.txtInfo.append("Current copy: "+str(self.var_copy_n))
|
|
|
self.txtInfo.append("Nro Copys: "+str(self.var_Copys))
|
|
|
functions2.make_parameters_conf(self)
|
|
|
self.txtCopys.setValue(self.var_Copys) #Actualizo mananualmente el valor Copys
|
|
|
|
|
|
|
|
|
|
|
|
def about(self):
|
|
|
dlg_about=QtGui.QDialog()
|
|
|
dlgui_about=Ui_About()
|
|
|
dlgui_about.setupUi(dlg_about)
|
|
|
dlg_about.exec_()
|
|
|
|
|
|
|
|
|
#==============================================================================
|
|
|
# Manejo de los eventos
|
|
|
#==============================================================================
|
|
|
|
|
|
#----------------------------------------------------- Obtencion de la ruta de los datos ---------------------------------------------------------------
|
|
|
|
|
|
@pyqtSignature("")
|
|
|
def on_btnDpath_clicked(self):
|
|
|
"""
|
|
|
Permite seleccionar graficamente el direcorio de los datos a grabar
|
|
|
"""
|
|
|
self.var_Dpath= str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly))
|
|
|
self.txtDpath.setText(self.var_Dpath)
|
|
|
self.statusDpath = functions.dir_exists(self.var_Dpath, self)
|
|
|
functions.load_days(self)
|
|
|
|
|
|
|
|
|
@pyqtSignature("")
|
|
|
def on_txtDpath_editingFinished(self):
|
|
|
"""
|
|
|
Carga la ruta editada y verifica que sea correcta y carga la lista de dias
|
|
|
"""
|
|
|
self.var_Dpath=str(self.txtDpath.text()) #Se carga la variable con la ruta recien editada
|
|
|
self.statusDpath = functions.dir_exists(self.var_Dpath, self)
|
|
|
functions.load_days(self)
|
|
|
|
|
|
|
|
|
#----------------------------------------------------- Obtencion de las ruta del proyecto ---------------------------------------------------------------
|
|
|
|
|
|
@pyqtSignature("")
|
|
|
def on_btnRpath_clicked(self):
|
|
|
"""
|
|
|
Permite seleccionar graficamente el direcorio del proyecto
|
|
|
"""
|
|
|
self.var_Rpath = str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly))
|
|
|
self.txtRpath.setText(self.var_Rpath)
|
|
|
self.statusRpath = functions.dir_exists(self.var_Rpath, self)
|
|
|
|
|
|
|
|
|
@pyqtSignature("")
|
|
|
def on_txtRpath_editingFinished(self):
|
|
|
"""
|
|
|
Valida la ruta del proyecto
|
|
|
"""
|
|
|
self.var_Rpath = str(self.txtRpath.text()) #Se carga la variable con la ruta recien editada
|
|
|
self.statusRpath = functions.dir_exists(self.var_Rpath, self)
|
|
|
|
|
|
|
|
|
#----------------------------------------------------- Tipo de datos ---------------------------------------------------------------
|
|
|
|
|
|
@pyqtSignature("int")
|
|
|
def on_lstDtype_activated(self, index):
|
|
|
"""
|
|
|
Permite elegir entre los tipos de archivos
|
|
|
"""
|
|
|
self.txtDtype.setReadOnly(True)
|
|
|
if index == 0:
|
|
|
self.var_Dtype ='r'
|
|
|
elif index == 1:
|
|
|
self.var_Dtype ='pdata'
|
|
|
elif index == 2:
|
|
|
self.var_Dtype ='sswma'
|
|
|
else :
|
|
|
self.var_Dtype =''
|
|
|
self.txtDtype.setReadOnly(False)
|
|
|
|
|
|
self.txtDtype.setText(self.var_Dtype)
|
|
|
functions.load_days(self) #llamada a funcion
|
|
|
|
|
|
@pyqtSignature("")
|
|
|
def on_txtDtype_editingFinished(self):
|
|
|
self.var_Dtype=str(self.txtDtype.text())
|
|
|
functions.load_days(self) #llamada a funcion
|
|
|
|
|
|
|
|
|
#----------------------------------------------------- Etiqueta ---------------------------------------------------------------
|
|
|
|
|
|
@pyqtSignature("")
|
|
|
def on_txtElabel_editingFinished(self):
|
|
|
self.var_Elabel = str(self.txtElabel.text())
|
|
|
|
|
|
#----------------------------------------------------- Numero de copias ---------------------------------------------------------------
|
|
|
@pyqtSignature("")
|
|
|
def on_txtCopys_editingFinished(self):
|
|
|
self.var_Copys = self.txtCopys.value()
|
|
|
|
|
|
#----------------------------------------------------- Seleccion del rango de fechas ---------------------------------------------------------------
|
|
|
|
|
|
@pyqtSignature("int") #CLOSED
|
|
|
def on_lstStartDay_activated(self, index):
|
|
|
"""
|
|
|
Cambia la lista de opciones en lstStopDay
|
|
|
"""
|
|
|
var_StopDay_index=self.lstStopDay.count() - self.lstStopDay.currentIndex()
|
|
|
self.lstStopDay.clear()
|
|
|
|
|
|
for i in self.var_list[index:]:
|
|
|
self.lstStopDay.addItem(i)
|
|
|
|
|
|
self.lstStopDay.setCurrentIndex(self.lstStopDay.count() - var_StopDay_index)
|
|
|
|
|
|
functions.get_sub_list(self)
|
|
|
|
|
|
|
|
|
@pyqtSignature("int") #CLOSED
|
|
|
def on_lstStopDay_activated(self, index):
|
|
|
"""
|
|
|
Cambia la lista de opciones en lstStartDay
|
|
|
"""
|
|
|
var_StartDay_index=self.lstStartDay.currentIndex()
|
|
|
var_end_index = self.lstStopDay.count() - index
|
|
|
self.lstStartDay.clear()
|
|
|
|
|
|
for i in self.var_list[:len(self.var_list) - var_end_index + 1]:
|
|
|
self.lstStartDay.addItem(i)
|
|
|
|
|
|
self.lstStartDay.setCurrentIndex(var_StartDay_index)
|
|
|
|
|
|
functions.get_sub_list(self)
|
|
|
|
|
|
|
|
|
#----------------------------------------------------- Capacidad del dispositivo de grabacion ---------------------------------------------------------------
|
|
|
|
|
|
@pyqtSignature("")
|
|
|
def on_txtDcapacity_editingFinished(self):
|
|
|
self.var_Dcapacity = self.txtDcapacity.value()
|
|
|
|
|
|
|
|
|
@pyqtSignature("int") #CLOSED
|
|
|
def on_lstDcapacity_activated(self, index):
|
|
|
"""
|
|
|
Permite elegir el tamaƱo del disco
|
|
|
"""
|
|
|
if index == 0:
|
|
|
var_size=25.0
|
|
|
elif index == 1:
|
|
|
var_size=8.5
|
|
|
elif index == 2:
|
|
|
var_size=4.7
|
|
|
elif index == 3:
|
|
|
var_size=0.7
|
|
|
|
|
|
if index != 4:
|
|
|
self.txtDcapacity.setValue(var_size*10**9/1024**2)
|
|
|
self.txtDcapacity.setReadOnly(True)
|
|
|
else:
|
|
|
self.txtDcapacity.setValue(100.0)
|
|
|
self.txtDcapacity.setReadOnly(False)
|
|
|
|
|
|
self.var_lstDcapacity = self.lstDcapacity.currentIndex()
|
|
|
self.var_Dcapacity = self.txtDcapacity.value()
|
|
|
|
|
|
#----------------------------------------------------- Testeo de las unidades de grabacion ---------------------------------------------------------------
|
|
|
|
|
|
@pyqtSignature("")
|
|
|
def on_btnTdevA_clicked(self):
|
|
|
var_dev = str(self.txtDeviceA.text())
|
|
|
var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev
|
|
|
commands.getstatusoutput(var_cmd)
|
|
|
|
|
|
@pyqtSignature("")
|
|
|
def on_btnTdevB_clicked(self):
|
|
|
var_dev = str(self.txtDeviceB.text())
|
|
|
var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev
|
|
|
commands.getstatusoutput(var_cmd)
|
|
|
|
|
|
@pyqtSignature("")
|
|
|
def on_btnTdevC_clicked(self):
|
|
|
var_dev = str(self.txtDeviceC.text())
|
|
|
var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev
|
|
|
commands.getstatusoutput(var_cmd)
|
|
|
|
|
|
@pyqtSignature("")
|
|
|
def on_btnTdevD_clicked(self):
|
|
|
var_dev = str(self.txtDeviceD.text())
|
|
|
var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev
|
|
|
commands.getstatusoutput(var_cmd)
|
|
|
|
|
|
|
|
|
#==============================================================================
|
|
|
# Botones para la generacion de los archivos de configuracion
|
|
|
#==============================================================================
|
|
|
|
|
|
#----------------------------------------------------- Generacion de la configuracion usando los parametros ---------------------------------------------------------------
|
|
|
|
|
|
@pyqtSignature("")
|
|
|
def on_btnGbkp_clicked(self):
|
|
|
"""
|
|
|
Generacion de archivos de configuracion usando los parametros
|
|
|
"""
|
|
|
|
|
|
if functions.validate_parameters(self) == False:
|
|
|
return
|
|
|
|
|
|
#Crea las carpetas en la ruta del proyecto y verifica que se crearon correctamente
|
|
|
list_dirs=['gpath','iso','ppath', 'tmpdata']
|
|
|
bool_make_dirs = functions.make_dirs(list_dirs, self)
|
|
|
if bool_make_dirs == False:
|
|
|
return
|
|
|
|
|
|
var_files_list = functions.list_files(self) #Se obtiene la lista de archivos a grabar
|
|
|
|
|
|
self.var_Discs = functions.make_files_dat(var_files_list, self) #Se crean los archivos .dat
|
|
|
|
|
|
functions.make_files_print(self) # Se crean los archivos .print
|
|
|
|
|
|
functions2.make_parameters_conf(self) # se crea el archivo parameters.conf
|
|
|
|
|
|
self.txtInfo.append("Total number of discs for recording: "+str(self.var_Discs * self.var_Copys))
|
|
|
|
|
|
#Se bloquean los parametros de configuracion
|
|
|
functions2.enabled_items1(True, self)
|
|
|
self.var_disc_n = 1
|
|
|
self.var_copy_n = 1
|
|
|
self.bool_first_iso = True
|
|
|
self.var_burned_discs = 0 #numero de discos grabados
|
|
|
|
|
|
|
|
|
#----------------------------------------------------- Permite reiniciar la configuracion ---------------------------------------------------------------
|
|
|
|
|
|
@pyqtSignature("")
|
|
|
def on_btnRestart_clicked(self):
|
|
|
"""
|
|
|
Permite que se puedan cambiar los parametros
|
|
|
"""
|
|
|
if os.path.isfile("parameters.conf"):
|
|
|
os.remove("parameters.conf")
|
|
|
if os.path.isfile("burning.conf"):
|
|
|
os.remove("burning.conf")
|
|
|
|
|
|
functions2.enabled_items1(False, self)
|
|
|
self.btnStartburn.setText("Start Burn")
|
|
|
self.txtInfo.clear()
|
|
|
|
|
|
|
|
|
|
|
|
#==============================================================================
|
|
|
# Acciones de los procesos
|
|
|
#==============================================================================
|
|
|
|
|
|
#------------------------------------------------ Funciones del proceso de creacion del iso ------------------------------------------------------
|
|
|
|
|
|
def readOuput_iso(self):
|
|
|
self.txtProgress.setText("stdout iso: " + QtCore.QString(self.process_iso.readAllStandardOutput()))
|
|
|
|
|
|
def readError_iso(self):
|
|
|
self.txtProgress.setText("stderr iso: " + QtCore.QString(self.process_iso.readAllStandardError()))
|
|
|
|
|
|
def finished_iso(self):
|
|
|
self.txtProgress.clear()
|
|
|
|
|
|
if not(self.bool_state_burning):
|
|
|
return
|
|
|
|
|
|
if self.process_iso.exitCode() == 0:
|
|
|
self.txtInfo.append("------Iso file: "+functions.i2s(self.var_disc_n)+" created successfully\n")
|
|
|
self.var_step = 1
|
|
|
self.function_burn()
|
|
|
|
|
|
else:
|
|
|
self.txtInfo.append("#####Error creating iso file "+functions.i2s(self.var_disc_n)
|
|
|
+" , code "+QtCore.QString(self.process_iso.exitCode()))
|
|
|
self.txtInfo.append("Please check the data")
|
|
|
self.txtInfo.append("FATAL ERROR")
|
|
|
|
|
|
#----------------------------------------------------- Funciones del proceso de grabado ---------------------------------------------------------------
|
|
|
|
|
|
def readOuput_burn(self):
|
|
|
self.txtProgress.setText("stdout burn: " + QtCore.QString(self.process_burn.readAllStandardOutput()))
|
|
|
|
|
|
def readError_burn(self):
|
|
|
self.txtProgress.setText("stderr burn: " + QtCore.QString(self.process_burn.readAllStandardError()))
|
|
|
|
|
|
def finished_burn(self):
|
|
|
self.txtProgress.clear()
|
|
|
|
|
|
#Si se paro el proceso manualmente se termina
|
|
|
if not(self.bool_state_burning):
|
|
|
return
|
|
|
|
|
|
if self.process_burn.exitCode() == 0:
|
|
|
self.txtInfo.append("-----Complete recording, disc: "+str(self.var_disc_n)+" copy: "+str(self.var_copy_n))
|
|
|
functions2.update_message(1, "COMPLETED", self)
|
|
|
self.var_step = 2
|
|
|
self.function_check()
|
|
|
|
|
|
else:
|
|
|
self.txtInfo.append("#######Error recording, disc: "+functions.i2s(self.var_disc_n)+" copy: "
|
|
|
+functions.i2s(self.var_copy_n)+", code "+QtCore.QString(self.process_burn.exitCode()))
|
|
|
functions2.update_message(1, "ERROR", self)
|
|
|
|
|
|
functions.is_last_disc_and_copy(self)
|
|
|
|
|
|
|
|
|
#----------------------------------------------------- Funciones del proceso de verificacion ---------------------------------------------------------------
|
|
|
|
|
|
def readOuput_check(self):
|
|
|
self.txtProgress.setText("stdout check: " + QtCore.QString(self.process_check.readAllStandardOutput()))
|
|
|
|
|
|
def readError_check(self):
|
|
|
self.txtProgress.setText("stderr check: " + QtCore.QString(self.process_check.readAllStandardError()))
|
|
|
|
|
|
def finished_check(self):
|
|
|
self.txtProgress.clear()
|
|
|
|
|
|
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)
|
|
|
|
|
|
else:
|
|
|
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)
|
|
|
|
|
|
#----------------------------------------------------- Funciones del proceso de verificacion manual ---------------------------------------------------------------
|
|
|
|
|
|
def readOuput_manual_check(self):
|
|
|
self.txtProgress.setText("stdout check: " + QtCore.QString(self.process_manual_check.readAllStandardOutput()))
|
|
|
|
|
|
def readError_manual_check(self):
|
|
|
self.txtProgress.setText("stderr check: " + QtCore.QString(self.process_manual_check.readAllStandardError()))
|
|
|
|
|
|
def finished_manual_check(self):
|
|
|
self.txtProgress.clear()
|
|
|
|
|
|
if not(self.bool_state_manual_check):
|
|
|
return
|
|
|
|
|
|
if self.process_manual_check.exitCode() == 0:
|
|
|
self.txtInfo.append("--------Complete checking, disc: "+str(self.var_n_check_dirs + 1))
|
|
|
functions2.update_message(2, "CHECKED", self, index=self.var_n_check_dirs)
|
|
|
|
|
|
else:
|
|
|
self.txtInfo.append("#######Error checking, disc: "+str(self.var_n_check_dirs + 1)
|
|
|
+", code "+QtCore.QString(self.process_manual_check.exitCode()))
|
|
|
functions2.update_message(2, "ERROR", self, index=self.var_n_check_dirs)
|
|
|
|
|
|
#borrar el contenido de tmpdata
|
|
|
var_tmpdata=self.var_TDpath+"/tmpdata"
|
|
|
|
|
|
bool_return = functions.remove_dir(var_tmpdata, self)
|
|
|
if not(bool_return):
|
|
|
self.txtInfo.append("Error deleting directory: "+var_tmpdata)
|
|
|
self.bool_state_manual_check = False
|
|
|
return
|
|
|
|
|
|
self.var_n_check_dirs +=1
|
|
|
|
|
|
if self.var_n_check_dirs >= len(self.list_check_dirs) :
|
|
|
self.bool_state_manual_check = False
|
|
|
self.function_manual_check_final()
|
|
|
return
|
|
|
|
|
|
self.function_manual_check()
|
|
|
|
|
|
|
|
|
#==============================================================================
|
|
|
# Botones para el proceso de grabacion
|
|
|
#==============================================================================
|
|
|
|
|
|
#----------------------------------------------------- Iniciar proceso de grabacion ---------------------------------------------------------------
|
|
|
|
|
|
@pyqtSignature("")
|
|
|
def on_btnStartburn_clicked(self):
|
|
|
"""
|
|
|
Se inicia el proceso de grabacion
|
|
|
"""
|
|
|
#Verifica que exista algun dispositivo de grabacion seleccionado
|
|
|
if not(functions2.selected_devices(self)):
|
|
|
self.txtInfo.append("There is no recording device selected")
|
|
|
return
|
|
|
|
|
|
# #Lista los dispositivos de grabacion a usar
|
|
|
# for dev in self.var_devices:
|
|
|
# self.txtInfo.append("recording device :"+dev)
|
|
|
|
|
|
self.bool_state_burning = True
|
|
|
functions2.enabled_items2(True, self)
|
|
|
|
|
|
if self.bool_first_iso == True:
|
|
|
self.txtInfo.append("BUTTON: on_btnStartburn_clicked")
|
|
|
self.var_step = 4
|
|
|
self.function_eject()
|
|
|
return
|
|
|
|
|
|
if self.var_step == 0:
|
|
|
self.function_iso()
|
|
|
return
|
|
|
|
|
|
if self.var_step == 1:
|
|
|
self.function_burn()
|
|
|
return
|
|
|
|
|
|
#----------------------------------------------------- Funcion para el grabado ---------------------------------------------------------------
|
|
|
|
|
|
def function_iso(self):
|
|
|
#Creacion del archivo.iso para la grabacion
|
|
|
if self.var_step == 0:
|
|
|
self.txtInfo.append("########## Disc number: "+str(self.var_disc_n)+"##########")
|
|
|
self.txtInfo.append("------Creating iso file number: "+str(self.var_disc_n))
|
|
|
|
|
|
var_cmd = functions.cmd_iso(self)
|
|
|
|
|
|
if self.var_real_show_cmd == True:
|
|
|
self.txtInfo.append("CMD: "+var_cmd)
|
|
|
|
|
|
if self.var_real_iso == False:
|
|
|
self.txtInfo.append('**function_iso')
|
|
|
var_cmd="echo 'function_iso'"
|
|
|
|
|
|
self.process_iso.start(var_cmd)
|
|
|
|
|
|
def function_burn(self):
|
|
|
#Grabacion de los DVDs
|
|
|
|
|
|
if self.var_step == 1:
|
|
|
self.txtInfo.append("------Recording disc: "+str(self.var_disc_n)+", copy:"+str(self.var_copy_n))
|
|
|
functions2.update_message(1, "BURNING", self)
|
|
|
|
|
|
var_cmd = functions.cmd_burn(self)
|
|
|
|
|
|
if self.var_real_show_cmd == True:
|
|
|
self.txtInfo.append("CMD: "+var_cmd)
|
|
|
|
|
|
if self.var_real_burn == False:
|
|
|
self.txtInfo.append('**function_burn')
|
|
|
var_cmd="echo 'function_burn'"
|
|
|
|
|
|
self.process_burn.start(var_cmd)
|
|
|
|
|
|
def function_check(self):
|
|
|
#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)
|
|
|
|
|
|
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)
|
|
|
|
|
|
if self.var_real_check == False:
|
|
|
self.txtInfo.append('**function_check')
|
|
|
var_cmd="echo 'function_check'"
|
|
|
|
|
|
self.process_check.start(var_cmd)
|
|
|
|
|
|
#OK
|
|
|
def function_eject(self):
|
|
|
self.txtInfo.append("Ejecting recording devices")
|
|
|
self.txtInfo.append("Please insert blank discs")
|
|
|
|
|
|
if self.var_real_eject == True:
|
|
|
functions2.eject_devices(self) # Expulsa las bandejas de los dispostivos de grabacion
|
|
|
else:
|
|
|
self.txtInfo.append("**functions2.eject_devices")
|
|
|
|
|
|
self.btnStartburn.setText("Continue")
|
|
|
self.btnStartburn.setEnabled(True)
|
|
|
|
|
|
if self.bool_first_iso == True:
|
|
|
self.bool_first_iso = False
|
|
|
self.var_step = 0
|
|
|
|
|
|
elif self.var_copy_n == 1:
|
|
|
self.var_step = 0
|
|
|
|
|
|
else:
|
|
|
self.var_step = 1
|
|
|
|
|
|
def function_final(self):
|
|
|
self.txtInfo.append("Recording process is complete")
|
|
|
if os.path.isfile("parameters.conf"):
|
|
|
os.remove("parameters.conf")
|
|
|
if os.path.isfile("burning.conf"):
|
|
|
os.remove("burning.conf")
|
|
|
|
|
|
functions2.eject_devices(self) # Expulsa las bandejas de los dispostivos de grabacion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------- Detener proceso de grabacion ---------------------------------------------------------------
|
|
|
|
|
|
@pyqtSignature("")
|
|
|
def on_btnStopburn_clicked(self):
|
|
|
"""
|
|
|
Slot documentation goes here.
|
|
|
"""
|
|
|
self.bool_state_burning = False
|
|
|
|
|
|
if self.var_step == 0:
|
|
|
self.process_iso.terminate() #Termina el proceso, si puede
|
|
|
# self.process_iso.kill() #Mata el proceso, no es la forma adecuada, solo usar si terminate() no funciona
|
|
|
elif self.var_step == 1:
|
|
|
self.process_burn.terminate()
|
|
|
elif self.var_step == 2:
|
|
|
self.process_check.terminate()
|
|
|
|
|
|
self.txtInfo.append("Stopped recording")
|
|
|
functions2.enabled_items2(False, self)
|
|
|
self.bool_first_iso = True
|
|
|
|
|
|
|
|
|
|
|
|
#==============================================================================
|
|
|
# Proceso verificacion manual
|
|
|
#==============================================================================
|
|
|
|
|
|
|
|
|
#----------------------------------------------------- Proceso de verificaion manual ---------------------------------------------------------------
|
|
|
|
|
|
|
|
|
@pyqtSignature("")
|
|
|
def on_btnTDpath_clicked(self):
|
|
|
"""
|
|
|
Slot documentation goes here.
|
|
|
"""
|
|
|
self.var_TDpath= str(QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly))
|
|
|
self.txtTDpath.setText(self.var_TDpath)
|
|
|
self.statusTDpath = functions.dir_exists(self.var_TDpath, self)
|
|
|
if self.statusTDpath:
|
|
|
self.btnCHstart.setEnabled(True)
|
|
|
|
|
|
|
|
|
@pyqtSignature("")
|
|
|
def on_btnCHstart_clicked(self):
|
|
|
"""
|
|
|
Slot documentation goes here.
|
|
|
"""
|
|
|
|
|
|
if self.btnCHstart.text() == "STOP":
|
|
|
self.btnCHstart.setText("START") #Cambio el texto del boton
|
|
|
self.bool_state_manual_check = False
|
|
|
self.process_manual_check.terminate()
|
|
|
|
|
|
#borrar el contenido de tmpdata
|
|
|
var_tmpdata=self.var_TDpath+"/tmpdata"
|
|
|
bool_return = functions.remove_dir(var_tmpdata, self)
|
|
|
if not(bool_return):
|
|
|
self.txtInfo.append("Error deleting directory: "+var_tmpdata)
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
list_dirs = functions2.mounted_devices()
|
|
|
if list_dirs == "FATAL ERROR":
|
|
|
self.txtInfo.append("ERROR")
|
|
|
return
|
|
|
|
|
|
for i in list_dirs:
|
|
|
self.txtInfo.append(i)
|
|
|
|
|
|
self.list_check_dirs = list_dirs #contiene los directorios donde estan montados los discos a verificar
|
|
|
self.var_n_check_dirs = 0
|
|
|
self.bool_state_manual_check = True
|
|
|
|
|
|
self.btnTDpath.setEnabled(False) #Deshabilito el boton que permite cambiar la ruta de verificacion
|
|
|
self.btnCHstart.setText("STOP") #Cambio el texto del boton
|
|
|
|
|
|
self.function_manual_check()
|
|
|
|
|
|
|
|
|
def function_manual_check(self):
|
|
|
|
|
|
#Verificacion de los discos
|
|
|
if self.bool_state_manual_check == True:
|
|
|
|
|
|
self.txtInfo.append("-----------manually checking disc: "+str(self.var_n_check_dirs + 1)
|
|
|
+" directory: "+self.list_check_dirs[self.var_n_check_dirs])
|
|
|
|
|
|
functions2.update_message(2, "CHECKING", self, index=self.var_n_check_dirs)
|
|
|
|
|
|
#Crea la carpeta tmpdata dentro de la ruta elegida
|
|
|
var_tmpdata=self.var_TDpath+"/tmpdata"
|
|
|
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
|
|
|
|
|
|
var_data_dir = self.list_check_dirs[self.var_n_check_dirs] #Carpeta donde esta montado el disco actual
|
|
|
|
|
|
var_cmd = functions.cmd_manual_check(var_data_dir, var_tmpdata)
|
|
|
|
|
|
if self.var_real_show_cmd == True:
|
|
|
self.txtInfo.append("CMD: "+var_cmd)
|
|
|
|
|
|
if self.var_real_manual_check == False:
|
|
|
self.txtInfo.append('**function_manual_check')
|
|
|
var_cmd="echo 'function_manual_check'"
|
|
|
|
|
|
self.process_manual_check.start(var_cmd)
|
|
|
|
|
|
|
|
|
def function_manual_check_final(self):
|
|
|
self.txtInfo.append("Manual check process is complete")
|
|
|
self.btnCHstart.setText("START") #Cambio el texto del boton
|
|
|
for var_mount_point in self.list_check_dirs:
|
|
|
var_cmd = 'eject ' + var_mount_point
|
|
|
commands.getstatusoutput(var_cmd)
|
|
|
|
|
|
|
|
|
|