Initial Commit.
This commit is contained in:
36
run.py
Normal file
36
run.py
Normal file
@ -0,0 +1,36 @@
|
||||
from logging import getLogger, NOTSET, FileHandler, Formatter, StreamHandler, info
|
||||
from pathlib import Path
|
||||
from sys import argv
|
||||
from time import strftime, localtime, time
|
||||
|
||||
from PySide6.QtCore import Qt
|
||||
from PySide6.QtWidgets import QApplication
|
||||
|
||||
from func.Module_mainwindow import MainWindow
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# 设置日志
|
||||
logger = getLogger()
|
||||
logger.setLevel(NOTSET)
|
||||
realtime = strftime('%Y%m%d', localtime(time()))
|
||||
if not Path("logs").exists():
|
||||
Path("logs").mkdir(exist_ok=True)
|
||||
fh = FileHandler(Path("logs") / (realtime + ".log"), mode='a')
|
||||
fh.setLevel(NOTSET)
|
||||
fh.setFormatter(Formatter("%(asctime)s: %(message)s"))
|
||||
logger.addHandler(fh)
|
||||
|
||||
ch = StreamHandler()
|
||||
ch.setLevel(NOTSET)
|
||||
ch.setFormatter(Formatter("%(asctime)s: %(message)s"))
|
||||
logger.addHandler(ch)
|
||||
getLogger('matplotlib.font_manager').disabled = True
|
||||
info("程序启动")
|
||||
|
||||
app = QApplication(argv)
|
||||
app.setHighDpiScaleFactorRoundingPolicy(Qt.HighDpiScaleFactorRoundingPolicy.PassThrough)
|
||||
app.styleHints().setColorScheme(Qt.ColorScheme.Light) # 强制使用浅色模式
|
||||
mainWindow = MainWindow()
|
||||
mainWindow.show()
|
||||
exit(app.exec())
|
||||
Reference in New Issue
Block a user