feat(ui): 软件主页初步完成

This commit is contained in:
DLmaster
2025-02-21 18:35:55 +08:00
parent c19068128f
commit f5461deb81
5 changed files with 53 additions and 9 deletions

View File

@@ -30,10 +30,11 @@ from PySide6.QtWidgets import (
QFrame,
QVBoxLayout,
)
from qfluentwidgets import TitleLabel
from qframelesswindow.webengine import FramelessWebEngineView
from PySide6.QtCore import QUrl
from app.core import Config
class Home(QFrame):
@@ -41,12 +42,26 @@ class Home(QFrame):
super().__init__(parent=parent)
self.setObjectName("主界面")
# self.webView = FramelessWebEngineView(self)
# self.webView.load(QUrl("https://github.com/DLmaster361/AUTO_MAA"))
self.Lable = TitleLabel(" 正在施工中~")
self.webView = FramelessWebEngineView(self)
self.vBoxLayout = QVBoxLayout(self)
self.vBoxLayout.setContentsMargins(0, 0, 0, 0)
# self.vBoxLayout.addWidget(self.webView)
self.vBoxLayout.addWidget(self.Lable)
self.vBoxLayout.addStretch(1)
self.vBoxLayout.addWidget(self.webView)
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
)

View File

@@ -125,6 +125,9 @@ class AUTO_MAA(MSFluentWindow):
FluentIcon.SETTING,
NavigationItemPosition.BOTTOM,
)
self.stackedWidget.currentChanged.connect(
lambda index: (self.home.refresh() if index == 0 else None)
)
self.stackedWidget.currentChanged.connect(
lambda index: (self.member_manager.refresh() if index == 1 else None)
)

View File

@@ -414,6 +414,18 @@ class FunctionSettingCard(HeaderCardWidget):
super().__init__(parent)
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(
configItem=Config.global_config.function_HistoryRetentionTime,
icon=FluentIcon.PAGE_RIGHT,
@@ -436,6 +448,7 @@ class FunctionSettingCard(HeaderCardWidget):
)
Layout = QVBoxLayout()
Layout.addWidget(self.card_HomePage)
Layout.addWidget(self.card_HistoryRetentionTime)
Layout.addWidget(self.card_IfAllowSleep)
Layout.addWidget(self.card_IfSilence)