##// END OF EJS Templates
OK_probado_con_/...
ralonso -
r53:54
parent child
Show More
@@ -1,216 +1,214
1 1 # -*- coding: utf-8 -*-
2 2
3 3 #class BKmanager:
4 4 # def __init__(self):
5 5
6 6 from subprocess import *
7 7 import sys
8 8 import os
9 9 import subprocess
10 10 import commands
11 11
12 12
13 13 #Entero a cadena agregando ceros delante
14 14 def i2s(var_n, var_length=4):
15 15 var_n2=str(var_n)
16 16 while len(var_n2) < var_length:
17 17 var_n2 = "0"+var_n2
18 18 return var_n2
19 19
20 20
21 21 #Crea directorios en la ruta indicada
22 22 def make_dirs(list_dirs, self):
23 23 var_cmd="mkdir -p "+str(self.var_Rpath)
24 24 for var_dir in list_dirs:
25 25 var_output=commands.getstatusoutput(var_cmd+'/'+var_dir)[0]
26 26 if var_output != 0:
27 27 self.txtInfo.append("Error al crear el directorio "+var_dir+", output_error:" + str(var_output))
28 28 return False
29 29 self.txtInfo.append('Carpetas creadas correctamente')
30 30 return True
31 31
32 32
33 33 #Se verifica que la ruta exista y sea un directorio
34 34 def dir_exists(var_dir, self):
35 var_cmd="test -d "+str(var_dir)
36 var_output=commands.getstatusoutput(var_cmd)[0]
37 if var_output != 0:
38 self.txtInfo.append("Ruta no valida, output_error:" + str(var_output))
39 return False
40 else:
35 if os.path.isdir(var_dir):
41 36 self.txtInfo.append("Ruta valida, sin error:" + str(var_dir))
42 37 return True
38 else:
39 self.txtInfo.append("Ruta no valida, output_error:" + str(var_dir))
40 return False
43 41
44 42
45 43 #Se buscan los archivos del tipo especificado
46 44 def load_days(self):
47 45
48 46 self.var_list=[]
49 47 self.lstStartDay.clear()
50 48 self.lstStopDay.clear()
51 49
52 50 if self.statusDpath == False:
53 51 self.btnGbkp.setEnabled(False)
54 52 return
55 53
56 54 if self.var_Dtype == '':
57 55 return
58 56
59 57 var_cmd="find " + str(self.var_Dpath) + " -name *."+ str(self.var_Dtype) +" | awk -F/ '{print substr($NF,2,7)}' | sort| uniq"
60 58 output=commands.getstatusoutput(var_cmd)[1]
61 59
62 60 #Si no se encuentra ningun archivo
63 61 if len(output) == 0:
64 62 self.txtInfo.append("No se encontraron archivos")
65 63 self.btnGbkp.setEnabled(False)
66 64 return
67 65
68 66 #Se cargan las listas para seleccionar StartDay y StopDay (QComboBox)
69 67 for i in range(0, (len(output)+1)/8):
70 68 self.var_list.append(output[8*i:8*(i+1)-1])
71 69
72 70 for i in self.var_list:
73 71 self.lstStartDay.addItem(i)
74 72 self.lstStopDay.addItem(i)
75 73 self.lstStopDay.setCurrentIndex(self.lstStartDay.count()-1)
76 74
77 75 get_sub_list(self)
78 76 self.btnGbkp.setEnabled(True)
79 77
80 78
81 79 #Verifica que los parametros
82 80 def validate_parameters(self):
83 81 #Verifica que las rutas sean validas
84 82 if self.statusRpath == False:
85 83 self.txtInfo.append("Ruta de proyecto no valida")
86 84 return False
87 85
88 86 #Verifica la etiqueta
89 87 if len(self.var_Elabel) == 0:
90 88 self.txtInfo.append("Debe ingresar el nombre de la etiqueta")
91 89 return False
92 90
93 91 return True
94 92
95 93
96 94 #Obtiene el rango de las fechas seleccionadas
97 95 def get_sub_list(self):
98 96 self.var_sublist=[]
99 97 for i in self.var_list[self.lstStartDay.currentIndex():self.lstStartDay.currentIndex() + self.lstStopDay.currentIndex()+1]:
100 98 self.var_sublist.append(i)
101 99 if len(self.var_sublist) == 0:
102 100 self.txtInfo.append("No existen archivos encontrados")
103 101
104 102
105 103 #Busca los archivos con los parametros de busqueda
106 104 def list_files(self):
107 105 var_files_list=[]
108 106 for var_doy in self.var_sublist:
109 107 var_cmd="find " + str(self.var_Dpath) + " -name ?"+var_doy+"???."+ str(self.var_Dtype) + " |sort"
110 108 var_output=commands.getstatusoutput(var_cmd)[1]
111 109 for var_file in var_output.split():
112 110 var_files_list.append(var_file) #Almacena cada archivo en la lista
113 111 return var_files_list
114 112
115 113
116 114 #Genera la lista de archivos .dat que contienen los archivos a grabar en cada DVD
117 115 def make_files_dat(var_files_list, self):
118 116 var_Rpath_ppath=self.var_Rpath+"/ppath" #Ruta de los archivos a grabar
119 117 var_n=1 #Numero del DVD actual
120 118 var_tmp=0 #Se usa para acumular el tamaΓ±o de los archivos de la lista
121 119 var_files_list_2=[] #Se usa para almacenar la lista de archivos agrbar en cada DVD
122 120
123 121 for i in var_files_list: #Se asignan en i los archivos de la lista
124 122 self.txtInfo.append(i)
125 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
126 124 var_tmp += var_size_i #Se acumulan el tamaΓ±o de los archivos de la lista
127 125
128 126 #Si el tamaΓ±o acumulado es mayor que el de el DVD
129 127 if var_tmp > (self.var_Dcapacity * 1024):
130 128 var_tmp -= var_size_i #se quita el tamaΓ±o sumado para mostrar el tamaΓ±o real
131 129 #se crea un archivo con numeral en el sufijo y extension .dat
132 130 var_file = open(var_Rpath_ppath+"/"+self.var_Elabel+"_"+i2s(var_n)+".dat","w")
133 131 #Se aΓ±ade la lista de archivos a grabar en el DVD al archivo .dat
134 132 for line in var_files_list_2:
135 133 var_tmp_path=(line.split(self.var_Dpath)[1]).split('/')
136 134 var_tmp_path2="/"
137 135 for l in range(0, len(var_tmp_path)-1):
138 136 var_tmp_path2=var_tmp_path2+str(var_tmp_path[l])+"/"
139 137 var_file.write(var_tmp_path2+'=')
140 138 var_file.write(line+'\n')
141 139 var_file.close()
142 140
143 141 var_tmp = var_size_i #Se asigna a la variable el tamaΓ±o del archivo actual
144 142 var_files_list_2=[] #Se reinicia la lista
145 143 var_n += 1
146 144 var_files_list_2.append(i)
147 145
148 146 #se crea un archivo con numeral en el sufijo y extension .dat
149 147 var_file = open(var_Rpath_ppath+"/"+self.var_Elabel+"_"+i2s(var_n)+".dat","w")
150 148 #Se aΓ±ade la lista de archivos a grabar en el DVD al archivo .dat
151 149 for line in var_files_list_2:
152 150 var_tmp_path=(line.split(self.var_Dpath)[1]).split('/')
153 151 var_tmp_path2="/"
154 152 for l in range(0, len(var_tmp_path)-1):
155 153 var_tmp_path2=var_tmp_path2+str(var_tmp_path[l])+"/"
156 154 var_file.write(var_tmp_path2+'=')
157 155 var_file.write(line+'\n')
158 156 var_file.close()
159 157
160 158 return var_n
161 159
162 160
163 161 #Genera los archivos .print con los cuales se creara los postscript
164 162 def make_files_print(self):
165 163
166 164 var_Rpath_ppath=self.var_Rpath+"/ppath" #Ruta de los archivos a grabar
167 165
168 166 # Se leen todos los archivos .dat creados para crear las etiquetas en los archivos .print
169 167 for var_n in range(1, self.var_n_discs + 1):
170 168 #se abren los archivos .dat en modo lectura
171 169 var_file = open(var_Rpath_ppath+"/"+self.var_Elabel+"_"+i2s(var_n)+".dat","r")
172 170 lines=var_file.readlines() # Se lee las lineas en el archivo y se almacenan en la lista
173 171 # Se crea el archivo .print
174 172 var_file_print = open(var_Rpath_ppath+"/"+self.var_Elabel+"_"+i2s(var_n)+".print","w")
175 173 var_file_print.write(self.var_Elabel+" "+i2s(var_n)+"/"+i2s(self.var_n_discs)+"\n")
176 174 var_file_print.write("Year Doy Folder Set Time range\n")
177 175
178 176 var_first_folder = lines[0].split('=')[0]
179 177 var_first_file = (lines[0].split('=')[1])[:-1]
180 178 var_date_first_file=commands.getstatusoutput("date -r "+var_first_file+" +'%T'")[1]
181 179
182 180 for j in range(1, len(lines)-1):
183 181 var_tmp_folder = lines[j].split('=')[0]
184 182 var_tmp_file = (lines[j].split('=')[1])[:-1]
185 183
186 184 # Si el subfolder superior o la fecha del archivo cambia se genera una nueva linea
187 185 if (var_tmp_folder != var_first_folder) or (var_tmp_file[0:-5] != var_first_file[0:-5]):
188 186 var_last_file = (lines[j-1].split('=')[1])[:-1]
189 187 var_date_last_file=commands.getstatusoutput("date -r "+var_last_file+" +'%T'")[1]
190 188 # Si el archivo se grabara directamente en la / del DVD y no en un /directorio/
191 189 # se usa la etiqueta para indicar la parte de la etiqueta donde va el subdirectorio
192 190 if var_first_folder == '/':
193 191 var_folder = self.var_Elabel
194 192 else:
195 193 var_folder = var_first_folder.split('/')[1]
196 194
197 195 var_file_print.write(var_first_file[-12:-8]+" "+var_first_file[-8:-5]+" "+var_folder +" "+var_first_file[-5:-2]+" "
198 196 +var_last_file[-5:-2]+" "+var_date_first_file+" "+var_date_last_file+"\n")
199 197
200 198 var_first_folder = lines[j].split('=')[0]
201 199 var_first_file = (lines[j].split('=')[1])[:-1]
202 200 var_date_first_file=commands.getstatusoutput("date -r "+var_first_file+" +'%T'")[1]
203 201
204 202 var_last_file = (lines[-1].split('=')[1])[:-1]
205 203 var_date_last_file=commands.getstatusoutput("date -r "+var_last_file+" +'%T'")[1]
206 204
207 205 if var_first_folder == '/':
208 206 var_folder = self.txtElabel.text()
209 207 else:
210 208 var_folder = var_first_folder.split('/')[1]
211 209
212 210 var_file_print.write(var_first_file[-12:-8]+" "+var_first_file[-8:-5]+" "+var_folder +" "+var_first_file[-5:-2]+" "
213 211 +var_last_file[-5:-2]+" "+var_date_first_file+" "+var_date_last_file+"\n")
214 212
215 213 var_file.close()
216 214 var_file_print.close()
@@ -1,104 +1,111
1 1 # -*- coding: utf-8 -*-
2 2
3 3
4 4 from subprocess import *
5 5 import sys
6 6 import os
7 7 import subprocess
8 8 import commands
9 9
10 10
11 11 def set_parameters(self):
12 12 """
13 13 Se usa para inicializar ciertos parametros para pruebas
14 14 """
15 #self.txtDpath.setText('/home/ricardoar/optional/STORAGE/Data/RAW_EXP/JASMET/')
16 #self.txtRpath.setText('/home/ricardoar/optional/STORAGE/prueba1_jro_backup_manager/')
17 15 self.txtDpath.setText('/home/ricardoar/optional/STORAGE/EW_DRIFTS/')
18 16 self.txtRpath.setText('/home/ricardoar/optional/prueba1_jro_backup_manager/')
19 self.txtElabel.setText('EW_DRIFTS')
20 self.statusDpath = True
21 self.statusRpath = True
17 self.txtElabel.setText('EW_DRIFTS_pruebas')
22 18 self.lstDcapacity.setCurrentIndex(4)
23 19 self.txtDcapacity.setValue(250.0)
24 20 self.txtDcapacity.setReadOnly(False)
25 21
26 22
27 23 def detect_devices(self):
28 24 """
29 25 Deteccion de los dispositvos de grabacion
30 26 """
31 27 #var_cmd="wodim --devices | grep /dev/ | awk -F\' '{print $2}'" #Funciona en consola pero no en python ΒΏ?
32 28 var_cmd="wodim --devices | grep /dev/ | awk '{print $2}' | awk -F= '{print $2}'"
33 29 var_output = commands.getstatusoutput(var_cmd)
34 30 if var_output[0] != 0:
35 31 self.txtInfo.append("No se pudo encontrar los dispositivos de grabacion, output_error:" + str(var_output))
36 32 else:
37 33 self.txtInfo.append("dispositivos encontrados")
38 34 var_devices = var_output[1].split('\n')
39 35
40 36 var_tmp=[]
41 37 for i in range(0, 4):
42 38 if i < len(var_devices):
43 39 var_len = len(var_devices[i])
44 40 var_tmp.append(var_devices[i][1:var_len - 1])
45 41 else:
46 42 var_tmp.append('')
47 43
48 44 #Se escriben los dispostivos correspodientes, si existen
49 45 self.txtDeviceA.setText(str(var_tmp[0]))
50 46 self.txtDeviceB.setText(str(var_tmp[1]))
51 47 self.txtDeviceC.setText(str(var_tmp[2]))
52 48 self.txtDeviceD.setText(str(var_tmp[3]))
53 49 #Se desactivan los que no existen
54 50 if len(var_tmp[0]) == 0 :
55 51 self.chkDevA.setChecked(False)
56 52 self.chkDevA.setEnabled(False)
57 53 if len(var_tmp[1]) == 0 :
58 54 self.chkDevB.setChecked(False)
59 55 self.chkDevB.setEnabled(False)
60 56 if len(var_tmp[2]) == 0 :
61 57 self.chkDevC.setChecked(False)
62 58 self.chkDevC.setEnabled(False)
63 59 if len(var_tmp[3]) == 0 :
64 60 self.chkDevD.setChecked(False)
65 61 self.chkDevD.setEnabled(False)
66 62
67 63 def enabled_items1(var_bool, self):
68 64 self.tabParameters.setEnabled(not(var_bool))
69 65 self.lstDcapacity.setEnabled(not(var_bool))
70 66 self.txtDcapacity.setEnabled(not(var_bool))
71 67 self.btnGbkp.setEnabled(not(var_bool))
72 68 self.btnRestart.setEnabled(var_bool)
73 69 self.btnStartburn.setEnabled(var_bool)
74 70
71
75 72 def make_parameters_conf(self):
76 73 var_file = open("parameters.conf","w")
77 74
78 75 var_file.write(self.var_Dpath+"\n") #0
79 76 var_file.write(self.var_Rpath+"\n") #1
80 77 var_file.write(str(self.var_lstDtype)+"\n") #2
81 78 var_file.write(self.var_Dtype+"\n") #3
82 79 var_file.write(self.var_Elabel+"\n") #4
83 80 var_file.write(str(self.var_Copys)+"\n") #5
84 81 var_file.write(str(self.var_lstDcapacity)+"\n") #6
85 82 var_file.write(str(self.var_Dcapacity)+"\n") #7
86 83
87 84 var_file.close()
88 85
89 86
90 87 def get_parameters_conf(self):
91 88 var_file = open("parameters.conf","r")
92 89 lines = var_file.readlines()
93 90
94 91 self.txtDpath.setText(lines[0][:-1]) #0
95 92 self.txtRpath.setText(lines[1][:-1]) #1
96 93 self.lstDtype.setCurrentIndex(int(lines[2])) #2
97 94 self.txtDtype.setText(lines[3][:-1]) #3
98 95 self.txtElabel.setText(lines[4][:-1]) #4
99 96 self.txtCopys.setValue(int(lines[5][:-1])) #5
100 97 self.lstDcapacity.setCurrentIndex(int(lines[6])) #6
101 98 self.txtDcapacity.setValue(float(lines[7]))
102 99
103 100 var_file.close()
104 101
102 def set_vars(self):
103 self.var_Dpath = self.txtDpath.text()
104 self.var_Rpath = self.txtRpath.text()
105 self.var_lstDtype = self.lstDtype.currentIndex()
106 self.var_Dtype = self.txtDtype.text()
107 self.var_Elabel = self.txtElabel.text()
108 self.var_Copys = self.txtCopys.value()
109 self.var_lstDcapacity = self.lstDcapacity.currentIndex()
110 self.var_Dcapacity = self.txtDcapacity.value()
111
@@ -1,336 +1,328
1 1 # -*- coding: utf-8 -*-
2 2
3 3 """
4 4 Module implementing MainWindow.
5 5 """
6 6
7 7 from PyQt4.QtGui import QMainWindow
8 8 from PyQt4.QtCore import pyqtSignature
9 9 from PyQt4 import QtCore
10 10 from Ui_MainWindow import Ui_MainWindow
11 11 from PyQt4 import QtGui
12 12 from subprocess import *
13 13 import sys
14 14 import os
15 15 import subprocess
16 16 import commands
17 17 from functions import functions
18 18 from functions import functions2
19 19
20 20 class MainWindow(QMainWindow, Ui_MainWindow):
21 21 """
22 22 Class documentation goes here.
23 23 """
24 24
25 25 def __init__(self, parent = None):
26 26 QMainWindow.__init__(self, parent)
27 27 self.setupUi(self)
28 28 self.setupUi2()
29 29 #sys.stdout = self #redirige salida estandar
30 30
31 31 def setupUi2(self):
32 32
33 #sys.stdout = self
34
35 var_tmp = os.path.isfile("parameters.conf")
36
37 if var_tmp == True:
33 functions2.detect_devices(self) #busca los dispositivos de grabacion
34
35 #Revisa si existe el archivo de confirguracion
36 if os.path.isfile("parameters.conf"):
38 37 self.txtInfo.append("Archivo de configuracion encontrado")
39 38 functions2.get_parameters_conf(self)
40
41 39 else:
42 40 self.txtInfo.append("Elija los parametros de configuracion")
43
44 self.statusDpath = False
45 self.statusRpath = False
46
47 functions2.set_parameters(self) #Establece ciertos parametros, para pruebas
48
49 self.var_Dpath = self.txtDpath.text()
50 self.var_Rpath = self.txtRpath.text()
51 self.var_lstDtype = self.lstDtype.currentIndex()
52 self.var_Dtype = self.txtDtype.text()
53 self.var_Elabel = self.txtElabel.text()
54 self.var_Copys = self.txtCopys.value()
55 self.var_lstDcapacity = self.lstDcapacity.currentIndex()
56 self.var_Dcapacity = self.txtDcapacity.value()
41 functions2.set_parameters(self) #Establece ciertos parametros, para pruebas
42
43 functions2.set_vars(self) #Carga las variables de la clase con los parametros seleccionados
44
45 self.statusDpath = functions.dir_exists(self.var_Dpath, self)
46 self.statusRpath = functions.dir_exists(self.var_Rpath, self)
57 47
58 48 self.var_n_discs=0
59 49 self.var_list=[]
60 50 self.var_sublist=[]
61 51
62 functions2.detect_devices(self) #busca los dispositivos de grabacion
63 functions.load_days(self)
52 functions.load_days(self)
64 53
65 54 self.var_process = QtCore.QProcess()
66 55 self.connect(self.var_process, QtCore.SIGNAL('readyReadStandardOutput()'), self.readOuput)
67 56 self.connect(self.var_process, QtCore.SIGNAL('readyReadStandardError()'), self.readError)
68 self.connect(self.var_process, QtCore.SIGNAL('finished(int,QProcess::ExitStatus)'), self.finished1)
57 self.connect(self.var_process, QtCore.SIGNAL('finished(int,QProcess::ExitStatus)'), self.finished)
69 58
70 59 def readOuput(self):
71 self.txtSburn.append("stdout: " + QtCore.QString(self.var_process.readAllStandardOutput()))
60 self.txtSburn.insertPlainText("stdout: " + QtCore.QString(self.var_process.readAllStandardOutput()))
61
72 62
73 63 def readError(self):
74 self.txtSburn.append("stderr: " + QtCore.QString(self.var_process.readAllStandardError()))
75
76 def finished1(self):
64 self.txtSburn.insertPlainText("stderr: " + QtCore.QString(self.var_process.readAllStandardError()))
65
66
67 def finished(self):
77 68 self.txtInfo.append("proceso terminado finished()")
78 69 print self.var_process.exitCode()
70
79 71
80 72 def write(self, txt):
81 73 self.txtInfo.append(str(txt))
82 74
83 75
84 76 @pyqtSignature("")
85 77 def on_btnDpath_clicked(self):
86 78 """
87 79 Permite seleccionar graficamente el direcorio de los datos a grabar
88 80 """
89 81 self.var_Dpath= QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)
90 82 self.txtDpath.setText(self.var_Dpath)
91 83 self.on_txtDpath_editingFinished() #llamada a funcion
92 84
93 85
94 86 @pyqtSignature("")
95 87 def on_btnRpath_clicked(self):
96 88 """
97 89 Permite seleccionar graficamente el direcorio del proyecto
98 90 """
99 91 self.var_Rpath = QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)
100 92 self.txtRpath.setText(self.var_Rpath)
101 93 self.on_txtRpath_editingFinished() #llamada a funcion
102 94
103 95
104 96 @pyqtSignature("")
105 97 def on_txtDpath_editingFinished(self):
106 98 """
107 99 Permite buscar los archivos de extension seleccionada en la ruta de de datos
108 100 y cargar los valores para el rango de tiempo a ser grabado
109 101 """
110 102 self.var_Dpath=self.txtDpath.text() #Se carga la variable con la ruta recien editada
111 103 self.statusDpath = functions.dir_exists(self.var_Dpath, self)
112 104 functions.load_days(self)
113 105
114 106
115 107 @pyqtSignature("")
116 108 def on_txtRpath_editingFinished(self):
117 109 """
118 110 Valida la ruta del proyecto
119 111 """
120 112 self.var_Rpath=self.txtRpath.text() #Se carga la variable con la ruta recien editada
121 113 self.statusRpath = functions.dir_exists(self.var_Rpath, self)
122 114
123 115
124 116 @pyqtSignature("int")
125 117 def on_lstDtype_activated(self, index):
126 118 """
127 119 Permite elegir entre los tipos de archivos
128 120 """
129 121 self.txtDtype.setReadOnly(True)
130 122 if index == 0:
131 123 var_type='r'
132 124 elif index == 1:
133 125 var_type='pdata'
134 126 elif index == 2:
135 127 var_type='sswma'
136 128 else :
137 129 var_type=''
138 130 self.txtDtype.setReadOnly(False)
139 131
140 132 self.txtDtype.setText(var_type)
141 133 self.on_txtDtype_editingFinished()
142 134
143 135
144 136 @pyqtSignature("")
145 137 def on_txtDtype_editingFinished(self):
146 138 self.var_Dtype=self.txtDtype.text()
147 139 functions.load_days(self) #llamada a funcion
148 140
149 141
150 142 @pyqtSignature("")
151 143 def on_txtElabel_editingFinished(self):
152 144 self.var_Elabel = self.txtElabel.text()
153 145
154 146
155 147 @pyqtSignature("")
156 148 def on_txtCopys_editingFinished(self):
157 149 self.var_Copys = self.txtCopys.value()
158 150
159 151
160 152 @pyqtSignature("")
161 153 def on_txtDcapacity_editingFinished(self):
162 154 self.var_Dcapacity = self.txtDcapacity.value()
163 155
164 156
165 157 @pyqtSignature("int") #CLOSED
166 158 def on_lstStartDay_activated(self, index):
167 159 """
168 160 Cambia la lista de opciones en lstStopDay
169 161 """
170 162 var_StopDay_index=self.lstStopDay.count() - self.lstStopDay.currentIndex()
171 163 self.lstStopDay.clear()
172 164
173 165 for i in self.var_list[index:]:
174 166 self.lstStopDay.addItem(i)
175 167
176 168 self.lstStopDay.setCurrentIndex(self.lstStopDay.count() - var_StopDay_index)
177 169
178 170 functions.get_sub_list(self)
179 171
180 172
181 173 @pyqtSignature("int") #CLOSED
182 174 def on_lstStopDay_activated(self, index):
183 175 """
184 176 Cambia la lista de opciones en lstStartDay
185 177 """
186 178 var_StartDay_index=self.lstStartDay.currentIndex()
187 179 var_end_index = self.lstStopDay.count() - index
188 180 self.lstStartDay.clear()
189 181
190 182 for i in self.var_list[:len(self.var_list) - var_end_index + 1]:
191 183 self.lstStartDay.addItem(i)
192 184
193 185 self.lstStartDay.setCurrentIndex(var_StartDay_index)
194 186
195 187 functions.get_sub_list(self)
196 188
197 189
198 190 @pyqtSignature("int") #CLOSED
199 191 def on_lstDcapacity_activated(self, index):
200 192 """
201 193 Permite elegir el tamaΓ±o del disco
202 194 """
203 195 if index == 0:
204 196 var_size=25.0
205 197 elif index == 1:
206 198 var_size=8.5
207 199 elif index == 2:
208 200 var_size=4.7
209 201 elif index == 3:
210 202 var_size=0.7
211 203
212 204 if index != 4:
213 205 self.txtDcapacity.setValue(var_size*10**9/1024**2)
214 206 self.txtDcapacity.setReadOnly(True)
215 207 else:
216 208 self.txtDcapacity.setValue(100.0)
217 209 self.txtDcapacity.setReadOnly(False)
218 210
219 211 self.var_Dcapacity = self.txtDcapacity.value()
220 212
221 213
222 214 @pyqtSignature("")
223 215 def on_btnGbkp_clicked(self):
224 216 """
225 217 Cuando se presiona el boton btnGbkp
226 218 """
227 219
228 220 if functions.validate_parameters(self) == False:
229 221 return
230 222
231 223 #Crea las carpetas en la ruta del proyecto y verifica que se crearon correctamente
232 224 list_dirs=['gpath','iso','ppath']
233 225 bool_make_dirs = functions.make_dirs(list_dirs, self)
234 226 if bool_make_dirs == False:
235 227 return
236 228
237 229 var_files_list = functions.list_files(self) #Se obtiene la lista de archivos a grabar
238 230 self.var_n_discs = functions.make_files_dat(var_files_list, self) #Se crean los archivos .dat
239 231 functions.make_files_print(self) # Se crean los archivos .print
240 232 functions2.make_parameters_conf(self) # se crea el archivo parameters.conf
241 233
242 234 #Se deshabilitan los parametros de configuracion
243 235 functions2.enabled_items1(True, self)
244 236
245 237 @pyqtSignature("")
246 238 def on_btnRestart_clicked(self):
247 239 """
248 240 Permite que se puedan cambiar los parametros
249 241 """
250 242 functions2.enabled_items1(False, self)
251 243 os.remove("parameters.conf")
252 244
253 245
254 246 @pyqtSignature("")
255 247 def on_btnStartburn_clicked(self):
256 248 """
257 249 Se inicia el proceso de grabacion
258 250 """
259 251 self.btnRestart.setEnabled(False)
260 252 self.btnStartburn.setEnabled(False)
261 253 self.btnStopburn.setEnabled(True)
262 254
263 255 sys.stdout = self
264 256 #sys.stderr = self
265 257 print "stdout_!!!"
266 258
267 259 #Inicializando variables
268 260 var_Rpath_ppath=self.var_Rpath+"/ppath"
269 261 var_Rpath_iso=self.var_Rpath+"/iso"
270 262
271 263 var_n=1
272 264 file_iso=var_Rpath_iso+"/"+functions.i2s(var_n)+".iso"
273 265 file_dat=var_Rpath_ppath+"/"+self.var_Elabel+"_"+functions.i2s(var_n)+".dat"
274 266
275 267 var_cmd = 'genisoimage -hide-joliet-trans-tbl -joliet-long -r '
276 268 var_cmd += ' -A '+self.var_Elabel+' -V '+self.var_Elabel
277 269 var_cmd += ' -graft-points -path-list '+ file_dat+' -o '+file_iso
278 270
279 271 # self.process.start(var_cmd)
280 272 self.var_process.start(var_cmd)
281 273 # self.var_process.waitForFinished()
282 274 self.txtInfo.append("ejecutandose")
283 275
284 276
285 277 # # Se leen todos los archivos .dat creados para crear las etiquetas en los archivos .ps
286 278 # for var_n in range(1, self.var_n_discs+1):
287 279 # self.txtInfo.append(str(var_n))
288 280 # file_iso=var_Rpath_iso+"/"+functions.i2s(var_n)+".iso"
289 281 # file_dat=var_Rpath_ppath+"/"+self.var_Elabel+"_"+functions.i2s(var_n)+".dat"
290 282 #
291 283 # var_cmd = 'genisoimage -hide-joliet-trans-tbl -joliet-long -r '
292 284 # var_cmd += ' -A '+self.var_Elabel+' -V '+self.var_Elabel
293 285 # var_cmd += ' -graft-points -path-list '+ file_dat+' -o '+file_iso
294 286 # self.txtInfo.append(var_cmd)
295 287 #
296 288 # var_output=commands.getstatusoutput(str(var_cmd))[0]
297 289 # self.txtInfo.append(str(var_output))
298 290
299 291 #os.system(str(var_cmd))
300 292 #p = subprocess.Popen(str('ls /'), shell=True, stdout=self)
301 293 #os.waitpid(p.pid, 0)
302 294 ####self.txtInfo.append(str(p.pid))
303 295
304 296
305 297 @pyqtSignature("")
306 298 def on_btnStopburn_clicked(self):
307 299 """
308 300 Slot documentation goes here.
309 301 """
310 302 self.btnRestart.setEnabled(True)
311 303 self.btnStartburn.setEnabled(True)
312 304 self.btnStopburn.setEnabled(False)
313 305
314 306 @pyqtSignature("")
315 307 def on_btnTdevA_clicked(self):
316 308 var_dev = str(self.txtDeviceA.text())
317 309 var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev
318 310 commands.getstatusoutput(var_cmd)
319 311
320 312 @pyqtSignature("")
321 313 def on_btnTdevB_clicked(self):
322 314 var_dev = str(self.txtDeviceB.text())
323 315 var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev
324 316 commands.getstatusoutput(var_cmd)
325 317
326 318 @pyqtSignature("")
327 319 def on_btnTdevC_clicked(self):
328 320 var_dev = str(self.txtDeviceC.text())
329 321 var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev
330 322 commands.getstatusoutput(var_cmd)
331 323
332 324 @pyqtSignature("")
333 325 def on_btnTdevD_clicked(self):
334 326 var_dev = str(self.txtDeviceD.text())
335 327 var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev
336 328 commands.getstatusoutput(var_cmd)
General Comments 0
You need to be logged in to leave comments. Login now