feat(ui): 自定义基建显示配置名称

This commit is contained in:
DLmaster361
2025-05-09 19:54:07 +08:00
parent fbfdc6aa12
commit 5893aa2426
5 changed files with 37 additions and 4 deletions

View File

@@ -622,7 +622,7 @@ class MaaUserConfig(QConfig):
class AppConfig(GlobalConfig):
VERSION = "4.3.7.0"
VERSION = "4.3.8.1"
gameid_refreshed = Signal()
PASSWORD_refreshed = Signal()

View File

@@ -55,6 +55,7 @@ from functools import partial
from pathlib import Path
from typing import List
import shutil
import json
from app.core import Config, MainInfoBar, TaskManager, MaaConfig, MaaUserConfig, Network
from app.services import Crypto
@@ -1398,7 +1399,7 @@ class MemberManager(QWidget):
self.card_InfrastMode = PushAndComboBoxSettingCard(
icon=FluentIcon.CAFE,
title="基建模式",
content="配置文件仅在自定义基建中生效",
content="自定义基建配置文件未生效",
text="选择配置文件",
texts=[
"常规模式",
@@ -1549,6 +1550,9 @@ class MemberManager(QWidget):
self.card_Mode.comboBox.currentIndexChanged.connect(
self.switch_mode
)
self.card_InfrastMode.comboBox.currentIndexChanged.connect(
self.switch_infrastructure
)
self.card_Annihilation.clicked.connect(
lambda: self.set_maa("Annihilation")
)
@@ -1562,6 +1566,7 @@ class MemberManager(QWidget):
Config.PASSWORD_refreshed.connect(self.refresh_password)
self.switch_mode()
self.switch_infrastructure()
def switch_mode(self) -> None:
@@ -1579,6 +1584,27 @@ class MemberManager(QWidget):
self.card_Annihilation.button.setVisible(True)
self.card_Routine.setVisible(True)
def switch_infrastructure(self) -> None:
if (
self.config.get(self.config.Info_InfrastMode)
== "Custom"
):
self.card_InfrastMode.button.setVisible(True)
with (
self.user_path
/ "Infrastructure/infrastructure.json"
).open(mode="r", encoding="utf-8") as f:
infrastructure = json.load(f)
self.card_InfrastMode.setContent(
f"当前基建配置:{infrastructure.get("title","未命名")}"
)
else:
self.card_InfrastMode.button.setVisible(False)
self.card_InfrastMode.setContent(
"自定义基建配置文件未生效"
)
def refresh_gameid(self):
self.card_GameId.reLoadOptions(
@@ -1634,6 +1660,7 @@ class MemberManager(QWidget):
self.user_path
/ "Infrastructure/infrastructure.json",
)
self.switch_infrastructure()
else:
logger.warning("未选择自定义基建文件")
MainInfoBar.push_info_bar(

View File

@@ -120,7 +120,7 @@ if __name__ == "__main__":
shutil.make_archive(
base_name=root_path / f"AUTO_MAA_{version_text(main_version_numb)}",
format="zip",
root_dir=root_path / "AUTO_MAA",
root_dir=root_path / "AUTO_MAA_Setup",
base_dir=".",
)

View File

@@ -43,6 +43,7 @@ def main():
window = AUTO_MAA()
window.show_ui("显示主窗口")
window.show_ui("配置托盘")
window.start_up_task()
sys.exit(application.exec())

View File

@@ -1,7 +1,12 @@
{
"main_version": "4.3.7.0",
"main_version": "4.3.8.1",
"updater_version": "1.0.0.0",
"version_info": {
"4.3.8.1": {
"新增功能": [
"自定义基建显示配置名称"
]
},
"4.3.7.0": {
"新增功能": [
"下载器支持完整mirrorc列表"