-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainwindow.py
68 lines (51 loc) · 2.08 KB
/
mainwindow.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Main UI window for electronic nose
from PyQt5 import QtCore, QtGui, QtWidgets
import sys,csv
from mainwindow_gui import Ui_MainWindow
import analysis, measurement
from PyQt5.QtWidgets import QFileDialog
class ElectronicNose(QtWidgets.QMainWindow, Ui_MainWindow):
def __init__(self,parent = None):
super(ElectronicNose,self).__init__(parent)
MainWindow = QtWidgets.QMainWindow()
self.setupUi(self)
self.menu = QtWidgets.QMenu(self.pushButton_measurement)
open = QtWidgets.QAction("Open", self.menu)
self.menu.addAction(open)
new = QtWidgets.QAction("New", self.menu)
self.menu.addAction(new)
open.triggered.connect(self.open)
new.triggered.connect(self.new)
self.pushButton_measurement.clicked.connect(self.measurement)
self.pushButton_analysis.clicked.connect(self.analysis)
def measurement(self):
print("Measurement Clicked")
#print('leftClicked', QPos)
parentPosition = self.pushButton_measurement.mapToGlobal(QtCore.QPoint(0,0))
#menuPosition = parentPosition + QPos
self.menu.move(parentPosition)
self.menu.show()
def open(self):
filename = QFileDialog.getOpenFileName(self,'Open','', "CSV Files (*.csv)")
if filename== ('',''):
print("Cancel")
else:
with open(filename[0], newline='') as csvfile:
reader = csv.reader(csvfile)
data = list(reader)
repetitions = data[0][1]
sampleTime = data[1][1]
purgeTime = data[2][1]
#print(repetitions,sampleTime,purgeTime)
def new(self):
measure = measurement.Measurement(self)
measure.show()
def analysis(self):
analyse = analysis.Analysis(self)
analyse.showMaximized()
if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = ElectronicNose()
ui.showMaximized()
sys.exit(app.exec_())