feat(core): 语音功能上线
This commit is contained in:
@@ -48,7 +48,7 @@ from PySide6.QtGui import QTextCursor
|
||||
from typing import List, Dict
|
||||
|
||||
|
||||
from app.core import Config, TaskManager, Task, MainInfoBar
|
||||
from app.core import Config, TaskManager, Task, MainInfoBar, SoundPlayer
|
||||
from .Widget import StatefulItemCard, ComboBoxMessageBox, PivotArea
|
||||
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ from pathlib import Path
|
||||
from typing import Union, List, Dict
|
||||
|
||||
|
||||
from app.core import Config
|
||||
from app.core import Config, SoundPlayer
|
||||
from .Widget import StatefulItemCard, QuantifiedItemCard, QuickExpandGroupCard
|
||||
|
||||
|
||||
@@ -83,6 +83,8 @@ class History(QWidget):
|
||||
def reload_history(self, mode: str, start_date: QDate, end_date: QDate) -> None:
|
||||
"""加载历史记录界面"""
|
||||
|
||||
SoundPlayer.play("历史记录查询")
|
||||
|
||||
while self.content_layout.count() > 0:
|
||||
item = self.content_layout.takeAt(0)
|
||||
if item.spacerItem():
|
||||
|
||||
@@ -45,7 +45,7 @@ from datetime import datetime, timedelta
|
||||
import shutil
|
||||
import darkdetect
|
||||
|
||||
from app.core import Config, TaskManager, MainTimer, MainInfoBar
|
||||
from app.core import Config, TaskManager, MainTimer, MainInfoBar, SoundPlayer
|
||||
from app.services import Notify, Crypto, System
|
||||
from .home import Home
|
||||
from .member_manager import MemberManager
|
||||
@@ -285,6 +285,7 @@ class AUTO_MAA(MSFluentWindow):
|
||||
and not self.window().isMaximized()
|
||||
):
|
||||
self.titleBar.maxBtn.click()
|
||||
SoundPlayer.play("欢迎回来")
|
||||
self.show_ui("配置托盘")
|
||||
elif if_start:
|
||||
if Config.get(Config.ui_maximized) and not self.window().isMaximized():
|
||||
@@ -378,6 +379,8 @@ class AUTO_MAA(MSFluentWindow):
|
||||
|
||||
self.titleBar.minBtn.click()
|
||||
|
||||
SoundPlayer.play("MAA在完成任务前退出")
|
||||
|
||||
def clean_old_logs(self):
|
||||
"""
|
||||
删除超过用户设定天数的日志文件(基于目录日期)
|
||||
|
||||
@@ -58,7 +58,15 @@ from typing import List
|
||||
import shutil
|
||||
import json
|
||||
|
||||
from app.core import Config, MainInfoBar, TaskManager, MaaConfig, MaaUserConfig, Network
|
||||
from app.core import (
|
||||
Config,
|
||||
MainInfoBar,
|
||||
TaskManager,
|
||||
MaaConfig,
|
||||
MaaUserConfig,
|
||||
Network,
|
||||
SoundPlayer,
|
||||
)
|
||||
from app.services import Crypto
|
||||
from .downloader import DownloadManager
|
||||
from .Widget import (
|
||||
@@ -181,6 +189,7 @@ class MemberManager(QWidget):
|
||||
MainInfoBar.push_info_bar(
|
||||
"success", "操作成功", f"添加脚本实例 脚本_{index}", 3000
|
||||
)
|
||||
SoundPlayer.play("添加脚本实例")
|
||||
|
||||
def del_setting_box(self):
|
||||
"""删除一个脚本实例"""
|
||||
@@ -221,6 +230,7 @@ class MemberManager(QWidget):
|
||||
MainInfoBar.push_info_bar(
|
||||
"success", "操作成功", f"删除脚本实例 {name}", 3000
|
||||
)
|
||||
SoundPlayer.play("删除脚本实例")
|
||||
|
||||
def left_setting_box(self):
|
||||
"""向左移动脚本实例"""
|
||||
@@ -885,6 +895,7 @@ class MemberManager(QWidget):
|
||||
MainInfoBar.push_info_bar(
|
||||
"success", "操作成功", f"{self.name} 添加 用户_{index}", 3000
|
||||
)
|
||||
SoundPlayer.play("添加用户")
|
||||
|
||||
def del_user(self):
|
||||
"""删除一个用户"""
|
||||
@@ -944,6 +955,7 @@ class MemberManager(QWidget):
|
||||
MainInfoBar.push_info_bar(
|
||||
"success", "操作成功", f"{self.name} 删除 {name}", 3000
|
||||
)
|
||||
SoundPlayer.play("删除用户")
|
||||
|
||||
def left_user(self):
|
||||
"""向前移动用户"""
|
||||
|
||||
@@ -43,7 +43,7 @@ from qfluentwidgets import (
|
||||
from typing import List, Dict, Union
|
||||
import shutil
|
||||
|
||||
from app.core import Config, MainInfoBar, MaaPlanConfig
|
||||
from app.core import Config, MainInfoBar, MaaPlanConfig, SoundPlayer
|
||||
from .Widget import (
|
||||
ComboBoxMessageBox,
|
||||
LineEditSettingCard,
|
||||
@@ -129,6 +129,7 @@ class PlanManager(QWidget):
|
||||
MainInfoBar.push_info_bar(
|
||||
"success", "操作成功", f"添加计划表 计划_{index}", 3000
|
||||
)
|
||||
SoundPlayer.play("添加计划表")
|
||||
|
||||
def del_setting_box(self):
|
||||
"""删除一个计划表"""
|
||||
@@ -167,6 +168,7 @@ class PlanManager(QWidget):
|
||||
|
||||
logger.success(f"计划表 {name} 删除成功")
|
||||
MainInfoBar.push_info_bar("success", "操作成功", f"删除计划表 {name}", 3000)
|
||||
SoundPlayer.play("删除计划表")
|
||||
|
||||
def left_setting_box(self):
|
||||
"""向左移动计划表"""
|
||||
|
||||
@@ -42,7 +42,7 @@ from qfluentwidgets import (
|
||||
)
|
||||
from typing import List
|
||||
|
||||
from app.core import QueueConfig, Config, MainInfoBar
|
||||
from app.core import QueueConfig, Config, MainInfoBar, SoundPlayer
|
||||
from .Widget import (
|
||||
SwitchSettingCard,
|
||||
ComboBoxSettingCard,
|
||||
@@ -116,6 +116,7 @@ class QueueManager(QWidget):
|
||||
|
||||
logger.success(f"调度队列_{index} 添加成功")
|
||||
MainInfoBar.push_info_bar("success", "操作成功", f"添加 调度队列_{index}", 3000)
|
||||
SoundPlayer.play("添加调度队列")
|
||||
|
||||
def del_setting_box(self):
|
||||
"""删除一个调度队列实例"""
|
||||
@@ -154,6 +155,7 @@ class QueueManager(QWidget):
|
||||
|
||||
logger.success(f"{name} 删除成功")
|
||||
MainInfoBar.push_info_bar("success", "操作成功", f"删除 {name}", 3000)
|
||||
SoundPlayer.play("删除调度队列")
|
||||
|
||||
def left_setting_box(self):
|
||||
"""向左移动调度队列实例"""
|
||||
|
||||
@@ -49,7 +49,7 @@ from packaging import version
|
||||
from pathlib import Path
|
||||
from typing import Dict, Union
|
||||
|
||||
from app.core import Config, MainInfoBar, Network
|
||||
from app.core import Config, MainInfoBar, Network, SoundPlayer
|
||||
from app.services import Crypto, System, Notify
|
||||
from .downloader import DownloadManager
|
||||
from .Widget import (
|
||||
@@ -71,6 +71,7 @@ class Setting(QWidget):
|
||||
self.setObjectName("设置")
|
||||
|
||||
self.function = FunctionSettingCard(self)
|
||||
self.voice = VoiceSettingCard(self)
|
||||
self.start = StartSettingCard(self)
|
||||
self.ui = UiSettingCard(self)
|
||||
self.notification = NotifySettingCard(self)
|
||||
@@ -94,6 +95,7 @@ class Setting(QWidget):
|
||||
content_layout = QVBoxLayout(content_widget)
|
||||
content_layout.setContentsMargins(0, 0, 11, 0)
|
||||
content_layout.addWidget(self.function)
|
||||
content_layout.addWidget(self.voice)
|
||||
content_layout.addWidget(self.start)
|
||||
content_layout.addWidget(self.ui)
|
||||
content_layout.addWidget(self.notification)
|
||||
@@ -376,6 +378,7 @@ class Setting(QWidget):
|
||||
all_version_info[key] = value.copy()
|
||||
|
||||
# 询问是否开始版本更新
|
||||
SoundPlayer.play("有新版本")
|
||||
choice = NoticeMessageBox(
|
||||
self.window(),
|
||||
"版本更新",
|
||||
@@ -461,8 +464,10 @@ class Setting(QWidget):
|
||||
3600000,
|
||||
if_force=True,
|
||||
)
|
||||
SoundPlayer.play("有新版本")
|
||||
else:
|
||||
MainInfoBar.push_info_bar("success", "更新检查", "已是最新版本~", 3000)
|
||||
SoundPlayer.play("无新版本")
|
||||
|
||||
def start_setup(self) -> None:
|
||||
subprocess.Popen(
|
||||
@@ -530,6 +535,7 @@ class Setting(QWidget):
|
||||
choice = NoticeMessageBox(self.window(), "公告", notice["notice_dict"])
|
||||
choice.button_cancel.hide()
|
||||
choice.button_layout.insertStretch(0, 1)
|
||||
SoundPlayer.play("公告展示")
|
||||
if choice.exec():
|
||||
with (Config.app_path / "resources/notice.json").open(
|
||||
mode="w", encoding="utf-8"
|
||||
@@ -545,6 +551,7 @@ class Setting(QWidget):
|
||||
MainInfoBar.push_info_bar(
|
||||
"info", "有新公告", "请前往设置界面查看公告", 3600000, if_force=True
|
||||
)
|
||||
SoundPlayer.play("公告通知")
|
||||
return None
|
||||
|
||||
|
||||
@@ -653,6 +660,36 @@ class FunctionSettingCard(HeaderCardWidget):
|
||||
self.addGroupWidget(widget)
|
||||
|
||||
|
||||
class VoiceSettingCard(HeaderCardWidget):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
self.setTitle("音效")
|
||||
|
||||
self.card_Enabled = SwitchSettingCard(
|
||||
icon=FluentIcon.PAGE_RIGHT,
|
||||
title="音效开关",
|
||||
content="是否启用音效",
|
||||
qconfig=Config,
|
||||
configItem=Config.voice_Enabled,
|
||||
parent=self,
|
||||
)
|
||||
self.card_Type = ComboBoxSettingCard(
|
||||
icon=FluentIcon.PAGE_RIGHT,
|
||||
title="音效模式",
|
||||
content="选择音效的播放模式",
|
||||
texts=["简洁", "聒噪"],
|
||||
qconfig=Config,
|
||||
configItem=Config.voice_Type,
|
||||
parent=self,
|
||||
)
|
||||
|
||||
Layout = QVBoxLayout()
|
||||
Layout.addWidget(self.card_Enabled)
|
||||
Layout.addWidget(self.card_Type)
|
||||
self.viewLayout.addLayout(Layout)
|
||||
|
||||
|
||||
class StartSettingCard(HeaderCardWidget):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
|
||||
Reference in New Issue
Block a user