From 1367daf1b7e92aa2f8677420cc4dea9f6e291e2e Mon Sep 17 00:00:00 2001 From: DLmaster Date: Fri, 21 Feb 2025 15:54:28 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat(ui):=20=E6=B7=BB=E5=8A=A0=E8=BD=AF?= =?UTF-8?q?=E4=BB=B6=E4=B8=B4=E6=97=B6=E4=B8=BB=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/ui/history.py | 5 +--- app/ui/home.py | 52 ++++++++++++++++++++++++++++++++++++++++ app/ui/main_window.py | 25 +++++++++++++------ app/ui/member_manager.py | 5 +--- app/ui/queue_manager.py | 5 +--- app/ui/setting.py | 5 +--- main.py | 1 + resources/version.json | 4 ++-- 8 files changed, 77 insertions(+), 25 deletions(-) create mode 100644 app/ui/home.py diff --git a/app/ui/history.py b/app/ui/history.py index f4d7bf3..6ed57b3 100644 --- a/app/ui/history.py +++ b/app/ui/history.py @@ -52,10 +52,7 @@ from .Widget import StatefulItemCard, QuantifiedItemCard class History(QWidget): - def __init__( - self, - parent=None, - ): + def __init__(self, parent=None): super().__init__(parent) self.setObjectName("历史记录") diff --git a/app/ui/home.py b/app/ui/home.py new file mode 100644 index 0000000..7e17c8a --- /dev/null +++ b/app/ui/home.py @@ -0,0 +1,52 @@ +# +# Copyright © <2024> + +# This file is part of AUTO_MAA. + +# AUTO_MAA is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published +# by the Free Software Foundation, either version 3 of the License, +# or (at your option) any later version. + +# AUTO_MAA is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty +# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See +# the GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with AUTO_MAA. If not, see . + +# DLmaster_361@163.com + +""" +AUTO_MAA +AUTO_MAA主界面 +v4.2 +作者:DLmaster_361 +""" + +from loguru import logger +from PySide6.QtWidgets import ( + QFrame, + QVBoxLayout, +) +from qfluentwidgets import TitleLabel +from qframelesswindow.webengine import FramelessWebEngineView +from PySide6.QtCore import QUrl + + +class Home(QFrame): + + def __init__(self, parent=None): + super().__init__(parent=parent) + self.setObjectName("主界面") + + # self.webView = FramelessWebEngineView(self) + # self.webView.load(QUrl("https://github.com/DLmaster361/AUTO_MAA")) + self.Lable = TitleLabel(" 正在施工中~") + + 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) diff --git a/app/ui/main_window.py b/app/ui/main_window.py index a367f43..080176b 100644 --- a/app/ui/main_window.py +++ b/app/ui/main_window.py @@ -51,11 +51,12 @@ import shutil from app.core import Config, TaskManager, MainTimer, MainInfoBar from app.services import Notify, Crypto, System -from .setting import Setting +from .home import Home from .member_manager import MemberManager from .queue_manager import QueueManager from .dispatch_center import DispatchCenter from .history import History +from .setting import Setting class AUTO_MAA(MSFluentWindow): @@ -75,18 +76,19 @@ class AUTO_MAA(MSFluentWindow): System.main_window = self.window() # 创建主窗口 - self.setting = Setting(self) + self.home = Home(self) self.member_manager = MemberManager(self) self.queue_manager = QueueManager(self) self.dispatch_center = DispatchCenter(self) self.history = History(self) + self.setting = Setting(self) self.addSubInterface( - self.setting, - FluentIcon.SETTING, - "设置", - FluentIcon.SETTING, - NavigationItemPosition.BOTTOM, + self.home, + FluentIcon.HOME, + "主页", + FluentIcon.HOME, + NavigationItemPosition.TOP, ) self.addSubInterface( self.member_manager, @@ -116,6 +118,13 @@ class AUTO_MAA(MSFluentWindow): FluentIcon.HISTORY, NavigationItemPosition.BOTTOM, ) + self.addSubInterface( + self.setting, + FluentIcon.SETTING, + "设置", + FluentIcon.SETTING, + NavigationItemPosition.BOTTOM, + ) self.stackedWidget.currentChanged.connect( lambda index: (self.member_manager.refresh() if index == 1 else None) ) @@ -347,6 +356,8 @@ class AUTO_MAA(MSFluentWindow): ) self.window().setGeometry(location[0], location[1], size[0], size[1]) self.window().show() + self.window().raise_() + self.window().activateWindow() if not if_quick: if Config.global_config.get(Config.global_config.ui_maximized): self.window().showMaximized() diff --git a/app/ui/member_manager.py b/app/ui/member_manager.py index a3eab6c..09e8dd1 100644 --- a/app/ui/member_manager.py +++ b/app/ui/member_manager.py @@ -72,10 +72,7 @@ from .Widget import ( class MemberManager(QWidget): - def __init__( - self, - parent=None, - ): + def __init__(self, parent=None): super().__init__(parent) self.setObjectName("脚本管理") diff --git a/app/ui/queue_manager.py b/app/ui/queue_manager.py index 4004220..4e82a93 100644 --- a/app/ui/queue_manager.py +++ b/app/ui/queue_manager.py @@ -60,10 +60,7 @@ from .Widget import ( class QueueManager(QWidget): - def __init__( - self, - parent=None, - ): + def __init__(self, parent=None): super().__init__(parent) self.setObjectName("调度队列") diff --git a/app/ui/setting.py b/app/ui/setting.py index dc8eb4f..c0341b7 100644 --- a/app/ui/setting.py +++ b/app/ui/setting.py @@ -58,10 +58,7 @@ from .Widget import LineEditMessageBox, LineEditSettingCard, PasswordLineEditSet class Setting(QWidget): - def __init__( - self, - parent=None, - ): + def __init__(self, parent=None): super().__init__(parent) self.setObjectName("设置") diff --git a/main.py b/main.py index ddc8e64..badf293 100644 --- a/main.py +++ b/main.py @@ -45,6 +45,7 @@ def main(): window = AUTO_MAA() window.show_ui("显示主窗口") + window.setMicaEffectEnabled(True) window.start_up_task() sys.exit(application.exec()) diff --git a/resources/version.json b/resources/version.json index 167e750..87830a1 100644 --- a/resources/version.json +++ b/resources/version.json @@ -1,7 +1,7 @@ { - "main_version": "4.2.4.2", + "main_version": "4.2.4.3", "updater_version": "1.1.2.0", - "announcement": "\n## 新增功能\n- 历史记录统计功能上线\n## 修复BUG\n- 更新器修正`channel`\n## 程序优化\n- 添加MAA监测字段:`未检测到任何模拟器`\n- 取消MAA运行中自动更新", + "announcement": "\n## 新增功能\n- 历史记录统计功能上线\n- 添加软件主页\n## 修复BUG\n- 更新器修正`channel`\n## 程序优化\n- 添加MAA监测字段:`未检测到任何模拟器`\n- 取消MAA运行中自动更新", "proxy_list": [ "", "https://gitproxy.click/", From c19068128f8e635ec55cf6d6863ec9e35217dcb5 Mon Sep 17 00:00:00 2001 From: DLmaster Date: Fri, 21 Feb 2025 16:15:55 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat(core):=20=E6=B7=BB=E5=8A=A0=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E6=97=B6=E7=9B=B4=E6=8E=A5=E6=9C=80=E5=B0=8F=E5=8C=96?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- app/core/config.py | 3 +++ app/ui/main_window.py | 5 +++++ app/ui/setting.py | 7 +++++++ resources/version.json | 2 +- 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 77f4a99..b5a372f 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ MAA多账号管理与自动化软件 ![Alt](https://repobeats.axiom.co/api/embed/6c2f834141eff1ac297db70d12bd11c6236a58a5.svg "Repobeats analytics image") -感谢 @ClozyA 为本项目提供的下载服务器 +感谢 [AoXuan (@ClozyA)](https://github.com/ClozyA) 为本项目提供的下载服务器 ## Star History diff --git a/app/core/config.py b/app/core/config.py index 6da3346..39b40d8 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -759,6 +759,9 @@ class GlobalConfig(QConfig): start_IfSelfStart = ConfigItem("Start", "IfSelfStart", False, BoolValidator()) start_IfRunDirectly = ConfigItem("Start", "IfRunDirectly", False, BoolValidator()) + start_IfMinimizeDirectly = ConfigItem( + "Start", "IfMinimizeDirectly", False, BoolValidator() + ) ui_IfShowTray = ConfigItem("UI", "IfShowTray", False, BoolValidator()) ui_IfToTray = ConfigItem("UI", "IfToTray", False, BoolValidator()) diff --git a/app/ui/main_window.py b/app/ui/main_window.py index 080176b..d7d1265 100644 --- a/app/ui/main_window.py +++ b/app/ui/main_window.py @@ -255,6 +255,11 @@ class AUTO_MAA(MSFluentWindow): self.start_main_task() + # 直接最小化 + if Config.global_config.get(Config.global_config.start_IfMinimizeDirectly): + + self.titleBar.minBtn.click() + def set_min_method(self) -> None: """设置最小化方法""" diff --git a/app/ui/setting.py b/app/ui/setting.py index c0341b7..c90a62f 100644 --- a/app/ui/setting.py +++ b/app/ui/setting.py @@ -493,10 +493,17 @@ class StartSettingCard(HeaderCardWidget): content="启动AUTO_MAA后自动运行自动代理任务,优先级:调度队列 1 > 脚本 1", configItem=Config.global_config.start_IfRunDirectly, ) + self.card_IfMinimizeDirectly = SwitchSettingCard( + icon=FluentIcon.PAGE_RIGHT, + title="启动后直接最小化", + content="启动AUTO_MAA后直接最小化", + configItem=Config.global_config.start_IfMinimizeDirectly, + ) Layout = QVBoxLayout() Layout.addWidget(self.card_IfSelfStart) Layout.addWidget(self.card_IfRunDirectly) + Layout.addWidget(self.card_IfMinimizeDirectly) self.viewLayout.addLayout(Layout) diff --git a/resources/version.json b/resources/version.json index 87830a1..fbd18f4 100644 --- a/resources/version.json +++ b/resources/version.json @@ -1,7 +1,7 @@ { "main_version": "4.2.4.3", "updater_version": "1.1.2.0", - "announcement": "\n## 新增功能\n- 历史记录统计功能上线\n- 添加软件主页\n## 修复BUG\n- 更新器修正`channel`\n## 程序优化\n- 添加MAA监测字段:`未检测到任何模拟器`\n- 取消MAA运行中自动更新", + "announcement": "\n## 新增功能\n- 历史记录统计功能上线\n- 添加软件主页\n- 添加启动时直接最小化功能\n## 修复BUG\n- 更新器修正`channel`\n## 程序优化\n- 添加MAA监测字段:`未检测到任何模拟器`\n- 取消MAA运行中自动更新", "proxy_list": [ "", "https://gitproxy.click/", From f5461deb81dd6f13736bd66e8fdc8cdb5051fd71 Mon Sep 17 00:00:00 2001 From: DLmaster Date: Fri, 21 Feb 2025 18:35:55 +0800 Subject: [PATCH 3/3] =?UTF-8?q?feat(ui):=20=E8=BD=AF=E4=BB=B6=E4=B8=BB?= =?UTF-8?q?=E9=A1=B5=E5=88=9D=E6=AD=A5=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/core/config.py | 15 ++++++++++++++- app/ui/home.py | 29 ++++++++++++++++++++++------- app/ui/main_window.py | 3 +++ app/ui/setting.py | 13 +++++++++++++ main.py | 2 +- 5 files changed, 53 insertions(+), 9 deletions(-) diff --git a/app/core/config.py b/app/core/config.py index 39b40d8..5107495 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -745,8 +745,21 @@ class AppConfig: 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", 7, OptionsValidator([7, 15, 30, 60, 0]) + "Function", "HistoryRetentionTime", 0, OptionsValidator([7, 15, 30, 60, 0]) ) function_IfAllowSleep = ConfigItem( "Function", "IfAllowSleep", False, BoolValidator() diff --git a/app/ui/home.py b/app/ui/home.py index 7e17c8a..779a045 100644 --- a/app/ui/home.py +++ b/app/ui/home.py @@ -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 + ) diff --git a/app/ui/main_window.py b/app/ui/main_window.py index d7d1265..aee7f7f 100644 --- a/app/ui/main_window.py +++ b/app/ui/main_window.py @@ -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) ) diff --git a/app/ui/setting.py b/app/ui/setting.py index c90a62f..bea1e81 100644 --- a/app/ui/setting.py +++ b/app/ui/setting.py @@ -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) diff --git a/main.py b/main.py index badf293..fc4638c 100644 --- a/main.py +++ b/main.py @@ -32,7 +32,7 @@ from qfluentwidgets import FluentTranslator import sys -# @logger.catch +@logger.catch def main(): application = QApplication(sys.argv)