From 0489f4c47deb15014766b1bda5682949d229778b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B3=A0=E8=89=B2?= <3838404213@qq.com> Date: Mon, 6 Jul 2026 17:41:44 +0800 Subject: [PATCH] feat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加了可以在ui选择运行后退出软件,而不是只能用命令行来选择运行后退出软件 --- app/main_window.py | 6 ++---- app/setting_interface.py | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/main_window.py b/app/main_window.py index 691451a53..d42d4f820 100644 --- a/app/main_window.py +++ b/app/main_window.py @@ -611,14 +611,12 @@ def _rebuild_interfaces_for_language(self): QApplication.restoreOverrideCursor() def _onTaskFinished(self, exit_code): - """处理任务完成信号""" - # 如果是启动任务且设置了完成后退出,则在任务成功完成时退出程序 if self.exit_on_complete and self.startup_task and exit_code == 0: from PySide6.QtCore import QTimer - # 延迟一小段时间让用户看到完成状态 QTimer.singleShot(5000, self.quitApp) + elif cfg.after_finish == "ExitApp" and exit_code == 0: + QTimer.singleShot(0, self.quitApp) else: - # 任务失败或未指定退出时,清除自动退出标记 self.exit_on_complete = False def quitApp(self): diff --git a/app/setting_interface.py b/app/setting_interface.py index a7a750fad..569b1173f 100644 --- a/app/setting_interface.py +++ b/app/setting_interface.py @@ -1037,7 +1037,7 @@ def __initCard(self): FIF.POWER_BUTTON, tr('任务完成后'), tr('“退出”指退出游戏,不再建议使用循环模式,请改用日志界面的定时运行功能'), - texts={tr('无'): 'None', tr('退出'): 'Exit', tr('关机'): 'Shutdown', tr('睡眠'): 'Sleep', tr('休眠'): 'Hibernate', tr('重启'): 'Restart', tr('注销'): 'Logoff', tr('关闭显示器'): 'TurnOffDisplay', tr('运行脚本'): 'RunScript', tr('循环'): 'Loop'} + texts={tr('无'): 'None', tr('退出'): 'Exit', tr('关闭软件'): 'ExitApp', tr('关机'): 'Shutdown', tr('睡眠'): 'Sleep', tr('休眠'): 'Hibernate', tr('重启'): 'Restart', tr('注销'): 'Logoff', tr('关闭显示器'): 'TurnOffDisplay', tr('运行脚本'): 'RunScript', tr('循环'): 'Loop'} ) self.loopModeCard = ComboBoxSettingCard2( "loop_mode",