Index: bk_manager/trunk/ui/MainWindow.py =================================================================== diff --git a/bk_manager/trunk/ui/MainWindow.py b/bk_manager/trunk/ui/MainWindow.py --- a/bk_manager/trunk/ui/MainWindow.py (revision 8) +++ b/bk_manager/trunk/ui/MainWindow.py (revision 9) @@ -10,16 +10,14 @@ from PyQt4 import QtGui from subprocess import * import sys -import subprocess +#import subprocess +import commands class MainWindow(QMainWindow, Ui_MainWindow): """ Class documentation goes here. """ def __init__(self, parent = None): - """ - Constructor - """ QMainWindow.__init__(self, parent) self.setupUi(self) @@ -30,9 +28,7 @@ """ var_Dpath= QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly) self.txtDpath.setText(var_Dpath) - - # TODO: not implemented yet -# raise NotImplementedError + self.on_txtDpath_editingFinished() @pyqtSignature("") def on_btnRpath_clicked(self): @@ -47,23 +43,32 @@ @pyqtSignature("") def on_txtDpath_editingFinished(self): - """ - Slot documentation goes here. - """ + + var_Dpath=self.txtDpath.text() - - var_Dpath=self.txtDpath.text() - p1= Popen(['find', var_Dpath, '-name', '*.r'], stdout=PIPE) - p2= Popen(['awk', '-F/', '{print substr($NF,2,7)}'], stdin=p1.stdout, stdout=PIPE) - output_p2= p2.communicate()[0] + #Usando el modulo "subprocess" eric4 pide seleccion del tipo de subproceso (padre o hijo) + #por ello se prefiere usar el modulo "commands" + #p1= Popen(['find', var_Dpath, '-name', '*.r'], stdout=PIPE) + #p2= Popen(['awk', '-F/', '{print substr($NF,2,7)}'], stdin=p1.stdout, stdout=PIPE) + #output_p2= p2.communicate()[0] #self.txtInfo.setText(output_p2) + var_cmd="find " + str(var_Dpath) + " -name *.r | awk -F/ '{print substr($NF,2,7)}' | sort| uniq" + output_p2=commands.getstatusoutput(var_cmd)[] + + self.txtInfo.setText(output_p2) + var_list=[] - for i in range(0, len(output_p2)/8): + for i in range(0, (len(output_p2)+1)/8): var_list.append(output_p2[8*i:8*(i+1)-1]) self.lstStartDay.clear() + self.lstStopDay.clear() + + for i in var_list: + self.lstStartDay.addItem(i) + self.lstStopDay.addItem(i) - for i in var_list: -# self.txtInfo.append(i) - self.lstStartDay.addItem(i) + self.txtInfo.setText(str(self.lstStartDay.count())) + self.lstStopDay.setCurrentIndex(self.lstStartDay.count()-1) +