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