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