diff --git a/main.py b/main.py index 49bc0f7..576caf2 100644 --- a/main.py +++ b/main.py @@ -25,6 +25,46 @@ v4.4 作者:DLmaster_361 """ + +# Nuitka环境检测和修复 +def setup_nuitka_compatibility(): + """设置Nuitka打包环境的兼容性""" + + # 检测打包环境 + is_nuitka = ( + hasattr(sys, "frozen") + or "nuitka" in sys.modules + or "Temp\\AUTO_MAA" in str(sys.executable) + or os.path.basename(sys.executable) == "AUTO_MAA.exe" + ) + + if is_nuitka: + + # 修复PySide6 QTimer问题 + try: + from PySide6.QtCore import QTimer + + original_singleShot = QTimer.singleShot + + @staticmethod + def safe_singleShot(*args, **kwargs): + if len(args) >= 2: + msec = args[0] + callback = args[-1] + # 确保使用正确的调用签名 + return original_singleShot(msec, callback) + return original_singleShot(*args, **kwargs) + + QTimer.singleShot = safe_singleShot + + except Exception as e: + + pass + + +# 立即应用兼容性修复 +setup_nuitka_compatibility() + # 屏蔽广告 import builtins diff --git a/requirements.txt b/requirements.txt index ab2ff4b..1983e16 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ loguru==0.7.3 plyer==2.1.0 PySide6==6.9.1 -PySide6-Fluent-Widgets[full] +PySide6-Fluent-Widgets[full]==1.8.3 psutil==7.0.0 pywin32==310 keyboard==0.13.5 diff --git a/resources/version.json b/resources/version.json index 2fb0af9..60ba22e 100644 --- a/resources/version.json +++ b/resources/version.json @@ -3,7 +3,8 @@ "version_info": { "4.4.1.2": { "修复BUG": [ - "日志读取添加兜底机制" + "日志读取添加兜底机制", + "修复 QTimer.singleShot 参数问题" ] }, "4.4.1.1": {