-
Notifications
You must be signed in to change notification settings - Fork 10
/
Controller.py
49 lines (38 loc) · 1.13 KB
/
Controller.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
import sys
from PyQt5 import QtWidgets, QtGui
from gui.Login_Panel import Ui_LoginPanel
from gui.Main_Window import Ui_MainWindow
class Controller:
"""
Switching between frames.
"""
def __init__(self):
self.lp = Ui_LoginPanel()
self.LoginPanel = QtWidgets.QMainWindow()
self.MainWin = QtWidgets.QMainWindow()
self.mw = Ui_MainWindow(self.MainWin, self.lp.firebase, self.lp.auth)
def show_login(self):
"""
Show login frame
:return:
"""
self.lp.setupUi(self.LoginPanel)
self.lp.switch_window.connect(self.show_main)
self.LoginPanel.show()
def show_main(self):
"""
Show main window
:return:
"""
self.mw.setupUi(self.MainWin, self.lp.user, self.lp.login)
self.LoginPanel.close()
self.MainWin.show()
def main():
# results = db.child("users").push(data)
app = QtWidgets.QApplication(sys.argv)
app.setWindowIcon(QtGui.QIcon('features/icon.png'))
controller = Controller()
controller.show_login()
sys.exit(app.exec_())
if __name__ == '__main__':
main()