fix auto start monitoring
This commit is contained in:
+9
-1
@@ -16,7 +16,7 @@ from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
|
||||
APP_NAME = "Watchdog GUI"
|
||||
APP_VERSION = "1.1.0"
|
||||
APP_VERSION = "1.1.2"
|
||||
|
||||
BASE_DIR = Path(__file__).resolve().parent
|
||||
CONFIG_PATH = BASE_DIR / "watchdog_config.json"
|
||||
@@ -255,6 +255,7 @@ class WatchdogWindow(QtWidgets.QMainWindow):
|
||||
self.setMinimumSize(520, 270)
|
||||
|
||||
self.cfg = load_config()
|
||||
self._is_loading_config = False
|
||||
self.monitoring = False
|
||||
self.last_restart_time = 0.0
|
||||
self._really_quit = False
|
||||
@@ -431,6 +432,8 @@ class WatchdogWindow(QtWidgets.QMainWindow):
|
||||
LOGGER.addHandler(self.ui_log_handler)
|
||||
|
||||
def _load_config_to_ui(self):
|
||||
self._is_loading_config = True
|
||||
try:
|
||||
self.edit_exe_path.setText(self.cfg.get("target_exe_path", ""))
|
||||
self.spin_interval.setValue(int(self.cfg.get("check_interval_sec", 5)))
|
||||
self.spin_cooldown.setValue(int(self.cfg.get("restart_cooldown_sec", 10)))
|
||||
@@ -446,8 +449,13 @@ class WatchdogWindow(QtWidgets.QMainWindow):
|
||||
self.resize(600, 540)
|
||||
else:
|
||||
self.resize(560, 300)
|
||||
finally:
|
||||
self._is_loading_config = False
|
||||
|
||||
def save_ui_to_config(self):
|
||||
if getattr(self, "_is_loading_config", False):
|
||||
return
|
||||
|
||||
self.cfg["target_exe_path"] = self.edit_exe_path.text().strip()
|
||||
self.cfg["check_interval_sec"] = int(self.spin_interval.value())
|
||||
self.cfg["restart_cooldown_sec"] = int(self.spin_cooldown.value())
|
||||
|
||||
Reference in New Issue
Block a user