forked from Zzaphkiel/Seraphine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
39 lines (29 loc) · 1.15 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
# coding:utf-8
import sys
import os
from app.common.qfluentwidgets import FluentTranslator
from PyQt5.QtWidgets import QApplication
from PyQt5.QtCore import Qt, QTranslator
os.chdir(os.path.dirname(os.path.abspath(__file__)))
from app.common.config import cfg
from app.view.main_window import MainWindow
if __name__ == '__main__':
if cfg.get(cfg.dpiScale) == "Auto":
QApplication.setHighDpiScaleFactorRoundingPolicy(
Qt.HighDpiScaleFactorRoundingPolicy.PassThrough)
QApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
else:
os.environ["QT_ENABLE_HIGHDPI_SCALING"] = "0"
os.environ["QT_SCALE_FACTOR"] = str(cfg.get(cfg.dpiScale))
QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps)
app = QApplication(sys.argv)
app.setAttribute(Qt.AA_DontCreateNativeWidgetSiblings)
locale = cfg.get(cfg.language).value
translator = FluentTranslator(locale)
lolHelperTranslator = QTranslator()
lolHelperTranslator.load(locale, "Seraphine", ".", "./app/resource/i18n")
app.installTranslator(translator)
app.installTranslator(lolHelperTranslator)
w = MainWindow()
w.show()
app.exec_()