1
1
mirror of https://github.com/KenanZhu/AutoLibrary.git synced 2026-06-17 23:13:03 +08:00

refactor(ALConfigWidget, ALTimerTaskManageWidget): 重构配置和定时器任务管理窗口的配置显式初始化

修改后配置文件的初始化将不再通过 QMessageBox 提示用户,界面将只在初始化失败时显示错误信息。
This commit is contained in:
2026-02-16 14:17:58 +08:00
parent 2496c4e367
commit b55a0c06a5
2 changed files with 2 additions and 19 deletions
+1 -7
View File
@@ -194,7 +194,7 @@ class ALConfigWidget(QWidget, Ui_ALConfigWidget):
which: str
) -> bool:
msg = ""
msg = "" # no use for now
is_success = True
if which == "run":
run_config_path = self.__config_paths[which]
@@ -222,12 +222,6 @@ class ALConfigWidget(QWidget, Ui_ALConfigWidget):
self.__config_data[which] = self.loadUserConfig(user_config_path)
if self.__config_data[which] is None:
is_success = False
if msg:
QMessageBox.information(
self,
"提示 - AutoLibrary",
f"配置文件初始化完成: \n{msg}"
)
return is_success
+1 -12
View File
@@ -190,11 +190,6 @@ class ALTimerTaskManageWidget(QWidget, Ui_ALTimerTaskManageWidget):
return True
timer_tasks = []
if self.saveTimerTasks(self.__timer_tasks_config_path, copy.deepcopy(timer_tasks)):
QMessageBox.information(
self,
"信息 - AutoLibrary",
f"定时任务配置文件初始化完成: \n{self.__timer_tasks_config_path}"
)
self.__timer_tasks = timer_tasks
self.updateTimerTaskList()
return True
@@ -217,13 +212,7 @@ class ALTimerTaskManageWidget(QWidget, Ui_ALTimerTaskManageWidget):
task["status"] = ALTimerTaskStatus(task["status"])
return timer_tasks["timer_tasks"]
raise Exception("定时任务配置文件格式错误")
except Exception as e:
QMessageBox.warning(
self,
"警告 - AutoLibrary",
f"加载定时任务配置发生错误 ! : {e}\n"\
f"文件路径: {timer_tasks_config_path}"
)
except Exception:
return None