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