##// END OF EJS Templates
***
ralonso -
r8:9
parent child
Show More
@@ -10,16 +10,14
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 subprocess
13 #import subprocess
14 import commands
14
15
15 class MainWindow(QMainWindow, Ui_MainWindow):
16 class MainWindow(QMainWindow, Ui_MainWindow):
16 """
17 """
17 Class documentation goes here.
18 Class documentation goes here.
18 """
19 """
19 def __init__(self, parent = None):
20 def __init__(self, parent = None):
20 """
21 Constructor
22 """
23 QMainWindow.__init__(self, parent)
21 QMainWindow.__init__(self, parent)
24 self.setupUi(self)
22 self.setupUi(self)
25
23
@@ -30,9 +28,7
30 """
28 """
31 var_Dpath= QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)
29 var_Dpath= QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly)
32 self.txtDpath.setText(var_Dpath)
30 self.txtDpath.setText(var_Dpath)
33
31 self.on_txtDpath_editingFinished()
34 # TODO: not implemented yet
35 # raise NotImplementedError
36
32
37 @pyqtSignature("")
33 @pyqtSignature("")
38 def on_btnRpath_clicked(self):
34 def on_btnRpath_clicked(self):
@@ -47,23 +43,32
47
43
48 @pyqtSignature("")
44 @pyqtSignature("")
49 def on_txtDpath_editingFinished(self):
45 def on_txtDpath_editingFinished(self):
50 """
46
51 Slot documentation goes here.
47 var_Dpath=self.txtDpath.text()
52 """
53
48
54
49 #Usando el modulo "subprocess" eric4 pide seleccion del tipo de subproceso (padre o hijo)
55 var_Dpath=self.txtDpath.text()
50 #por ello se prefiere usar el modulo "commands"
56 p1= Popen(['find', var_Dpath, '-name', '*.r'], stdout=PIPE)
51 #p1= Popen(['find', var_Dpath, '-name', '*.r'], stdout=PIPE)
57 p2= Popen(['awk', '-F/', '{print substr($NF,2,7)}'], stdin=p1.stdout, stdout=PIPE)
52 #p2= Popen(['awk', '-F/', '{print substr($NF,2,7)}'], stdin=p1.stdout, stdout=PIPE)
58 output_p2= p2.communicate()[0]
53 #output_p2= p2.communicate()[0]
59 #self.txtInfo.setText(output_p2)
54 #self.txtInfo.setText(output_p2)
60
55
56 var_cmd="find " + str(var_Dpath) + " -name *.r | awk -F/ '{print substr($NF,2,7)}' | sort| uniq"
57 output_p2=commands.getstatusoutput(var_cmd)[]
58
59 self.txtInfo.setText(output_p2)
60
61 var_list=[]
61 var_list=[]
62 for i in range(0, len(output_p2)/8):
62 for i in range(0, (len(output_p2)+1)/8):
63 var_list.append(output_p2[8*i:8*(i+1)-1])
63 var_list.append(output_p2[8*i:8*(i+1)-1])
64
64
65 self.lstStartDay.clear()
65 self.lstStartDay.clear()
66 self.lstStopDay.clear()
67
68 for i in var_list:
69 self.lstStartDay.addItem(i)
70 self.lstStopDay.addItem(i)
66
71
67 for i in var_list:
72 self.txtInfo.setText(str(self.lstStartDay.count()))
68 # self.txtInfo.append(i)
73 self.lstStopDay.setCurrentIndex(self.lstStartDay.count()-1)
69 self.lstStartDay.addItem(i)
74
General Comments 0
You need to be logged in to leave comments. Login now