-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathapp.py
More file actions
41 lines (30 loc) · 1.03 KB
/
app.py
File metadata and controls
41 lines (30 loc) · 1.03 KB
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
import sys
import os
from PyQt5.QtWidgets import QApplication
from loguru import logger
from utils import global_var as gl, logs
from utils.connect_mysql import db
from win.login_form import login_form
from win.splash.splash import SplashScreen
os.chdir(os.path.dirname(__file__))
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
class App(QApplication):
def __init__(self):
super().__init__(sys.argv)
self.windows = {}
def run(self, pytest=False):
logger.info("程序启动 ...")
splash = SplashScreen() # 启动界面
splash.loadProgress() # 启动界面
from win.main_win import main_win
self.windows["main"] = main_win()
self.windows["login"] = login_form(self.windows["main"])
self.windows["login"].show()
splash.finish(self.windows["main"]) # 启动界面
if not pytest:
sys.exit(self.exec_())
if __name__ == "__main__":
logs.setting() # log 设置
gl.__init() # 全局变量
db.connect()
App().run()