-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
46 lines (40 loc) · 1.6 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/python
import sys, os
from PyQt4 import QtCore, QtGui
from ui_Detector import Ui_Form
from detector import Detector
class DetectorUI(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_Form()
self.ui.setupUi(self)
QtCore.QObject.connect(self.ui.startButton,QtCore.SIGNAL("clicked()"), self.start)
QtCore.QObject.connect(self.ui.pathButton,QtCore.SIGNAL("clicked()"), self.set_source_file_path)
QtCore.QObject.connect(self.ui.patternCheckBox,QtCore.SIGNAL("clicked()"), self.patternClicked)
self.detector = Detector()
def start(self):
if self.detector.isRunning():
self.setWindowTitle('Stopped')
self.detector.stop()
self.ui.startButton.setText("Start")
else:
self.setWindowTitle('Running')
self.detector.start()
self.ui.startButton.setText("Stop")
def set_source_file_path(self):
dir = os.path.dirname(".")
fileName = QtGui.QFileDialog.getOpenFileName (self, "Open data file", dir , "Image Files (*.txt)")
#Todo set the txt file as the data source
self.ui.pathEdit.setText(fileName)
def patternClicked(self):
if self.ui.patternCheckBox.isChecked() :
#output data pattern
print "patern enabeled"
else:
#output data source
print "patern disable"
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
myapp = DetectorUI()
myapp.show()
sys.exit(app.exec_())