0.0.1 Initial check-in. /JL
This commit is contained in:
42
main.py
42
main.py
@@ -0,0 +1,42 @@
|
||||
# coding:utf-8
|
||||
import os
|
||||
import sys
|
||||
|
||||
from PyQt6.QtCore import Qt, QTranslator
|
||||
from PyQt6.QtGui import QFont
|
||||
from PyQt6.QtWidgets import QApplication
|
||||
from qfluentwidgets import FluentTranslator
|
||||
|
||||
from app.common.config import cfg
|
||||
from app.view.main_window import MainWindow
|
||||
|
||||
|
||||
# enable dpi scale
|
||||
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)
|
||||
|
||||
# create application
|
||||
app = QApplication(sys.argv)
|
||||
app.setAttribute(Qt.AA_DontCreateNativeWidgetSiblings)
|
||||
|
||||
# internationalization
|
||||
locale = cfg.get(cfg.language).value
|
||||
translator = FluentTranslator(locale)
|
||||
galleryTranslator = QTranslator()
|
||||
galleryTranslator.load(locale, "gallery", ".", ":/gallery/i18n")
|
||||
|
||||
app.installTranslator(translator)
|
||||
app.installTranslator(galleryTranslator)
|
||||
|
||||
# create main window
|
||||
w = MainWindow()
|
||||
w.show()
|
||||
|
||||
app.exec_()
|
||||
Reference in New Issue
Block a user