feat(ui): 软件主页初步完成
This commit is contained in:
@@ -745,8 +745,21 @@ class AppConfig:
|
|||||||
class GlobalConfig(QConfig):
|
class GlobalConfig(QConfig):
|
||||||
"""全局配置"""
|
"""全局配置"""
|
||||||
|
|
||||||
|
function_HomePage = OptionsConfigItem(
|
||||||
|
"Function",
|
||||||
|
"HomePage",
|
||||||
|
"https://ak.hypergryph.com/#information",
|
||||||
|
OptionsValidator(
|
||||||
|
[
|
||||||
|
"https://ak.hypergryph.com/#information",
|
||||||
|
"https://ak-webview.hypergryph.com/gameBulletin",
|
||||||
|
"https://ak.hypergryph.com/user/home",
|
||||||
|
"https://prts.wiki/w/%E9%A6%96%E9%A1%B5",
|
||||||
|
]
|
||||||
|
),
|
||||||
|
)
|
||||||
function_HistoryRetentionTime = OptionsConfigItem(
|
function_HistoryRetentionTime = OptionsConfigItem(
|
||||||
"Function", "HistoryRetentionTime", 7, OptionsValidator([7, 15, 30, 60, 0])
|
"Function", "HistoryRetentionTime", 0, OptionsValidator([7, 15, 30, 60, 0])
|
||||||
)
|
)
|
||||||
function_IfAllowSleep = ConfigItem(
|
function_IfAllowSleep = ConfigItem(
|
||||||
"Function", "IfAllowSleep", False, BoolValidator()
|
"Function", "IfAllowSleep", False, BoolValidator()
|
||||||
|
|||||||
@@ -30,10 +30,11 @@ from PySide6.QtWidgets import (
|
|||||||
QFrame,
|
QFrame,
|
||||||
QVBoxLayout,
|
QVBoxLayout,
|
||||||
)
|
)
|
||||||
from qfluentwidgets import TitleLabel
|
|
||||||
from qframelesswindow.webengine import FramelessWebEngineView
|
from qframelesswindow.webengine import FramelessWebEngineView
|
||||||
from PySide6.QtCore import QUrl
|
from PySide6.QtCore import QUrl
|
||||||
|
|
||||||
|
from app.core import Config
|
||||||
|
|
||||||
|
|
||||||
class Home(QFrame):
|
class Home(QFrame):
|
||||||
|
|
||||||
@@ -41,12 +42,26 @@ class Home(QFrame):
|
|||||||
super().__init__(parent=parent)
|
super().__init__(parent=parent)
|
||||||
self.setObjectName("主界面")
|
self.setObjectName("主界面")
|
||||||
|
|
||||||
# self.webView = FramelessWebEngineView(self)
|
self.webView = FramelessWebEngineView(self)
|
||||||
# self.webView.load(QUrl("https://github.com/DLmaster361/AUTO_MAA"))
|
|
||||||
self.Lable = TitleLabel(" 正在施工中~")
|
|
||||||
|
|
||||||
self.vBoxLayout = QVBoxLayout(self)
|
self.vBoxLayout = QVBoxLayout(self)
|
||||||
self.vBoxLayout.setContentsMargins(0, 0, 0, 0)
|
self.vBoxLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
# self.vBoxLayout.addWidget(self.webView)
|
self.vBoxLayout.addWidget(self.webView)
|
||||||
self.vBoxLayout.addWidget(self.Lable)
|
|
||||||
self.vBoxLayout.addStretch(1)
|
self.current_url = None
|
||||||
|
|
||||||
|
self.refresh()
|
||||||
|
|
||||||
|
def refresh(self):
|
||||||
|
|
||||||
|
if (
|
||||||
|
Config.global_config.get(Config.global_config.function_HomePage)
|
||||||
|
!= self.current_url
|
||||||
|
):
|
||||||
|
|
||||||
|
self.webView.load(
|
||||||
|
QUrl(Config.global_config.get(Config.global_config.function_HomePage))
|
||||||
|
)
|
||||||
|
self.current_url = Config.global_config.get(
|
||||||
|
Config.global_config.function_HomePage
|
||||||
|
)
|
||||||
|
|||||||
@@ -125,6 +125,9 @@ class AUTO_MAA(MSFluentWindow):
|
|||||||
FluentIcon.SETTING,
|
FluentIcon.SETTING,
|
||||||
NavigationItemPosition.BOTTOM,
|
NavigationItemPosition.BOTTOM,
|
||||||
)
|
)
|
||||||
|
self.stackedWidget.currentChanged.connect(
|
||||||
|
lambda index: (self.home.refresh() if index == 0 else None)
|
||||||
|
)
|
||||||
self.stackedWidget.currentChanged.connect(
|
self.stackedWidget.currentChanged.connect(
|
||||||
lambda index: (self.member_manager.refresh() if index == 1 else None)
|
lambda index: (self.member_manager.refresh() if index == 1 else None)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -414,6 +414,18 @@ class FunctionSettingCard(HeaderCardWidget):
|
|||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
self.setTitle("功能")
|
self.setTitle("功能")
|
||||||
|
|
||||||
|
self.card_HomePage = ComboBoxSettingCard(
|
||||||
|
configItem=Config.global_config.function_HomePage,
|
||||||
|
icon=FluentIcon.PAGE_RIGHT,
|
||||||
|
title="主页内容",
|
||||||
|
content="选择AUTO_MAA主页展示的内容",
|
||||||
|
texts=[
|
||||||
|
"明日方舟官网情报",
|
||||||
|
"明日方舟游戏公告",
|
||||||
|
"明日方舟个人中心",
|
||||||
|
"PRTS百科网站首页",
|
||||||
|
],
|
||||||
|
)
|
||||||
self.card_HistoryRetentionTime = ComboBoxSettingCard(
|
self.card_HistoryRetentionTime = ComboBoxSettingCard(
|
||||||
configItem=Config.global_config.function_HistoryRetentionTime,
|
configItem=Config.global_config.function_HistoryRetentionTime,
|
||||||
icon=FluentIcon.PAGE_RIGHT,
|
icon=FluentIcon.PAGE_RIGHT,
|
||||||
@@ -436,6 +448,7 @@ class FunctionSettingCard(HeaderCardWidget):
|
|||||||
)
|
)
|
||||||
|
|
||||||
Layout = QVBoxLayout()
|
Layout = QVBoxLayout()
|
||||||
|
Layout.addWidget(self.card_HomePage)
|
||||||
Layout.addWidget(self.card_HistoryRetentionTime)
|
Layout.addWidget(self.card_HistoryRetentionTime)
|
||||||
Layout.addWidget(self.card_IfAllowSleep)
|
Layout.addWidget(self.card_IfAllowSleep)
|
||||||
Layout.addWidget(self.card_IfSilence)
|
Layout.addWidget(self.card_IfSilence)
|
||||||
|
|||||||
Reference in New Issue
Block a user