add config and change logo
This commit is contained in:
@@ -1,30 +1,39 @@
|
||||
from PySide6.QtWidgets import QApplication
|
||||
from PySide6.QtCore import Qt, QThread, QModelIndex
|
||||
from PySide6.QtGui import QIcon
|
||||
from qfluentwidgets import MSFluentWindow, setTheme, Theme, InfoBar, FluentIcon as Fi, InfoBarPosition
|
||||
|
||||
from qfluentwidgets import (
|
||||
MSFluentWindow, setTheme, InfoBar, FluentIcon as Fi, InfoBarPosition,
|
||||
NavigationItemPosition, setThemeColor
|
||||
)
|
||||
from common.utils import show_quick_tip, accept_warning
|
||||
from common.api_worker import ApiWorker
|
||||
from components.ext_dialog import ExtensionDialog
|
||||
from components.main_interface import MainInterface
|
||||
from components.settings_interface import SettingsInterface
|
||||
from common.config import cfg
|
||||
|
||||
|
||||
class MainWindow(MSFluentWindow):
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, title: str, width: int, height: int):
|
||||
super().__init__()
|
||||
self.setWindowTitle("插件安全标记")
|
||||
self.setWindowTitle(title)
|
||||
self.setWindowIcon(QIcon(":/logo.png"))
|
||||
# self.navigationInterface.hide()
|
||||
self.resize(1000, 760)
|
||||
self.resize(width, height)
|
||||
desktop = QApplication.screens()[0].availableGeometry()
|
||||
w, h = desktop.width(), desktop.height()
|
||||
self.move(w // 2 - self.width() // 2, h // 2 - self.height() // 2)
|
||||
setTheme(Theme.LIGHT)
|
||||
setTheme(cfg.theme)
|
||||
setThemeColor(cfg.get(cfg.themeColor))
|
||||
|
||||
# --- UI ---
|
||||
self.main_interface = MainInterface(parent=self)
|
||||
self.settings_interface = SettingsInterface(name="settings", parent=self)
|
||||
self.addSubInterface(self.main_interface, Fi.HOME, "主页", Fi.HOME_FILL)
|
||||
self.addSubInterface(self.settings_interface, Fi.SETTING, "设置",
|
||||
position=NavigationItemPosition.BOTTOM)
|
||||
|
||||
self.stackedWidget.setAnimationEnabled(cfg.get(cfg.switch_animation))
|
||||
|
||||
# --- 初始化后台工作线程和 QObject ---
|
||||
self.thread = QThread()
|
||||
|
||||
Reference in New Issue
Block a user