forked from firefly-cpp/NiaAML-GUI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
61 lines (49 loc) · 2.1 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import sys
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import qApp, QMainWindow, QMessageBox, QAction
from PyQt5.QtCore import QSize
from niaaml_gui.widgets import OptimizationWidget, UsePipelineWidget
class WriteStream(object):
def __init__(self,queue):
self.queue = queue
def write(self, text):
self.queue.append(text)
class MainAppWindow(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
self.setMinimumSize(QSize(1024, 768))
self.setWindowTitle('NiaAML - GUI')
menuBar = self.menuBar()
menuBar.setNativeMenuBar(False)
fileMenu = menuBar.addMenu('&File')
exitAction = QAction(text='Exit', parent=self)
exitAction.triggered.connect(qApp.quit)
newPipelineAction = QAction(text='New Pipeline', parent=self)
newPipelineAction.triggered.connect(self.__setOptimizationView)
newPipelineActionV1 = QAction(text='New Pipeline V1', parent=self)
newPipelineActionV1.triggered.connect(self.__setOptimizationV1View)
useExistingPipelineAction = QAction(text='Use Existing Pipeline', parent=self)
useExistingPipelineAction.triggered.connect(self.__setUsePipelineView)
fileMenu.addAction(newPipelineAction)
fileMenu.addAction(newPipelineActionV1)
fileMenu.addAction(useExistingPipelineAction)
fileMenu.addAction(exitAction)
self.setCentralWidget(OptimizationWidget(self))
self.errorMessage = QMessageBox()
self.errorMessage.setIcon(QMessageBox.Critical)
self.errorMessage.setWindowTitle('Error')
self.errorMessage.setStandardButtons(QMessageBox.Ok)
def __setOptimizationView(self):
self.setCentralWidget(OptimizationWidget(self))
def __setOptimizationV1View(self):
self.setCentralWidget(OptimizationWidget(self, True))
def __setUsePipelineView(self):
self.setCentralWidget(UsePipelineWidget(self))
def run():
app = QtWidgets.QApplication(sys.argv)
app.setStyle('Fusion')
mainWin = MainAppWindow()
mainWin.show()
sys.exit(app.exec_())
if __name__ == '__main__':
run()