-
Notifications
You must be signed in to change notification settings - Fork 1
/
mainwindow.py
76 lines (64 loc) · 2.53 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
69
70
71
72
73
74
75
76
from PyQt6.QtWidgets import QApplication, QWidget, QGridLayout, QFrame, QPushButton, QLabel, QSpacerItem, QSizePolicy, QVBoxLayout
from PyQt6.QtCore import QMargins, Qt
from PyQt6.QtGui import QFont, QMouseEvent
from menu_frame import Menu
from camera_frame import CameraFrame
from dashboard_frame import DashboardFrame
from login_frame import LoginFrame
class mainwindow(QWidget):
"""
This is the main window of the application.
All functions reside within this class.
"""
def __init__(self):
super(mainwindow, self).__init__()
self.lastSize = self.size()
self.initUI()
self.createLayout()
self.addPages()
self.dashboardActive()
self.connectButtons()
self.show()
def initUI(self):
self.setGeometry(300, 100, 1500, 800)
def createLayout(self):
self.mainwindow_layout = QGridLayout()
self.mainwindow_layout.setSpacing(0)
self.mainwindow_layout.setContentsMargins(QMargins(0, 0, 0, 0))
self.setLayout(self.mainwindow_layout)
def addPages(self):
self.menu = Menu(self)
self.camera_window = CameraFrame()
self.login_window = LoginFrame(self)
self.dashboard_window = DashboardFrame(self)
self.mainwindow_layout.addWidget(self.menu, 0, 0)
self.mainwindow_layout.addWidget(self.camera_window, 0, 1)
self.mainwindow_layout.addWidget(self.dashboard_window, 0, 1)
self.mainwindow_layout.addWidget(self.login_window, 0, 1)
def connectButtons(self):
self.menu.button_dashboard.clicked.connect(self.dashboardActive)
self.menu.button_camera.clicked.connect(self.cameraActive)
self.menu.button_logout.clicked.connect(self.loginActive)
def loginActive(self):
self.login_window.show()
self.menu.button_dashboard.contentActive(False)
self.menu.button_camera.contentActive(False)
self.dashboard_window.hide()
self.menu.hide()
self.camera_window.hide()
def dashboardActive(self):
self.menu.button_dashboard.contentActive(True)
self.menu.button_camera.contentActive(False)
self.dashboard_window.show()
self.camera_window.hide()
self.login_window.hide()
def cameraActive(self):
self.menu.button_dashboard.contentActive(False)
self.menu.button_camera.contentActive(True)
self.dashboard_window.hide()
self.camera_window.show()
if __name__ == '__main__':
app = QApplication([])
mw = mainwindow()
mw.move
app.exec()