diff --git a/app/card/pushsettingcard1.py b/app/card/pushsettingcard1.py index 598e2c81..98b9c814 100644 --- a/app/card/pushsettingcard1.py +++ b/app/card/pushsettingcard1.py @@ -1,7 +1,7 @@ from PyQt5.QtCore import Qt, pyqtSignal from PyQt5.QtGui import QIcon, QKeyEvent from PyQt5.QtWidgets import QPushButton -from qfluentwidgets import SettingCard, FluentIconBase +from qfluentwidgets import SettingCard, FluentIconBase, InfoBar, InfoBarPosition from .messagebox_custom import MessageBoxEdit, MessageBoxEditMultiple, MessageBoxDate, MessageBoxInstance, MessageBoxNotifyTemplate, MessageBoxTeam, MessageBoxFriends from tasks.base.tasks import start_task from module.config import cfg @@ -39,6 +39,7 @@ def __onclicked(self): class PushSettingCardCode(PushSettingCard): def __init__(self, text, icon: Union[str, QIcon, FluentIconBase], title, configname, parent=None): self.configvalue = '\n'.join(cfg.get_value(configname)) + self.parent = parent super().__init__(text, icon, title, configname, "批量使用兑换码,每行一个,自动过滤空格等无效字符", parent) self.button.clicked.connect(self.__onclicked) @@ -52,6 +53,16 @@ def __onclicked(self): self.configvalue = '\n'.join(code) if code != []: start_task("redemption") + else: + InfoBar.warning( + self.tr('兑换码为空'), + self.tr(''), + orient=Qt.Horizontal, + isClosable=True, + position=InfoBarPosition.TOP, + duration=1000, + parent=self.parent + ) class PushSettingCardEval(PushSettingCard): diff --git a/app/tools_interface.py b/app/tools_interface.py index 4f4a820d..c531eaec 100644 --- a/app/tools_interface.py +++ b/app/tools_interface.py @@ -41,7 +41,8 @@ def __init__(self, parent=None): self.tr('执行'), FIF.SPEED_HIGH, self.tr("兑换码"), - "redemption_code" + "redemption_code", + self ) self.__initWidget() @@ -86,7 +87,7 @@ def __onUnlockfpsCardClicked(self): if fps == 120: set_game_fps(60) InfoBar.success( - title=self.tr('恢复60成功(^∀^●)'), + title=self.tr('恢复60成功 (^∀^●)'), content="", orient=Qt.Horizontal, isClosable=True, @@ -97,7 +98,7 @@ def __onUnlockfpsCardClicked(self): else: set_game_fps(120) InfoBar.success( - title=self.tr('解锁120成功(^∀^●)'), + title=self.tr('解锁120成功 (^∀^●)'), content="", orient=Qt.Horizontal, isClosable=True, @@ -107,12 +108,12 @@ def __onUnlockfpsCardClicked(self): ) except: InfoBar.warning( - title=self.tr('解锁失败(╥╯﹏╰╥)'), - content="", + title=self.tr('解锁失败'), + content="可尝试手动切换一次游戏帧率后重试", orient=Qt.Horizontal, isClosable=True, position=InfoBarPosition.TOP, - duration=1000, + duration=5000, parent=self ) diff --git a/assets/docs/Changelog.md b/assets/docs/Changelog.md index f665ef6b..bcf43772 100644 --- a/assets/docs/Changelog.md +++ b/assets/docs/Changelog.md @@ -12,6 +12,7 @@ ### 修复 - “日常任务” 会在每次启动时被错误清空 +- “自动对话” 状态不会变化和速度过慢 - 降低角色头像匹配阈值 [#356](https://github.com/moesnow/March7thAssistant/issues/356) ## v2.6.3 diff --git a/tasks/tool/autoplot.py b/tasks/tool/autoplot.py index 1cbc81a2..f6f0615f 100644 --- a/tasks/tool/autoplot.py +++ b/tasks/tool/autoplot.py @@ -50,6 +50,7 @@ def update_status_label(self, is_clicking): status_color = "green" if is_clicking else "red" if hasattr(self, 'status_label'): self.status_label.config(text=status_text, fg=status_color) + self.root.update() # 强制刷新界面 else: self.status_label = tk.Label(self.root, text=status_text, fg=status_color) self.status_label.pack() @@ -76,10 +77,10 @@ def check_game_status(self): if auto.find_element(img, "image", 0.9, take_screenshot=False): self.start_clicking() auto.click_element(self.select_img, "image", 0.9, crop=(1290.0 / 1920, 442.0 / 1080, 74.0 / 1920, 400.0 / 1080)) - break - self.stop_clicking() - else: - self.stop_clicking() + self.root.after(500, self.check_game_status) + return + + self.stop_clicking() # 每隔一段时间重新检查游戏状态 self.root.after(500, self.check_game_status) diff --git a/tasks/tool/screenshot.py b/tasks/tool/screenshot.py index 3e4b65c9..f2f06920 100644 --- a/tasks/tool/screenshot.py +++ b/tasks/tool/screenshot.py @@ -3,6 +3,7 @@ from tkinter import messagebox from PIL import ImageTk, Image import pyperclip +import pyautogui import os @@ -30,6 +31,21 @@ def setup_root(self, root, screenshot: Image.Image): self.root.geometry(f"{screenshot.width}x{screenshot.height+60}") self.screenshot = screenshot + self.screen_resolution = pyautogui.size() + screen_width, screen_height = self.screen_resolution + if screen_width <= 1920 and screen_height <= 1080: + # 最大化窗口 + self.root.state('zoomed') + # 设置窗口始终位于最前面 + self.root.attributes("-topmost", 1) + + # 通过延时恢复原始状态(不再保持在最前面) + self.root.after(100, self.remove_topmost) + + def remove_topmost(self): + # 取消保持最前面状态 + self.root.attributes("-topmost", 0) + def setup_canvas(self): """ 在根窗口中创建并配置画布用于显示截图。