@@ -1,65 +1,69 | |||||
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 subprocess |
|
13 | import subprocess | |
14 |
|
14 | |||
15 | class MainWindow(QMainWindow, Ui_MainWindow): |
|
15 | class MainWindow(QMainWindow, Ui_MainWindow): | |
16 | """ |
|
16 | """ | |
17 | Class documentation goes here. |
|
17 | Class documentation goes here. | |
18 | """ |
|
18 | """ | |
19 | def __init__(self, parent = None): |
|
19 | def __init__(self, parent = None): | |
20 | """ |
|
20 | """ | |
21 | Constructor |
|
21 | Constructor | |
22 | """ |
|
22 | """ | |
23 | QMainWindow.__init__(self, parent) |
|
23 | QMainWindow.__init__(self, parent) | |
24 | self.setupUi(self) |
|
24 | self.setupUi(self) | |
25 |
|
25 | |||
26 | @pyqtSignature("") |
|
26 | @pyqtSignature("") | |
27 | def on_btnDpath_clicked(self): |
|
27 | def on_btnDpath_clicked(self): | |
28 | """ |
|
28 | """ | |
29 | Slot documentation goes here. |
|
29 | Slot documentation goes here. | |
30 | """ |
|
30 | """ | |
31 | var_Dpath= QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly) |
|
31 | var_Dpath= QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly) | |
32 | self.txtDpath.setText(var_Dpath) |
|
32 | self.txtDpath.setText(var_Dpath) | |
33 |
|
33 | |||
34 | # TODO: not implemented yet |
|
34 | # TODO: not implemented yet | |
35 | # raise NotImplementedError |
|
35 | # raise NotImplementedError | |
36 |
|
36 | |||
37 | @pyqtSignature("") |
|
37 | @pyqtSignature("") | |
38 | def on_btnRpath_clicked(self): |
|
38 | def on_btnRpath_clicked(self): | |
39 | """ |
|
39 | """ | |
40 | Slot documentation goes here. |
|
40 | Slot documentation goes here. | |
41 | """ |
|
41 | """ | |
42 | filename = QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly) |
|
42 | filename = QtGui.QFileDialog.getExistingDirectory(self, 'Open Directory', './', QtGui.QFileDialog.ShowDirsOnly) | |
43 | self.txtRpath.setText(filename) |
|
43 | self.txtRpath.setText(filename) | |
44 |
|
44 | |||
45 | # TODO: not implemented yet |
|
45 | # TODO: not implemented yet | |
46 | # raise NotImplementedError |
|
46 | # raise NotImplementedError | |
47 |
|
47 | |||
48 | @pyqtSignature("") |
|
48 | @pyqtSignature("") | |
49 | def on_txtDpath_editingFinished(self): |
|
49 | def on_txtDpath_editingFinished(self): | |
50 | """ |
|
50 | """ | |
51 | Slot documentation goes here. |
|
51 | Slot documentation goes here. | |
52 | """ |
|
52 | """ | |
|
53 | ||||
|
54 | ||||
53 | var_Dpath=self.txtDpath.text() |
|
55 | var_Dpath=self.txtDpath.text() | |
54 | p1= Popen(['find', var_Dpath, '-name', '*.r'], stdout=PIPE) |
|
56 | p1= Popen(['find', var_Dpath, '-name', '*.r'], stdout=PIPE) | |
55 | p2= Popen(['awk', '-F/', '{print substr($NF,2,7)}'], stdin=p1.stdout, stdout=PIPE) |
|
57 | p2= Popen(['awk', '-F/', '{print substr($NF,2,7)}'], stdin=p1.stdout, stdout=PIPE) | |
56 | output_p2= p2.communicate()[0] |
|
58 | output_p2= p2.communicate()[0] | |
57 | #self.txtInfo.setText(output_p2) |
|
59 | #self.txtInfo.setText(output_p2) | |
58 |
|
60 | |||
59 | var_list=[] |
|
61 | var_list=[] | |
60 | for i in range(0, len(output_p2)/8): |
|
62 | for i in range(0, len(output_p2)/8): | |
61 | var_list.append(output_p2[8*i:8*(i+1)-1]) |
|
63 | var_list.append(output_p2[8*i:8*(i+1)-1]) | |
62 |
|
64 | |||
|
65 | self.lstStartDay.clear() | |||
|
66 | ||||
63 | for i in var_list: |
|
67 | for i in var_list: | |
64 | # self.txtInfo.append(i) |
|
68 | # self.txtInfo.append(i) | |
65 | self.lstStartDay.addItem(i) |
|
69 | self.lstStartDay.addItem(i) |
General Comments 0
You need to be logged in to leave comments.
Login now