-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.py
61 lines (49 loc) · 1.99 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 os
import sys
from functools import partial
from PySide2.QtWidgets import QApplication, QMainWindow, QStackedWidget
from model import InUse, LogIn, SignUp
class MainWindow(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
self.setWindowTitle("음취헌 Piano Manager")
self.setFixedSize(800, 480)
page_in_use = InUse()
page_log_in = LogIn()
page_sign_up = SignUp()
self.widget = QStackedWidget()
self.widget.addWidget(page_log_in) # index 0
self.widget.addWidget(page_in_use) # index 1
self.widget.addWidget(page_sign_up) # index 2
self.setCentralWidget(self.widget)
page_in_use.ui.button_quit.clicked.connect(partial(self.switch_page, 0))
page_log_in.ui.button_register.clicked.connect(partial(self.switch_page, 2))
page_log_in.ui.dialog_true.button_yes.clicked.connect(
partial(self.switch_page, 1)
)
page_sign_up.widget(4).ui.dialog_true.button_ok.clicked.connect(
partial(self.switch_page, 0)
)
for i in range(5):
page_sign_up.widget(i).ui.button_home.clicked.connect(
partial(self.switch_page, 0)
)
def switch_page(self, idx):
if idx == 1:
self.widget.widget(1).set_page(self.widget.widget(0).get_contact())
self.widget.currentWidget().clear_page()
self.widget.setCurrentIndex(idx)
else:
self.widget.currentWidget().clear_page()
self.widget.setCurrentIndex(idx)
self.widget.currentWidget().set_page()
if __name__ == "__main__":
app = QApplication()
window = MainWindow()
screen_rect = app.screens()[0].geometry()
if os.name == "posix" and (screen_rect.width(), screen_rect.height()) == (800, 600):
# TODO: Make Raspberry Pi options as config
os.environ["QT_IM_MODULE"] = "qtvirtualkeyboard"
window.showFullScreen()
window.show()
sys.exit(app.exec_())