-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
57 lines (42 loc) · 1.53 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
from enum import Enum
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow
from PyQt5.uic import loadUi
from methods.COCOMO import CocomoWindow
from methods.IFPUG import IfpugWindow
from methods.PERT import PertWindow
class ChildWindowType(Enum):
COCOMO = "COCOMO"
IFPUG = "IFPUG"
PERT = "PERT"
# To keep a reference to a child window.
child_window = None
class MainWindow(QMainWindow):
def __init__(self):
super(MainWindow, self).__init__()
loadUi("methods/main.ui", self)
self.COCOMO_button.clicked.connect(self.openCocomoWindow)
self.IFPUG_button.clicked.connect(self.openIfpugWindow)
self.PERT_button.clicked.connect(self.openPertWindow)
def openCocomoWindow(self):
self.openChildWindow(ChildWindowType.COCOMO)
def openIfpugWindow(self):
self.openChildWindow(ChildWindowType.IFPUG)
def openPertWindow(self):
self.openChildWindow(ChildWindowType.PERT)
def openChildWindow(self, child_window_type):
global child_window
if child_window_type == ChildWindowType.COCOMO:
child_window = CocomoWindow()
elif child_window_type == ChildWindowType.IFPUG:
child_window = IfpugWindow()
elif child_window_type == ChildWindowType.PERT:
child_window = PertWindow()
assert child_window is not None
child_window.show()
self.close()
if __name__ == "__main__":
app = QApplication(sys.argv)
appWindow = MainWindow()
appWindow.show()
sys.exit(app.exec())