# This Python file uses the following encoding: utf-8 # @author runhey # github https://github.com/runhey import sys import os from PySide6.QtGui import QGuiApplication, QIcon from PySide6.QtQml import QQmlApplicationEngine from PySide6.QtCore import Qt, QObject, QStandardPaths, QCoreApplication from pathlib import Path from module.gui.utils import get_work_path from module.gui.Bridge import bridge # import module.gui.qml_rcc import module.gui.res_rcc class FluentApp(): app = None engine = None def __init__(self): super().__init__() # 适配高分辨率、声明、设置Logo、设置软件名字 # QGuiApplication.setHighDpiScaleFactorRoundingPolicy(Qt.HighDpiScaleFactorRoundingPolicy.Round) QGuiApplication.setAttribute(Qt.AA_EnableHighDpiScaling) QGuiApplication.setAttribute(Qt.AA_UseHighDpiPixmaps) QGuiApplication.setAttribute(Qt.AA_ShareOpenGLContexts) os.putenv("QT_QUICK_CONTROLS_STYLE", "Basic") FluentApp.app = QGuiApplication(sys.argv) QGuiApplication.setWindowIcon(QIcon(os.fspath(Path(__file__).resolve().parent / "res/icon.ico"))) QGuiApplication.setApplicationName("oas") QGuiApplication.setOrganizationName("oas") def run(self): FluentApp.engine = QQmlApplicationEngine() FluentApp.engine.addImportPath(os.fspath(Path(__file__).resolve().parent )) FluentApp.engine.load(os.fspath(Path(get_work_path() / 'module' / 'gui' / 'qml' / 'app.qml'))) if not FluentApp.engine.rootObjects(): sys.exit(-1) sys.exit(FluentApp.app.exec())