diff --git a/.github/workflows/build-app.yml b/.github/workflows/build-app.yml index b2213cf..8bacf40 100644 --- a/.github/workflows/build-app.yml +++ b/.github/workflows/build-app.yml @@ -81,7 +81,6 @@ jobs: script-name: main.py mode: app enable-plugins: pyside6 - nofollow-import-to: pyscreeze onefile-tempdir-spec: "{TEMP}/AUTO_MAA" windows-console-mode: attach windows-icon-from-ico: resources/icons/AUTO_MAA.ico diff --git a/app/core/config.py b/app/core/config.py index 436a4c0..f0b386a 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -576,7 +576,7 @@ class MaaPlanConfig(LQConfig): class AppConfig(GlobalConfig): - VERSION = "4.3.10.2" + VERSION = "4.3.10.3" gameid_refreshed = Signal() PASSWORD_refreshed = Signal() diff --git a/app/core/timer.py b/app/core/timer.py index 43c0da3..daa164b 100644 --- a/app/core/timer.py +++ b/app/core/timer.py @@ -29,7 +29,7 @@ from loguru import logger from PySide6.QtCore import QObject, QTimer from datetime import datetime from pathlib import Path -import pyautogui +import keyboard from .config import Config from .task_manager import TaskManager @@ -41,8 +41,6 @@ class _MainTimer(QObject): def __init__(self, parent=None): super().__init__(parent) - self.if_FailSafeException = False - self.Timer = QTimer() self.Timer.timeout.connect(self.timed_start) self.Timer.timeout.connect(self.set_silence) @@ -113,16 +111,14 @@ class _MainTimer(QObject): for emulator_path in Config.silence_list ): try: - pyautogui.hotkey( - *[ + keyboard.press_and_release( + "+".join( _.strip().lower() for _ in Config.get(Config.function_BossKey).split("+") - ] + ) ) - except pyautogui.FailSafeException as e: - if not self.if_FailSafeException: - logger.warning(f"FailSafeException: {e}") - self.if_FailSafeException = True + except Exception as e: + logger.error(f"模拟按键时出错:{e}") def check_power(self): diff --git a/app/models/MAA.py b/app/models/MAA.py index a85ec8a..b29fca1 100644 --- a/app/models/MAA.py +++ b/app/models/MAA.py @@ -982,6 +982,7 @@ class MaaManager(QObject): connect_result = subprocess.run( [self.ADB_path, "connect", ADB_address], creationflags=subprocess.CREATE_NO_WINDOW, + stdin=subprocess.DEVNULL, capture_output=True, text=True, encoding="utf-8", @@ -993,6 +994,7 @@ class MaaManager(QObject): devices_result = subprocess.run( [self.ADB_path, "devices"], creationflags=subprocess.CREATE_NO_WINDOW, + stdin=subprocess.DEVNULL, capture_output=True, text=True, encoding="utf-8", diff --git a/app/utils/package.py b/app/utils/package.py index decc71b..bb9a7d4 100644 --- a/app/utils/package.py +++ b/app/utils/package.py @@ -72,12 +72,11 @@ if __name__ == "__main__": os.system( "powershell -Command python -m nuitka --standalone --onefile --mingw64" " --enable-plugins=pyside6 --windows-console-mode=attach" - " --nofollow-import-to=pyscreeze" " --onefile-tempdir-spec='{TEMP}\\AUTO_MAA'" " --windows-icon-from-ico=resources\\icons\\AUTO_MAA.ico" " --company-name='AUTO_MAA Team' --product-name=AUTO_MAA" - f" --file-version={version["main_version"]}" - f" --product-version={version["main_version"]}" + f" --file-version={version['main_version']}" + f" --product-version={version['main_version']}" " --file-description='AUTO_MAA Component'" " --copyright='Copyright © 2024-2025 DLmaster361'" " --assume-yes-for-downloads --output-filename=AUTO_MAA" diff --git a/main.py b/main.py index 8c208a3..641122e 100644 --- a/main.py +++ b/main.py @@ -28,6 +28,8 @@ v4.3 # 屏蔽广告 import builtins +original_print = builtins.print + def no_print(*args, **kwargs): if ( @@ -36,7 +38,7 @@ def no_print(*args, **kwargs): and "QFluentWidgets Pro is now released." in args[0] ): return - return __builtins__.print(*args, **kwargs) + return original_print(*args, **kwargs) builtins.print = no_print diff --git a/requirements.txt b/requirements.txt index cbfbc08..e32d6b5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,7 @@ PySide6 PySide6-Fluent-Widgets[full] psutil pywin32 -pyautogui +keyboard pycryptodome requests markdown diff --git a/resources/version.json b/resources/version.json index ebc14eb..fff5c59 100644 --- a/resources/version.json +++ b/resources/version.json @@ -1,6 +1,11 @@ { - "main_version": "4.3.10.2", + "main_version": "4.3.10.3", "version_info": { + "4.3.10.3": { + "程序优化": [ + "使用 keyboard 模块替代 pyautogui 模块" + ] + }, "4.3.10.2": { "新增功能": [ "公招喜报模板优化",