-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
57 lines (46 loc) · 1.86 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
import sys
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QApplication
from user import User
from Views.signView.signView import signView
from server import Server
from Views.loginView.loginView import loginView
# ---- ПОДКЛЮЧЕНИЕ СЕРВЕРА ----
server = Server()
server.connectDB()
# ---- ПОДКЛЮЧЕНИЕ ИНТЕРФЕЙСА ----
app = QApplication(sys.argv)
widget = QtWidgets.QStackedWidget()
widget.setFixedWidth(1280)
widget.setFixedHeight(720)
widget.setWindowTitle('Автоматизированная библиотечная информационная система')
# ---- ПОЛЬЗОВАТЕЛЬСКАЯ РОЛЬ ----
miUser = User()
# -- Словарь с окнами --
loginWindow = loginView()
signWindow = signView()
WIDGET_DICT = {
'login screen': loginWindow, # 0
'sign screen': signWindow # 1
}
widget.addWidget(WIDGET_DICT['login screen'])
loginWindow.setWidget(widget)
loginWindow.setUser(miUser)
loginWindow.setServer(server)
widget.addWidget(WIDGET_DICT['sign screen'])
signWindow.setWidget(widget)
signWindow.setUser(miUser)
signWindow.setServer(server)
# -- Инициализация экрана входа --
try:
temp = server.selectVersion()
loginWindow.setVersion(str(server.selectVersion()))
signWindow.setVersion(str(server.selectVersion()))
except Exception as e:
loginWindow.setVersion('unversioned')
widget.show()
# ---- ОТКЛЮЧЕНИЕ СЕРВЕРА И ПРИЛОЖЕНИЯ ----
def closeSys():
app.exec()
server.close()
sys.exit(closeSys())