##// END OF EJS Templates
implementacion de funciones:...
ralonso -
r39:40
parent child
Show More
@@ -1,8 +1,31
1 #import sys No newline at end of file
1 #import sys
2 #from subprocess import * No newline at end of file
2 #from subprocess import *
3 No newline at end of file
3
4 #class BKmanager: No newline at end of file
4 #class BKmanager:
5 # def __init__(self): No newline at end of file
5 # def __init__(self):
6 from subprocess import *
No newline at end of file
7 import sys
No newline at end of file
8 import os
No newline at end of file
9 import subprocess
No newline at end of file
10 import commands
No newline at end of file
11
No newline at end of file
12 #Entero a cadena agregando ceros delante
No newline at end of file
13 def i2s(var_n, var_length=4):
No newline at end of file
14 var_n2=str(var_n)
No newline at end of file
15 while len(var_n2) < var_length:
No newline at end of file
16 var_n2 = "0"+var_n2
No newline at end of file
17 return var_n2 No newline at end of file
6 No newline at end of file
18
7 No newline at end of file
19
8 No newline at end of file
20
21 def make_dirs(var_path, list_dirs, self):
No newline at end of file
22
No newline at end of file
23 var_cmd="mkdir -p "+str(var_path)
No newline at end of file
24 for var_dir in list_dirs:
No newline at end of file
25 var_output=commands.getstatusoutput(var_cmd+'/'+var_dir)[0]
No newline at end of file
26 print var_cmd+'/'+var_dir
No newline at end of file
27 if var_output != 0:
No newline at end of file
28 self.txtInfo.append("Error al crear el directorio "+var_dir+", output_error:" + str(var_output))
No newline at end of file
29 return
No newline at end of file
30 else:
No newline at end of file
31 self.txtInfo.append('Carpetas creadas correctamente') No newline at end of file
@@ -1,159 +1,159
1 <?xml version="1.0" encoding="UTF-8"?> No newline at end of file
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE Project SYSTEM "Project-4.6.dtd"> No newline at end of file
2 <!DOCTYPE Project SYSTEM "Project-4.6.dtd">
3 <!-- eric4 project file for project jro_backup_manager -->
3 <!-- eric4 project file for project jro_backup_manager -->
No newline at end of file
4 <!-- Saved: 2010-05-16, 11:21:24 --> No newline at end of file
4 <!-- Saved: 2010-04-14, 15:28:43 --> No newline at end of file
5 <!-- Copyright (C) 2010 , --> No newline at end of file
5 <!-- Copyright (C) 2010 , -->
6 <Project version="4.6"> No newline at end of file
6 <Project version="4.6">
7 <Language>en</Language> No newline at end of file
7 <Language>en</Language>
8 <ProgLanguage mixed="0">Python</ProgLanguage> No newline at end of file
8 <ProgLanguage mixed="0">Python</ProgLanguage>
9 <ProjectType>Qt4</ProjectType> No newline at end of file
9 <ProjectType>Qt4</ProjectType>
10 <Description></Description> No newline at end of file
10 <Description></Description>
11 <Version>0.1</Version> No newline at end of file
11 <Version>0.1</Version>
12 <Author></Author> No newline at end of file
12 <Author></Author>
13 <Email></Email> No newline at end of file
13 <Email></Email>
14 <Sources> No newline at end of file
14 <Sources>
15 <Source>__init__.py</Source> No newline at end of file
15 <Source>__init__.py</Source>
16 <Source>ui/Ui_MainWindow.py</Source> No newline at end of file
16 <Source>ui/Ui_MainWindow.py</Source>
17 <Source>ui/MainWindow.py</Source> No newline at end of file
17 <Source>ui/MainWindow.py</Source>
18 <Source>main.py</Source> No newline at end of file
18 <Source>main.py</Source>
19 <Source>ui/__init__.py</Source> No newline at end of file
19 <Source>ui/__init__.py</Source>
20 <Source>functions/__init__.py</Source> No newline at end of file
20 <Source>functions/__init__.py</Source>
21 <Source>functions/functions.py</Source> No newline at end of file
21 <Source>functions/functions.py</Source>
22 </Sources> No newline at end of file
22 </Sources>
23 <Forms> No newline at end of file
23 <Forms>
24 <Form>ui/MainWindow.ui</Form> No newline at end of file
24 <Form>ui/MainWindow.ui</Form>
25 </Forms> No newline at end of file
25 </Forms>
26 <Translations> No newline at end of file
26 <Translations>
27 </Translations> No newline at end of file
27 </Translations>
28 <Resources> No newline at end of file
28 <Resources>
29 </Resources> No newline at end of file
29 </Resources>
30 <Interfaces> No newline at end of file
30 <Interfaces>
31 </Interfaces> No newline at end of file
31 </Interfaces>
32 <Others> No newline at end of file
32 <Others>
33 </Others> No newline at end of file
33 </Others>
34 <MainScript>main.py</MainScript> No newline at end of file
34 <MainScript>main.py</MainScript>
35 <Vcs> No newline at end of file
35 <Vcs>
36 <VcsType>Subversion</VcsType> No newline at end of file
36 <VcsType>Subversion</VcsType>
37 <VcsOptions> No newline at end of file
37 <VcsOptions>
38 <dict> No newline at end of file
38 <dict>
39 <key> No newline at end of file
39 <key>
40 <string>add</string> No newline at end of file
40 <string>add</string>
41 </key> No newline at end of file
41 </key>
42 <value> No newline at end of file
42 <value>
43 <list> No newline at end of file
43 <list>
44 <string></string> No newline at end of file
44 <string></string>
45 </list> No newline at end of file
45 </list>
46 </value> No newline at end of file
46 </value>
47 <key> No newline at end of file
47 <key>
48 <string>checkout</string> No newline at end of file
48 <string>checkout</string>
49 </key> No newline at end of file
49 </key>
50 <value> No newline at end of file
50 <value>
51 <list> No newline at end of file
51 <list>
52 <string></string> No newline at end of file
52 <string></string>
53 </list> No newline at end of file
53 </list>
54 </value> No newline at end of file
54 </value>
55 <key> No newline at end of file
55 <key>
56 <string>commit</string> No newline at end of file
56 <string>commit</string>
57 </key> No newline at end of file
57 </key>
58 <value> No newline at end of file
58 <value>
59 <list> No newline at end of file
59 <list>
60 <string></string> No newline at end of file
60 <string></string>
61 </list> No newline at end of file
61 </list>
62 </value> No newline at end of file
62 </value>
63 <key> No newline at end of file
63 <key>
64 <string>diff</string> No newline at end of file
64 <string>diff</string>
65 </key> No newline at end of file
65 </key>
66 <value> No newline at end of file
66 <value>
67 <list> No newline at end of file
67 <list>
68 <string></string> No newline at end of file
68 <string></string>
69 </list> No newline at end of file
69 </list>
70 </value> No newline at end of file
70 </value>
71 <key> No newline at end of file
71 <key>
72 <string>export</string> No newline at end of file
72 <string>export</string>
73 </key> No newline at end of file
73 </key>
74 <value> No newline at end of file
74 <value>
75 <list> No newline at end of file
75 <list>
76 <string></string> No newline at end of file
76 <string></string>
77 </list> No newline at end of file
77 </list>
78 </value> No newline at end of file
78 </value>
79 <key> No newline at end of file
79 <key>
80 <string>global</string> No newline at end of file
80 <string>global</string>
81 </key> No newline at end of file
81 </key>
82 <value> No newline at end of file
82 <value>
83 <list> No newline at end of file
83 <list>
84 <string></string> No newline at end of file
84 <string></string>
85 </list> No newline at end of file
85 </list>
86 </value> No newline at end of file
86 </value>
87 <key> No newline at end of file
87 <key>
88 <string>history</string> No newline at end of file
88 <string>history</string>
89 </key> No newline at end of file
89 </key>
90 <value> No newline at end of file
90 <value>
91 <list> No newline at end of file
91 <list>
92 <string></string> No newline at end of file
92 <string></string>
93 </list> No newline at end of file
93 </list>
94 </value> No newline at end of file
94 </value>
95 <key> No newline at end of file
95 <key>
96 <string>log</string> No newline at end of file
96 <string>log</string>
97 </key> No newline at end of file
97 </key>
98 <value> No newline at end of file
98 <value>
99 <list> No newline at end of file
99 <list>
100 <string></string> No newline at end of file
100 <string></string>
101 </list> No newline at end of file
101 </list>
102 </value> No newline at end of file
102 </value>
103 <key> No newline at end of file
103 <key>
104 <string>remove</string> No newline at end of file
104 <string>remove</string>
105 </key> No newline at end of file
105 </key>
106 <value> No newline at end of file
106 <value>
107 <list> No newline at end of file
107 <list>
108 <string></string> No newline at end of file
108 <string></string>
109 </list> No newline at end of file
109 </list>
110 </value> No newline at end of file
110 </value>
111 <key> No newline at end of file
111 <key>
112 <string>status</string> No newline at end of file
112 <string>status</string>
113 </key> No newline at end of file
113 </key>
114 <value> No newline at end of file
114 <value>
115 <list> No newline at end of file
115 <list>
116 <string></string> No newline at end of file
116 <string></string>
117 </list> No newline at end of file
117 </list>
118 </value> No newline at end of file
118 </value>
119 <key> No newline at end of file
119 <key>
120 <string>tag</string> No newline at end of file
120 <string>tag</string>
121 </key> No newline at end of file
121 </key>
122 <value> No newline at end of file
122 <value>
123 <list> No newline at end of file
123 <list>
124 <string></string> No newline at end of file
124 <string></string>
125 </list> No newline at end of file
125 </list>
126 </value> No newline at end of file
126 </value>
127 <key> No newline at end of file
127 <key>
128 <string>update</string> No newline at end of file
128 <string>update</string>
129 </key> No newline at end of file
129 </key>
130 <value> No newline at end of file
130 <value>
131 <list> No newline at end of file
131 <list>
132 <string></string> No newline at end of file
132 <string></string>
133 </list> No newline at end of file
133 </list>
134 </value> No newline at end of file
134 </value>
135 </dict> No newline at end of file
135 </dict>
136 </VcsOptions> No newline at end of file
136 </VcsOptions>
137 <VcsOtherData> No newline at end of file
137 <VcsOtherData>
138 <dict> No newline at end of file
138 <dict>
139 <key> No newline at end of file
139 <key>
140 <string>standardLayout</string> No newline at end of file
140 <string>standardLayout</string>
141 </key> No newline at end of file
141 </key>
142 <value> No newline at end of file
142 <value>
143 <bool>True</bool> No newline at end of file
143 <bool>True</bool>
144 </value> No newline at end of file
144 </value>
145 </dict> No newline at end of file
145 </dict>
146 </VcsOtherData> No newline at end of file
146 </VcsOtherData>
147 </Vcs> No newline at end of file
147 </Vcs>
148 <FiletypeAssociations> No newline at end of file
148 <FiletypeAssociations>
149 <FiletypeAssociation pattern="*.ui" type="FORMS" /> No newline at end of file
149 <FiletypeAssociation pattern="*.ui" type="FORMS" />
150 <FiletypeAssociation pattern="*.idl" type="INTERFACES" /> No newline at end of file
150 <FiletypeAssociation pattern="*.idl" type="INTERFACES" />
151 <FiletypeAssociation pattern="*.qm" type="TRANSLATIONS" /> No newline at end of file
151 <FiletypeAssociation pattern="*.qm" type="TRANSLATIONS" />
152 <FiletypeAssociation pattern="*.ptl" type="SOURCES" /> No newline at end of file
152 <FiletypeAssociation pattern="*.ptl" type="SOURCES" />
153 <FiletypeAssociation pattern="*.pyw" type="SOURCES" /> No newline at end of file
153 <FiletypeAssociation pattern="*.pyw" type="SOURCES" />
154 <FiletypeAssociation pattern="*.ui.h" type="FORMS" /> No newline at end of file
154 <FiletypeAssociation pattern="*.ui.h" type="FORMS" />
155 <FiletypeAssociation pattern="*.ts" type="TRANSLATIONS" /> No newline at end of file
155 <FiletypeAssociation pattern="*.ts" type="TRANSLATIONS" />
156 <FiletypeAssociation pattern="*.py" type="SOURCES" /> No newline at end of file
156 <FiletypeAssociation pattern="*.py" type="SOURCES" />
157 <FiletypeAssociation pattern="*.qrc" type="RESOURCES" /> No newline at end of file
157 <FiletypeAssociation pattern="*.qrc" type="RESOURCES" />
158 </FiletypeAssociations> No newline at end of file
158 </FiletypeAssociations>
159 </Project> No newline at end of file
159 </Project>
@@ -1,512 +1,488
1 # -*- coding: utf-8 -*- No newline at end of file
1 # -*- coding: utf-8 -*-
2 No newline at end of file
2
3 """ No newline at end of file
3 """
4 Module implementing MainWindow. No newline at end of file
4 Module implementing MainWindow.
5 """ No newline at end of file
5 """
6 No newline at end of file
6
7 from PyQt4.QtGui import QMainWindow No newline at end of file
7 from PyQt4.QtGui import QMainWindow
8 from PyQt4.QtCore import pyqtSignature No newline at end of file
8 from PyQt4.QtCore import pyqtSignature
9 from Ui_MainWindow import Ui_MainWindow No newline at end of file
9 from Ui_MainWindow import Ui_MainWindow
10 from PyQt4 import QtGui No newline at end of file
10 from PyQt4 import QtGui
11 from subprocess import * No newline at end of file
11 from subprocess import *
12 import sys No newline at end of file
12 import sys
13 import os No newline at end of file
13 import os
14 import subprocess No newline at end of file
14 import subprocess
15 import commands No newline at end of file
15 import commands
16 from functions import functions No newline at end of file
16 No newline at end of file
17
17 class MainWindow(QMainWindow, Ui_MainWindow): No newline at end of file
18 class MainWindow(QMainWindow, Ui_MainWindow):
18 """ No newline at end of file
19 """
19 Class documentation goes here. No newline at end of file
20 Class documentation goes here.
20 """ No newline at end of file
21 """
21 No newline at end of file
22
22 def __init__(self, parent = None): No newline at end of file
23 def __init__(self, parent = None):
23 QMainWindow.__init__(self, parent) No newline at end of file
24 QMainWindow.__init__(self, parent)
24 self.setupUi(self) No newline at end of file
25 self.setupUi(self)
25 self.setupUi2() No newline at end of file
26 self.setupUi2()
26 No newline at end of file
27
27 #redirige salida estandar No newline at end of file
28 #redirige salida estandar
28 sys.stdout = self No newline at end of file
29 sys.stdout = self
29 No newline at end of file
30
30 No newline at end of file
31
31 def setupUi2(self): No newline at end of file
32 def setupUi2(self):
32 """ No newline at end of file
33 """
33 Se usa para inicializar ciertos parametros para pruebas No newline at end of file
34 Se usa para inicializar ciertos parametros para pruebas
34 """
35 """
No newline at end of file
36 #self.txtDpath.setText('/home/ricardoar/optional/STORAGE/Data/RAW_EXP/JASMET/')
35 self.txtDpath.setText('/home/ricardoar/optional/STORAGE/Data/RAW_EXP/JASMET/')
No newline at end of file
No newline at end of file
37 #self.txtRpath.setText('/home/ricardoar/optional/STORAGE/prueba1_jro_backup_manager/')
36 self.txtRpath.setText('/home/ricardoar/optional/STORAGE/prueba1_jro_backup_manager/')
No newline at end of file
No newline at end of file
38 self.txtDpath.setText('/home/ricardoar/optional/STORAGE/EW_DRIFTS/')
37 self.txtElabel.setText('JASMET') No newline at end of file
No newline at end of file
39 self.txtRpath.setText('/home/ricardoar/optional/prueba1_jro_backup_manager/')
No newline at end of file
40 self.txtElabel.setText('EW_DRIFTS') No newline at end of file
38 self.statusDpath = True No newline at end of file
41 self.statusDpath = True
39 self.statusRpath = True No newline at end of file
42 self.statusRpath = True
40 self.var_n_files=0 No newline at end of file
43 self.var_n_files=0
41 # self.statusDpath = False No newline at end of file
44 # self.statusDpath = False
42 # self.statusRpath = False No newline at end of file
45 # self.statusRpath = False
43 No newline at end of file
46
44 No newline at end of file
47
45 # No newline at end of file
48 #
46 #Deteccion de los dispositvos de grabacion No newline at end of file
49 #Deteccion de los dispositvos de grabacion
47 # No newline at end of file
50 #
48 #var_cmd="wodim --devices | grep /dev/ | awk -F\' '{print $2}'" #Funciona en consola pero no en python ΒΏ? No newline at end of file
51 #var_cmd="wodim --devices | grep /dev/ | awk -F\' '{print $2}'" #Funciona en consola pero no en python ΒΏ?
49 var_cmd="wodim --devices | grep /dev/ | awk '{print $2}' | awk -F= '{print $2}'" No newline at end of file
52 var_cmd="wodim --devices | grep /dev/ | awk '{print $2}' | awk -F= '{print $2}'"
50 var_output = commands.getstatusoutput(var_cmd) No newline at end of file
53 var_output = commands.getstatusoutput(var_cmd)
51 if var_output[0] != 0: No newline at end of file
54 if var_output[0] != 0:
52 self.txtInfo.setText("No se pudo encontrar los dispositivos de grabacion, output_error:" + str(var_output)) No newline at end of file
55 self.txtInfo.setText("No se pudo encontrar los dispositivos de grabacion, output_error:" + str(var_output))
53 else: No newline at end of file
56 else:
54 self.txtInfo.append("dispositivos encontrados") No newline at end of file
57 self.txtInfo.append("dispositivos encontrados")
55 var_devices = var_output[1].split('\n') No newline at end of file
58 var_devices = var_output[1].split('\n')
56 No newline at end of file
59
57 var_tmp=[] No newline at end of file
60 var_tmp=[]
58 for i in range(0, 4): No newline at end of file
61 for i in range(0, 4):
59 if i < len(var_devices): No newline at end of file
62 if i < len(var_devices):
60 var_len = len(var_devices[i]) No newline at end of file
63 var_len = len(var_devices[i])
61 var_tmp.append(var_devices[i][1:var_len - 1]) No newline at end of file
64 var_tmp.append(var_devices[i][1:var_len - 1])
62 else: No newline at end of file
65 else:
63 var_tmp.append('') No newline at end of file
66 var_tmp.append('')
64 No newline at end of file
67
65 #Se escriben los dispostivos correspodientes, si existen No newline at end of file
68 #Se escriben los dispostivos correspodientes, si existen
66 self.txtDeviceA.setText(str(var_tmp[0])) No newline at end of file
69 self.txtDeviceA.setText(str(var_tmp[0]))
67 self.txtDeviceB.setText(str(var_tmp[1])) No newline at end of file
70 self.txtDeviceB.setText(str(var_tmp[1]))
68 self.txtDeviceC.setText(str(var_tmp[2])) No newline at end of file
71 self.txtDeviceC.setText(str(var_tmp[2]))
69 self.txtDeviceD.setText(str(var_tmp[3])) No newline at end of file
72 self.txtDeviceD.setText(str(var_tmp[3]))
70 #Se desactivan los que no existen No newline at end of file
73 #Se desactivan los que no existen
71 if len(var_tmp[0]) == 0 : No newline at end of file
74 if len(var_tmp[0]) == 0 :
72 self.chkDevA.setChecked(False) No newline at end of file
75 self.chkDevA.setChecked(False)
73 self.chkDevA.setEnabled(False) No newline at end of file
76 self.chkDevA.setEnabled(False)
74 if len(var_tmp[1]) == 0 : No newline at end of file
77 if len(var_tmp[1]) == 0 :
75 self.chkDevB.setChecked(False) No newline at end of file
78 self.chkDevB.setChecked(False)
76 self.chkDevB.setEnabled(False) No newline at end of file
79 self.chkDevB.setEnabled(False)
77 if len(var_tmp[2]) == 0 : No newline at end of file
80 if len(var_tmp[2]) == 0 :
78 self.chkDevC.setChecked(False) No newline at end of file
81 self.chkDevC.setChecked(False)
79 self.chkDevC.setEnabled(False) No newline at end of file
82 self.chkDevC.setEnabled(False)
80 if len(var_tmp[3]) == 0 : No newline at end of file
83 if len(var_tmp[3]) == 0 :
81 self.chkDevD.setChecked(False) No newline at end of file
84 self.chkDevD.setChecked(False)
82 self.chkDevD.setEnabled(False) No newline at end of file
85 self.chkDevD.setEnabled(False)
83 No newline at end of file
86
84 No newline at end of file
87
85 def write(self, txt): No newline at end of file
88 def write(self, txt):
86 """ No newline at end of file
89 """
87 Escribe la salida estandar eb txtInfo No newline at end of file
90 Escribe la salida estandar eb txtInfo
88 """ No newline at end of file
91 """
89 self.txtInfo.append(str(txt)) No newline at end of file
92 self.txtInfo.append(str(txt))
90 No newline at end of file
93
91 No newline at end of file
94
92 @pyqtSignature("") No newline at end of file
95 @pyqtSignature("")
93 def on_btnDpath_clicked(self): No newline at end of file
96 def on_btnDpath_clicked(self):
94 """ No newline at end of file
97 """
95 Permite seleccionar graficamente el direcorio de los datos a grabar No newline at end of file
98 Permite seleccionar graficamente el direcorio de los datos a grabar
96 """ No newline at end of file
99 """
97 var_Dpath= QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly) No newline at end of file
100 var_Dpath= QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)
98 self.txtDpath.setText(var_Dpath) No newline at end of file
101 self.txtDpath.setText(var_Dpath)
99 No newline at end of file
102
100 #llamada a funcion No newline at end of file
103 #llamada a funcion
101 self.on_txtDpath_editingFinished() No newline at end of file
104 self.on_txtDpath_editingFinished()
102 No newline at end of file
105
103 No newline at end of file
106
104 @pyqtSignature("") No newline at end of file
107 @pyqtSignature("")
105 def on_btnRpath_clicked(self): No newline at end of file
108 def on_btnRpath_clicked(self):
106 """ No newline at end of file
109 """
107 Permite seleccionar graficamente el direcorio del proyecto No newline at end of file
110 Permite seleccionar graficamente el direcorio del proyecto
108 """ No newline at end of file
111 """
109 var_Rpath = QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly) No newline at end of file
112 var_Rpath = QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)
110 self.txtRpath.setText(var_Rpath) No newline at end of file
113 self.txtRpath.setText(var_Rpath)
111 No newline at end of file
114
112 #llamada a funcion No newline at end of file
115 #llamada a funcion
113 self.on_txtRpath_editingFinished() No newline at end of file
116 self.on_txtRpath_editingFinished()
114 No newline at end of file
117
115 No newline at end of file
118
116 @pyqtSignature("") No newline at end of file
119 @pyqtSignature("")
117 def on_txtDpath_editingFinished(self): No newline at end of file
120 def on_txtDpath_editingFinished(self):
118 """ No newline at end of file
121 """
119 Permite buscar los archivos de extension seleccionada en la ruta de de datos No newline at end of file
122 Permite buscar los archivos de extension seleccionada en la ruta de de datos
120 y cargar los valores para el rango de tiempo a ser grabado No newline at end of file
123 y cargar los valores para el rango de tiempo a ser grabado
121 """ No newline at end of file
124 """
122 No newline at end of file
125
123 #Usando el modulo "subprocess", eric4 pide seleccion del tipo de subproceso (padre o hijo) No newline at end of file
126 #Usando el modulo "subprocess", eric4 pide seleccion del tipo de subproceso (padre o hijo)
124 #por ello se prefiere usar el modulo "commands" No newline at end of file
127 #por ello se prefiere usar el modulo "commands"
125 #p1= Popen(['find', var_Dpath, '-name', '*.r'], stdout=PIPE) No newline at end of file
128 #p1= Popen(['find', var_Dpath, '-name', '*.r'], stdout=PIPE)
126 #p2= Popen(['awk', '-F/', '{print substr($NF,2,7)}'], stdin=p1.stdout, stdout=PIPE) No newline at end of file
129 #p2= Popen(['awk', '-F/', '{print substr($NF,2,7)}'], stdin=p1.stdout, stdout=PIPE)
127 #output_p2= p2.communicate()[0] No newline at end of file
130 #output_p2= p2.communicate()[0]
128 #self.txtInfo.setText(output_p2) No newline at end of file
131 #self.txtInfo.setText(output_p2)
129 No newline at end of file
132
130 #Se carga la variable con la ruta de datos No newline at end of file
133 #Se carga la variable con la ruta de datos
131 var_Dpath=self.txtDpath.text() No newline at end of file
134 var_Dpath=self.txtDpath.text()
132 No newline at end of file
135
133 #Se verifica que la ruta exista y sea un directorio No newline at end of file
136 #Se verifica que la ruta exista y sea un directorio
134 var_cmd="test -d "+str(var_Dpath) No newline at end of file
137 var_cmd="test -d "+str(var_Dpath)
135 var_output=commands.getstatusoutput(var_cmd)[0] No newline at end of file
138 var_output=commands.getstatusoutput(var_cmd)[0]
136 if var_output != 0: No newline at end of file
139 if var_output != 0:
137 self.statusDpath = False No newline at end of file
140 self.statusDpath = False
138 self.txtInfo.setText("Ruta no valida, output_error:" + str(var_output)) No newline at end of file
141 self.txtInfo.setText("Ruta no valida, output_error:" + str(var_output))
139 return No newline at end of file
142 return
140 else: No newline at end of file
143 else:
141 self.statusDpath = True No newline at end of file
144 self.statusDpath = True
142 self.txtInfo.append("Ruta valida, sin error:" + str(var_Dpath)) No newline at end of file
145 self.txtInfo.append("Ruta valida, sin error:" + str(var_Dpath))
143 No newline at end of file
146
144 #Se buscan los archivos del tipo especificado No newline at end of file
147 #Se buscan los archivos del tipo especificado
145 var_Dtype=self.txtDtype.text() No newline at end of file
148 var_Dtype=self.txtDtype.text()
146 var_cmd="find " + str(var_Dpath) + " -name *."+ str(var_Dtype) +" | awk -F/ '{print substr($NF,2,7)}' | sort| uniq" No newline at end of file
149 var_cmd="find " + str(var_Dpath) + " -name *."+ str(var_Dtype) +" | awk -F/ '{print substr($NF,2,7)}' | sort| uniq"
147 output_p2=commands.getstatusoutput(var_cmd)[1] No newline at end of file
150 output_p2=commands.getstatusoutput(var_cmd)[1]
148 No newline at end of file
151
149 #Se cargan las listas para seleccionar StartDay y StopDay (QComboBox) No newline at end of file
152 #Se cargan las listas para seleccionar StartDay y StopDay (QComboBox)
150 self.var_list=[] No newline at end of file
153 self.var_list=[]
151 for i in range(0, (len(output_p2)+1)/8): No newline at end of file
154 for i in range(0, (len(output_p2)+1)/8):
152 self.var_list.append(output_p2[8*i:8*(i+1)-1]) No newline at end of file
155 self.var_list.append(output_p2[8*i:8*(i+1)-1])
153 No newline at end of file
156
154 self.lstStartDay.clear() No newline at end of file
157 self.lstStartDay.clear()
155 self.lstStopDay.clear() No newline at end of file
158 self.lstStopDay.clear()
156 No newline at end of file
159
157 for i in self.var_list: No newline at end of file
160 for i in self.var_list:
158 self.lstStartDay.addItem(i) No newline at end of file
161 self.lstStartDay.addItem(i)
159 self.lstStopDay.addItem(i) No newline at end of file
162 self.lstStopDay.addItem(i)
160 No newline at end of file
163
161 self.lstStopDay.setCurrentIndex(self.lstStartDay.count()-1) No newline at end of file
164 self.lstStopDay.setCurrentIndex(self.lstStartDay.count()-1)
162 No newline at end of file
165
163 No newline at end of file
166
164 @pyqtSignature("") No newline at end of file
167 @pyqtSignature("")
165 def on_txtRpath_editingFinished(self): No newline at end of file
168 def on_txtRpath_editingFinished(self):
166 """ No newline at end of file
169 """
167 Valida la ruta del proyecto No newline at end of file
170 Valida la ruta del proyecto
168 """ No newline at end of file
171 """
169 #Se carga la variable con la ruta del proyecto No newline at end of file
172 #Se carga la variable con la ruta del proyecto
170 var_Rpath=self.txtRpath.text() No newline at end of file
173 var_Rpath=self.txtRpath.text()
171 No newline at end of file
174
172 #Se verifica que la ruta exista y sea un directorio No newline at end of file
175 #Se verifica que la ruta exista y sea un directorio
173 var_cmd="test -d "+str(var_Rpath) No newline at end of file
176 var_cmd="test -d "+str(var_Rpath)
174 var_output=commands.getstatusoutput(var_cmd)[0] No newline at end of file
177 var_output=commands.getstatusoutput(var_cmd)[0]
175 if var_output != 0: No newline at end of file
178 if var_output != 0:
176 self.statusRpath = False No newline at end of file
179 self.statusRpath = False
177 self.txtInfo.append("Ruta no valida, output_error:" + str(var_output)) No newline at end of file
180 self.txtInfo.append("Ruta no valida, output_error:" + str(var_output))
178 return No newline at end of file
181 return
179 else: No newline at end of file
182 else:
180 self.statusRpath = True No newline at end of file
183 self.statusRpath = True
181 self.txtInfo.append("Ruta valida, sin error:" + str(var_Rpath)) No newline at end of file
184 self.txtInfo.append("Ruta valida, sin error:" + str(var_Rpath))
182 No newline at end of file
185
183 No newline at end of file
186
184 @pyqtSignature("int") No newline at end of file
187 @pyqtSignature("int")
185 def on_lstDtype_activated(self, index): No newline at end of file
188 def on_lstDtype_activated(self, index):
186 """ No newline at end of file
189 """
187 Permite elegir entre los tipos de archivos No newline at end of file
190 Permite elegir entre los tipos de archivos
188 """ No newline at end of file
191 """
189 if index == 0: No newline at end of file
192 if index == 0:
190 var_type='r' No newline at end of file
193 var_type='r'
191 elif index == 1: No newline at end of file
194 elif index == 1:
192 var_type='pdata' No newline at end of file
195 var_type='pdata'
193 elif index == 2: No newline at end of file
196 elif index == 2:
194 var_type='sswma' No newline at end of file
197 var_type='sswma'
195 No newline at end of file
198
196 if index != 3: No newline at end of file
199 if index != 3:
197 self.txtDtype.setText(var_type) No newline at end of file
200 self.txtDtype.setText(var_type)
198 self.txtDtype.setReadOnly(True) No newline at end of file
201 self.txtDtype.setReadOnly(True)
199 self.on_txtDpath_editingFinished() No newline at end of file
202 self.on_txtDpath_editingFinished()
200 else: No newline at end of file
203 else:
201 self.txtDtype.setText('') No newline at end of file
204 self.txtDtype.setText('')
202 self.txtDtype.setReadOnly(False) No newline at end of file
205 self.txtDtype.setReadOnly(False)
203 No newline at end of file
206
204 No newline at end of file
207
205 @pyqtSignature("") No newline at end of file
208 @pyqtSignature("")
206 def on_txtDtype_editingFinished(self): No newline at end of file
209 def on_txtDtype_editingFinished(self):
207 """ No newline at end of file
210 """
208 Se activa cuando el tipo de archivo es ingresado manualmente No newline at end of file
211 Se activa cuando el tipo de archivo es ingresado manualmente
209 """ No newline at end of file
212 """
210 #llamada a funcion No newline at end of file
213 #llamada a funcion
211 self.on_txtDpath_editingFinished() No newline at end of file
214 self.on_txtDpath_editingFinished()
212 No newline at end of file
215
213 No newline at end of file
216
214 @pyqtSignature("int") #CLOSED No newline at end of file
217 @pyqtSignature("int") #CLOSED
215 def on_lstStartDay_activated(self, index): No newline at end of file
218 def on_lstStartDay_activated(self, index):
216 """ No newline at end of file
219 """
217 Cambia la lista de opciones en lstStopDay No newline at end of file
220 Cambia la lista de opciones en lstStopDay
218 """ No newline at end of file
221 """
219 var_StopDay_index=self.lstStopDay.count() - self.lstStopDay.currentIndex() No newline at end of file
222 var_StopDay_index=self.lstStopDay.count() - self.lstStopDay.currentIndex()
220 self.lstStopDay.clear() No newline at end of file
223 self.lstStopDay.clear()
221 No newline at end of file
224
222 for i in self.var_list[index:]: No newline at end of file
225 for i in self.var_list[index:]:
223 self.lstStopDay.addItem(i) No newline at end of file
226 self.lstStopDay.addItem(i)
224 No newline at end of file
227
225 self.lstStopDay.setCurrentIndex(self.lstStopDay.count() - var_StopDay_index) No newline at end of file
228 self.lstStopDay.setCurrentIndex(self.lstStopDay.count() - var_StopDay_index)
226 No newline at end of file
229
227 No newline at end of file
230
228 @pyqtSignature("int") #CLOSED No newline at end of file
231 @pyqtSignature("int") #CLOSED
229 def on_lstStopDay_activated(self, index): No newline at end of file
232 def on_lstStopDay_activated(self, index):
230 """ No newline at end of file
233 """
231 Cambia la lista de opciones en lstStartDay No newline at end of file
234 Cambia la lista de opciones en lstStartDay
232 """ No newline at end of file
235 """
233 var_StartDay_index=self.lstStartDay.currentIndex() No newline at end of file
236 var_StartDay_index=self.lstStartDay.currentIndex()
234 var_end_index = self.lstStopDay.count() - index No newline at end of file
237 var_end_index = self.lstStopDay.count() - index
235 self.lstStartDay.clear() No newline at end of file
238 self.lstStartDay.clear()
236 No newline at end of file
239
237 for i in self.var_list[:len(self.var_list) - var_end_index + 1]: No newline at end of file
240 for i in self.var_list[:len(self.var_list) - var_end_index + 1]:
238 self.lstStartDay.addItem(i) No newline at end of file
241 self.lstStartDay.addItem(i)
239 No newline at end of file
242
240 self.lstStartDay.setCurrentIndex(var_StartDay_index) No newline at end of file
243 self.lstStartDay.setCurrentIndex(var_StartDay_index)
241 No newline at end of file
244
242 No newline at end of file
245
243 @pyqtSignature("int") #CLOSED No newline at end of file
246 @pyqtSignature("int") #CLOSED
244 def on_lstDcapacity_activated(self, index): No newline at end of file
247 def on_lstDcapacity_activated(self, index):
245 """ No newline at end of file
248 """
246 Permite elegir el tamaΓ±o del disco No newline at end of file
249 Permite elegir el tamaΓ±o del disco
247 """ No newline at end of file
250 """
248 if index == 0: No newline at end of file
251 if index == 0:
249 var_size=25.0 No newline at end of file
252 var_size=25.0
250 elif index == 1: No newline at end of file
253 elif index == 1:
251 var_size=8.5 No newline at end of file
254 var_size=8.5
252 elif index == 2: No newline at end of file
255 elif index == 2:
253 var_size=4.7 No newline at end of file
256 var_size=4.7
254 elif index == 3: No newline at end of file
257 elif index == 3:
255 var_size=0.7 No newline at end of file
258 var_size=0.7
256 No newline at end of file
259
257 if index != 4: No newline at end of file
260 if index != 4:
258 self.txtDcapacity.setText(str(var_size*10**9/1024**2)) No newline at end of file
261 self.txtDcapacity.setText(str(var_size*10**9/1024**2))
259 self.txtDcapacity.setReadOnly(True) No newline at end of file
262 self.txtDcapacity.setReadOnly(True)
260 else: No newline at end of file
263 else:
261 self.txtDcapacity.setText('') No newline at end of file
264 self.txtDcapacity.setText('')
262 self.txtDcapacity.setReadOnly(False) No newline at end of file
265 self.txtDcapacity.setReadOnly(False)
263 No newline at end of file
266
264 No newline at end of file
267
265 @pyqtSignature("") No newline at end of file
268 @pyqtSignature("")
266 def on_btnGbkp_clicked(self): No newline at end of file
269 def on_btnGbkp_clicked(self):
267 """ No newline at end of file
270 """
268 Cuando se presiona el boton btnGbkp No newline at end of file
271 Cuando se presiona el boton btnGbkp
269 """ No newline at end of file
272 """
270 No newline at end of file
273
271 #Verifica que las rutas sean validas No newline at end of file
274 #Verifica que las rutas sean validas
272 if self.statusDpath == False or self.statusRpath == False: No newline at end of file
275 if self.statusDpath == False or self.statusRpath == False:
273 if self.statusDpath == False: No newline at end of file
276 if self.statusDpath == False:
274 self.txtInfo.append("Ruta de datos no valida") No newline at end of file
277 self.txtInfo.append("Ruta de datos no valida")
275 if self.statusRpath == False: No newline at end of file
278 if self.statusRpath == False:
276 self.txtInfo.append("Ruta de proyecto no valida") No newline at end of file
279 self.txtInfo.append("Ruta de proyecto no valida")
277 return No newline at end of file
280 return
278 No newline at end of file
281
279 #Crea las carpetas en la ruta del proyecto y verifica que se crearon correctamente No newline at end of file
282 #Crea las carpetas en la ruta del proyecto y verifica que se crearon correctamente
280 var_Rpath=self.txtRpath.text()
283 var_Rpath=self.txtRpath.text()
No newline at end of file
284 list_dirs=['gpath', 'iso', 'ppath']
281 var_dirs='/{gpath,iso,ppath}'
No newline at end of file
No newline at end of file
285 functions.make_dirs(var_Rpath, list_dirs, self) No newline at end of file
282 var_cmd="mkdir -p "+str(var_Rpath)+str(var_dirs)
No newline at end of file
283 var_output=commands.getstatusoutput(var_cmd)[0]
No newline at end of file
284 if var_output != 0:
No newline at end of file
285 self.txtInfo.append("No se pudieron crear los directorios, output_error:" + str(var_output))
No newline at end of file
286 return
No newline at end of file
287 else:
No newline at end of file
288 self.txtInfo.append('Carpetas creadas correctamente') No newline at end of file
289 No newline at end of file
286
290 #Cargando variables con los parametros No newline at end of file
287 #Cargando variables con los parametros
291 var_Dpath=self.txtDpath.text() No newline at end of file
288 var_Dpath=self.txtDpath.text()
292 var_Rpath=self.txtRpath.text() No newline at end of file
289 var_Rpath=self.txtRpath.text()
293 var_Rpath_ppath=var_Rpath+"/ppath" #Ruta de los archivos a grabar No newline at end of file
290 var_Rpath_ppath=var_Rpath+"/ppath" #Ruta de los archivos a grabar
294 var_sublist=[] No newline at end of file
291 var_sublist=[]
295 for i in self.var_list[self.lstStartDay.currentIndex():self.lstStartDay.currentIndex() + self.lstStopDay.currentIndex()+1]: No newline at end of file
292 for i in self.var_list[self.lstStartDay.currentIndex():self.lstStartDay.currentIndex() + self.lstStopDay.currentIndex()+1]:
296 var_sublist.append(i) No newline at end of file
293 var_sublist.append(i)
297 if len(var_sublist) == 0: No newline at end of file
294 if len(var_sublist) == 0:
298 self.txtInfo.append("No existen archivos encontrados") No newline at end of file
295 self.txtInfo.append("No existen archivos encontrados")
299 return No newline at end of file
296 return
300 #self.txtInfo.append('elementos: '+str(len(var_sublist))) No newline at end of file
297 #self.txtInfo.append('elementos: '+str(len(var_sublist)))
301 No newline at end of file
298
302 No newline at end of file
299
303 var_Dtype=self.txtDtype.text() No newline at end of file
300 var_Dtype=self.txtDtype.text()
304 var_Dcapacity=float(self.txtDcapacity.text())*1024 #tamaΓ±o en KB No newline at end of file
301 var_Dcapacity=float(self.txtDcapacity.text())*1024 #tamaΓ±o en KB
305 No newline at end of file
302
306 #Busca los archivos con los parametros de busqueda No newline at end of file
303 #Busca los archivos con los parametros de busqueda
307 var_files_list=[] No newline at end of file
304 var_files_list=[]
308 for var_doy in var_sublist: No newline at end of file
305 for var_doy in var_sublist:
309 var_cmd="find " + str(var_Dpath) + " -name ?"+var_doy+"???."+ str(var_Dtype) + " |sort" No newline at end of file
306 var_cmd="find " + str(var_Dpath) + " -name ?"+var_doy+"???."+ str(var_Dtype) + " |sort"
310 var_output=commands.getstatusoutput(var_cmd)[1] No newline at end of file
307 var_output=commands.getstatusoutput(var_cmd)[1]
311 for var_file in var_output.split(): No newline at end of file
308 for var_file in var_output.split():
312 var_files_list.append(var_file) #Almacena cada archivo en la lista No newline at end of file
309 var_files_list.append(var_file) #Almacena cada archivo en la lista
313 No newline at end of file
310
314 # No newline at end of file
311 #
315 #Genera la lista de archivos .dat que contienen los archivos a grabar en cada DVD No newline at end of file
312 #Genera la lista de archivos .dat que contienen los archivos a grabar en cada DVD
316 # No newline at end of file
313 #
317 var_n=0 #Numero del DVD actual No newline at end of file
314 var_n=0 #Numero del DVD actual
318 var_tmp=0 #Se usa para acumulanr el tamaΓ±o de los archivos de la lista No newline at end of file
315 var_tmp=0 #Se usa para acumulanr el tamaΓ±o de los archivos de la lista
319 var_files_list_2=[] #Se usa para almacenar la lista de archivos agrbar en cada DVD No newline at end of file
316 var_files_list_2=[] #Se usa para almacenar la lista de archivos agrbar en cada DVD
320 No newline at end of file
317
321 for i in var_files_list: #Se asignan en i los archivos de la lista No newline at end of file
318 for i in var_files_list: #Se asignan en i los archivos de la lista
322 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 No newline at end of file
319 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
323 var_tmp += var_size_i #Se acumulan el tamaΓ±o de los archivos de la lista No newline at end of file
320 var_tmp += var_size_i #Se acumulan el tamaΓ±o de los archivos de la lista
324 No newline at end of file
321
325 #Si el tamaΓ±o acumulado es mayor que el de el DVD No newline at end of file
322 #Si el tamaΓ±o acumulado es mayor que el de el DVD
326 if var_tmp > var_Dcapacity: No newline at end of file
323 if var_tmp > var_Dcapacity:
327 var_tmp -= var_size_i #se quita el tamaΓ±o sumado para mostrar el tamaΓ±o real
324 var_tmp -= var_size_i #se quita el tamaΓ±o sumado para mostrar el tamaΓ±o real
No newline at end of file
328 #se agregan los ceros necesarios
No newline at end of file
329 if len(str(var_n)) < 4:
No newline at end of file
330 var_n2=""
No newline at end of file
331 for k in range(0, 4-len(str(var_n))):
No newline at end of file
332 var_n2 = var_n2+"0" No newline at end of file
333 #se crea un archivo con numeral en el sufijo y extension .dat
325 #se crea un archivo con numeral en el sufijo y extension .dat
No newline at end of file
326 var_file = open(var_Rpath_ppath+"/"+self.txtElabel.text()+"_"+functions.i2s(var_n)+".dat","w") No newline at end of file
334 var_file = open(var_Rpath_ppath+"/"+self.txtElabel.text()+"_"+str(var_n2)+str(var_n)+".dat","w") No newline at end of file
335 #Se aΓ±ade la lista de archivos a grabar en el DVD al archivo .dat No newline at end of file
327 #Se aΓ±ade la lista de archivos a grabar en el DVD al archivo .dat
336 for line in var_files_list_2: No newline at end of file
328 for line in var_files_list_2:
337 var_tmp_path=(line.split(var_Dpath)[1]).split('/') No newline at end of file
329 var_tmp_path=(line.split(var_Dpath)[1]).split('/')
338 var_tmp_path2="/" No newline at end of file
330 var_tmp_path2="/"
339 for l in range(0, len(var_tmp_path)-1): No newline at end of file
331 for l in range(0, len(var_tmp_path)-1):
340 var_tmp_path2=var_tmp_path2+str(var_tmp_path[l])+"/" No newline at end of file
332 var_tmp_path2=var_tmp_path2+str(var_tmp_path[l])+"/"
341 var_file.write(var_tmp_path2+'=') No newline at end of file
333 var_file.write(var_tmp_path2+'=')
342 var_file.write(line+'\n') No newline at end of file
334 var_file.write(line+'\n')
343 var_file.close() No newline at end of file
335 var_file.close()
344 No newline at end of file
336
345 var_tmp = var_size_i #Se asigna a la variable el tamaΓ±o del archivo actual No newline at end of file
337 var_tmp = var_size_i #Se asigna a la variable el tamaΓ±o del archivo actual
346 var_files_list_2=[] #Se reinicia la lista No newline at end of file
338 var_files_list_2=[] #Se reinicia la lista
347 var_n += 1 No newline at end of file
339 var_n += 1
348 var_files_list_2.append(i) No newline at end of file
340 var_files_list_2.append(i)
349
341
No newline at end of file
350 #se agregan los ceros necesarios
No newline at end of file
351 if len(str(var_n)) < 4:
No newline at end of file
352 var_n2=""
No newline at end of file
353 for k in range(0, 4-len(str(var_n))):
No newline at end of file
354 var_n2 = var_n2+"0" No newline at end of file
355 #se crea un archivo con numeral en el sufijo y extension .dat
342 #se crea un archivo con numeral en el sufijo y extension .dat
No newline at end of file
343 var_file = open(var_Rpath_ppath+"/"+self.txtElabel.text()+"_"+functions.i2s(var_n)+".dat","w") No newline at end of file
356 var_file = open(var_Rpath_ppath+"/"+self.txtElabel.text()+"_"+str(var_n2)+str(var_n)+".dat","w") No newline at end of file
357 #Se aΓ±ade la lista de archivos a grabar en el DVD al archivo .dat No newline at end of file
344 #Se aΓ±ade la lista de archivos a grabar en el DVD al archivo .dat
358 for line in var_files_list_2: No newline at end of file
345 for line in var_files_list_2:
359 var_tmp_path=(line.split(var_Dpath)[1]).split('/') No newline at end of file
346 var_tmp_path=(line.split(var_Dpath)[1]).split('/')
360 var_tmp_path2="/" No newline at end of file
347 var_tmp_path2="/"
361 for l in range(0, len(var_tmp_path)-1): No newline at end of file
348 for l in range(0, len(var_tmp_path)-1):
362 var_tmp_path2=var_tmp_path2+str(var_tmp_path[l])+"/" No newline at end of file
349 var_tmp_path2=var_tmp_path2+str(var_tmp_path[l])+"/"
363 var_file.write(var_tmp_path2+'=') No newline at end of file
350 var_file.write(var_tmp_path2+'=')
364 var_file.write(line+'\n') No newline at end of file
351 var_file.write(line+'\n')
365 var_file.close() No newline at end of file
352 var_file.close()
366 No newline at end of file
353
367 # No newline at end of file
354 #
368 #Genera los archivos .print con los cuales se creara los postscript No newline at end of file
355 #Genera los archivos .print con los cuales se creara los postscript
369 # No newline at end of file
356 #
370 self.var_n_files = var_n # Numero del ultimo archivo .dat creado No newline at end of file
357 self.var_n_files = var_n # Numero del ultimo archivo .dat creado
371 var_n = 0 # Se reinicia a cero y se usa para poder acceder a cada una de los archivos No newline at end of file
358 var_n = 0 # Se reinicia a cero y se usa para poder acceder a cada una de los archivos
372 No newline at end of file
359
373 # Se leen todos los archivos .dat creados para crear las etiquetas en los archivos .ps No newline at end of file
360 # Se leen todos los archivos .dat creados para crear las etiquetas en los archivos .ps
374 for var_n in range(0, self.var_n_files+1): No newline at end of file
361 for var_n in range(0, self.var_n_files+1):
375 print var_n No newline at end of file
362 print var_n
376
363
No newline at end of file
377 #se agregan los ceros necesarios
No newline at end of file
378 if len(str(var_n)) < 4:
No newline at end of file
379 var_n2=""
No newline at end of file
380 for k in range(0, 4-len(str(var_n))):
No newline at end of file
381 var_n2 = var_n2+"0" No newline at end of file
382 #se abren los archivos .dat en modo lectura
364 #se abren los archivos .dat en modo lectura
No newline at end of file
365 var_file = open(var_Rpath_ppath+"/"+self.txtElabel.text()+"_"+functions.i2s(var_n)+".dat","r") No newline at end of file
383 var_file = open(var_Rpath_ppath+"/"+self.txtElabel.text()+"_"+str(var_n2)+str(var_n)+".dat","r") No newline at end of file
384 lines=var_file.readlines() # Se lee las lineas en el archivo y se almacenan en la lista No newline at end of file
366 lines=var_file.readlines() # Se lee las lineas en el archivo y se almacenan en la lista
385 No newline at end of file
367
386 # Se crea el archivo .print No newline at end of file
368 # Se crea el archivo .print
387 var_file_print = open(var_Rpath_ppath+"/"+self.txtElabel.text()+"_"+str(var_n2)+str(var_n)+".print","w") No newline at end of file
369 var_file_print = open(var_Rpath_ppath+"/"+self.txtElabel.text()+"_"+str(var_n2)+str(var_n)+".print","w")
388 var_file_print.write(self.txtElabel.text()+" "+str(var_n2)+str(var_n)+"/"+str(self.var_n_files)+"\n") No newline at end of file
370 var_file_print.write(self.txtElabel.text()+" "+str(var_n2)+str(var_n)+"/"+str(self.var_n_files)+"\n")
389 var_file_print.write("Year Doy Folder Set Time range\n") No newline at end of file
371 var_file_print.write("Year Doy Folder Set Time range\n")
390 No newline at end of file
372
391 #Se crean los archivos .print con los cuales se crearan los archivos .ps No newline at end of file
373 #Se crean los archivos .print con los cuales se crearan los archivos .ps
392 var_first_folder = lines[0].split('=')[0] No newline at end of file
374 var_first_folder = lines[0].split('=')[0]
393 var_first_file = (lines[0].split('=')[1])[:-1] No newline at end of file
375 var_first_file = (lines[0].split('=')[1])[:-1]
394 var_date_first_file=commands.getstatusoutput("date -r "+var_first_file+" +'%T'")[1] No newline at end of file
376 var_date_first_file=commands.getstatusoutput("date -r "+var_first_file+" +'%T'")[1]
395 No newline at end of file
377
396 for j in range(1, len(lines)-1): No newline at end of file
378 for j in range(1, len(lines)-1):
397 var_tmp_folder = lines[j].split('=')[0] No newline at end of file
379 var_tmp_folder = lines[j].split('=')[0]
398 var_tmp_file = (lines[j].split('=')[1])[:-1] No newline at end of file
380 var_tmp_file = (lines[j].split('=')[1])[:-1]
399 No newline at end of file
381
400 # Si el subfolder superior o la fecha del archivo cambia se genera una nueva linea No newline at end of file
382 # Si el subfolder superior o la fecha del archivo cambia se genera una nueva linea
401 if (var_tmp_folder != var_first_folder) or (var_tmp_file[0:-5] != var_first_file[0:-5]): No newline at end of file
383 if (var_tmp_folder != var_first_folder) or (var_tmp_file[0:-5] != var_first_file[0:-5]):
402 No newline at end of file
384
403 var_last_file = (lines[j-1].split('=')[1])[:-1] No newline at end of file
385 var_last_file = (lines[j-1].split('=')[1])[:-1]
404 var_date_last_file=commands.getstatusoutput("date -r "+var_last_file+" +'%T'")[1] No newline at end of file
386 var_date_last_file=commands.getstatusoutput("date -r "+var_last_file+" +'%T'")[1]
405 # Si el archivo se grabara directamente en la / del DVD y no en un /directorio/ No newline at end of file
387 # Si el archivo se grabara directamente en la / del DVD y no en un /directorio/
406 # se usa la etiqueta para indicar la parte de la etiqueta donde va el subdirectorio No newline at end of file
388 # se usa la etiqueta para indicar la parte de la etiqueta donde va el subdirectorio
407 if var_first_folder == '/': No newline at end of file
389 if var_first_folder == '/':
408 var_folder = self.txtElabel.text() No newline at end of file
390 var_folder = self.txtElabel.text()
409 else: No newline at end of file
391 else:
410 var_folder = var_first_folder.split('/')[1] No newline at end of file
392 var_folder = var_first_folder.split('/')[1]
411 No newline at end of file
393
412 var_file_print.write(var_first_file[-12:-8]+" "+var_first_file[-8:-5]+" "+var_folder +" "+var_first_file[-5:-2]+" " No newline at end of file
394 var_file_print.write(var_first_file[-12:-8]+" "+var_first_file[-8:-5]+" "+var_folder +" "+var_first_file[-5:-2]+" "
413 +var_last_file[-5:-2]+" "+var_date_first_file+" "+var_date_last_file+"\n") No newline at end of file
395 +var_last_file[-5:-2]+" "+var_date_first_file+" "+var_date_last_file+"\n")
414 No newline at end of file
396
415 var_first_folder = lines[j].split('=')[0] No newline at end of file
397 var_first_folder = lines[j].split('=')[0]
416 var_first_file = (lines[j].split('=')[1])[:-1] No newline at end of file
398 var_first_file = (lines[j].split('=')[1])[:-1]
417 var_date_first_file=commands.getstatusoutput("date -r "+var_first_file+" +'%T'")[1] No newline at end of file
399 var_date_first_file=commands.getstatusoutput("date -r "+var_first_file+" +'%T'")[1]
418 No newline at end of file
400
419 var_last_file = (lines[-1].split('=')[1])[:-1] No newline at end of file
401 var_last_file = (lines[-1].split('=')[1])[:-1]
420 var_date_last_file=commands.getstatusoutput("date -r "+var_last_file+" +'%T'")[1] No newline at end of file
402 var_date_last_file=commands.getstatusoutput("date -r "+var_last_file+" +'%T'")[1]
421 No newline at end of file
403
422 if var_first_folder == '/': No newline at end of file
404 if var_first_folder == '/':
423 var_folder = self.txtElabel.text() No newline at end of file
405 var_folder = self.txtElabel.text()
424 else: No newline at end of file
406 else:
425 var_folder = var_first_folder.split('/')[1] No newline at end of file
407 var_folder = var_first_folder.split('/')[1]
426 No newline at end of file
408
427 var_file_print.write(var_first_file[-12:-8]+" "+var_first_file[-8:-5]+" "+var_folder +" "+var_first_file[-5:-2]+" " No newline at end of file
409 var_file_print.write(var_first_file[-12:-8]+" "+var_first_file[-8:-5]+" "+var_folder +" "+var_first_file[-5:-2]+" "
428 +var_last_file[-5:-2]+" "+var_date_first_file+" "+var_date_last_file+"\n") No newline at end of file
410 +var_last_file[-5:-2]+" "+var_date_first_file+" "+var_date_last_file+"\n")
429 No newline at end of file
411
430 var_file.close() No newline at end of file
412 var_file.close()
431 var_file_print.close() No newline at end of file
413 var_file_print.close()
432 No newline at end of file
414
433 No newline at end of file
415
434 #Se deshabilita el Tab Parameters y el boton btnGbkp No newline at end of file
416 #Se deshabilita el Tab Parameters y el boton btnGbkp
435 self.tabParameters.setEnabled(False) No newline at end of file
417 self.tabParameters.setEnabled(False)
436 self.btnGbkp.setEnabled(False) No newline at end of file
418 self.btnGbkp.setEnabled(False)
437 No newline at end of file
419
438 No newline at end of file
420
439 @pyqtSignature("") No newline at end of file
421 @pyqtSignature("")
440 def on_btnStartburn_clicked(self): No newline at end of file
422 def on_btnStartburn_clicked(self):
441 """ No newline at end of file
423 """
442 Se inicia el proceso de grabacion No newline at end of file
424 Se inicia el proceso de grabacion
443 """ No newline at end of file
425 """
444 sys.stdout = self No newline at end of file
426 sys.stdout = self
445 #sys.stderr = self No newline at end of file
427 #sys.stderr = self
446 print "stdout_!!!" No newline at end of file
428 print "stdout_!!!"
447 No newline at end of file
429
448 #Inicializando variables No newline at end of file
430 #Inicializando variables
449 var_Rpath=self.txtRpath.text() No newline at end of file
431 var_Rpath=self.txtRpath.text()
450 var_Rpath_ppath=var_Rpath+"/ppath" No newline at end of file
432 var_Rpath_ppath=var_Rpath+"/ppath"
451 var_Rpath_iso=var_Rpath+"/iso" No newline at end of file
433 var_Rpath_iso=var_Rpath+"/iso"
452 var_label=self.txtElabel.text() No newline at end of file
434 var_label=self.txtElabel.text()
453 No newline at end of file
435
454 # Se leen todos los archivos .dat creados para crear las etiquetas en los archivos .ps No newline at end of file
436 # Se leen todos los archivos .dat creados para crear las etiquetas en los archivos .ps
455 for var_n in range(0, self.var_n_files+1): No newline at end of file
437 for var_n in range(0, self.var_n_files+1):
456 print var_n No newline at end of file
438 print var_n
457
439
No newline at end of file
458 #se agregan los ceros necesarios
No newline at end of file
459 if len(str(var_n)) < 4:
No newline at end of file
460 var_n2=""
No newline at end of file
461 for k in range(0, 4-len(str(var_n))):
No newline at end of file
462 var_n2 = var_n2+"0"
No newline at end of file
463 No newline at end of file
464 file_iso=var_Rpath_iso+"/"+var_n2+str(var_n)+".iso"
440 file_iso=var_Rpath_iso+"/"+var_n2+str(var_n)+".iso"
No newline at end of file
441 file_dat=var_Rpath_ppath+"/"+self.txtElabel.text()+"_"+functions.i2s(var_n)+".dat" No newline at end of file
465 file_dat=var_Rpath_ppath+"/"+self.txtElabel.text()+"_"+str(var_n2)+str(var_n)+".dat" No newline at end of file
466 No newline at end of file
442
467 var_cmd = 'genisoimage -hide-joliet-trans-tbl -joliet-long -r ' No newline at end of file
443 var_cmd = 'genisoimage -hide-joliet-trans-tbl -joliet-long -r '
468 var_cmd += ' -A '+var_label+' -V '+var_label No newline at end of file
444 var_cmd += ' -A '+var_label+' -V '+var_label
469 var_cmd += ' -graft-points -path-list '+ file_dat+' -o '+file_iso No newline at end of file
445 var_cmd += ' -graft-points -path-list '+ file_dat+' -o '+file_iso
470 self.txtInfo.append(var_cmd) No newline at end of file
446 self.txtInfo.append(var_cmd)
471 No newline at end of file
447
472 var_output=commands.getstatusoutput(str(var_cmd))[0] No newline at end of file
448 var_output=commands.getstatusoutput(str(var_cmd))[0]
473 self.txtInfo.append(str(var_output)) No newline at end of file
449 self.txtInfo.append(str(var_output))
474 No newline at end of file
450
475 #os.system(str(var_cmd)) No newline at end of file
451 #os.system(str(var_cmd))
476 #p = subprocess.Popen(str('ls /'), shell=True, stdout=self) No newline at end of file
452 #p = subprocess.Popen(str('ls /'), shell=True, stdout=self)
477 #os.waitpid(p.pid, 0) No newline at end of file
453 #os.waitpid(p.pid, 0)
478 ####self.txtInfo.append(str(p.pid)) No newline at end of file
454 ####self.txtInfo.append(str(p.pid))
479 No newline at end of file
455
480 No newline at end of file
456
481 No newline at end of file
457
482 @pyqtSignature("") No newline at end of file
458 @pyqtSignature("")
483 def on_btnRestart_clicked(self): No newline at end of file
459 def on_btnRestart_clicked(self):
484 """ No newline at end of file
460 """
485 Slot documentation goes here. No newline at end of file
461 Slot documentation goes here.
486 """ No newline at end of file
462 """
487 self.tabParameters.setEnabled(True) No newline at end of file
463 self.tabParameters.setEnabled(True)
488 self.btnGbkp.setEnabled(True) No newline at end of file
464 self.btnGbkp.setEnabled(True)
489 No newline at end of file
465
490 @pyqtSignature("") No newline at end of file
466 @pyqtSignature("")
491 def on_btnTdevA_clicked(self): No newline at end of file
467 def on_btnTdevA_clicked(self):
492 var_dev = str(self.txtDeviceA.text()) No newline at end of file
468 var_dev = str(self.txtDeviceA.text())
493 var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev No newline at end of file
469 var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev
494 commands.getstatusoutput(var_cmd) No newline at end of file
470 commands.getstatusoutput(var_cmd)
495 No newline at end of file
471
496 @pyqtSignature("") No newline at end of file
472 @pyqtSignature("")
497 def on_btnTdevB_clicked(self): No newline at end of file
473 def on_btnTdevB_clicked(self):
498 var_dev = str(self.txtDeviceB.text()) No newline at end of file
474 var_dev = str(self.txtDeviceB.text())
499 var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev No newline at end of file
475 var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev
500 commands.getstatusoutput(var_cmd) No newline at end of file
476 commands.getstatusoutput(var_cmd)
501 No newline at end of file
477
502 @pyqtSignature("") No newline at end of file
478 @pyqtSignature("")
503 def on_btnTdevC_clicked(self): No newline at end of file
479 def on_btnTdevC_clicked(self):
504 var_dev = str(self.txtDeviceC.text()) No newline at end of file
480 var_dev = str(self.txtDeviceC.text())
505 var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev No newline at end of file
481 var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev
506 commands.getstatusoutput(var_cmd) No newline at end of file
482 commands.getstatusoutput(var_cmd)
507 No newline at end of file
483
508 @pyqtSignature("") No newline at end of file
484 @pyqtSignature("")
509 def on_btnTdevD_clicked(self): No newline at end of file
485 def on_btnTdevD_clicked(self):
510 var_dev = str(self.txtDeviceD.text()) No newline at end of file
486 var_dev = str(self.txtDeviceD.text())
511 var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev No newline at end of file
487 var_cmd = 'eject ' + var_dev + '; eject -t ' + var_dev
512 commands.getstatusoutput(var_cmd) No newline at end of file
488 commands.getstatusoutput(var_cmd)
General Comments 0
You need to be logged in to leave comments. Login now