From 814b6f915eab5f16dfe6ea7438ace73b13073bd9 Mon Sep 17 00:00:00 2001 From: serversdwn Date: Tue, 17 Mar 2026 13:36:35 -0400 Subject: [PATCH] fix: settings dialog now runs in its own thread, increasing responsiveness. --- series3_tray.py | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/series3_tray.py b/series3_tray.py index d60261d..748125f 100644 --- a/series3_tray.py +++ b/series3_tray.py @@ -246,15 +246,13 @@ class WatcherTray: # --- Menu item callbacks --- def _open_settings(self, icon, item): - """Open the settings dialog. On save, restart watcher thread.""" - from settings_dialog import show_dialog - saved = show_dialog(CONFIG_PATH, wizard=False) - if saved: - self._restart_watcher() - # Rebuild menu so status label refreshes - if self._icon is not None: - with self._menu_lock: - self._icon.menu = self._build_menu() + """Open the settings dialog in its own thread so the tray stays responsive.""" + def _run(): + from settings_dialog import show_dialog + saved = show_dialog(CONFIG_PATH, wizard=False) + if saved: + self._restart_watcher() + threading.Thread(target=_run, daemon=True, name="settings-dialog").start() def _open_logs(self, icon, item): log_dir = self.state.get("log_dir") @@ -312,17 +310,12 @@ class WatcherTray: return pystray.Menu(*items) def _build_menu(self): - # Capture current text/submenu at build time; pystray will call - # callables each render, but static strings are fine for infrequent - # menu rebuilds. We use callables for the dynamic items so that the - # text shown on hover/open is current. - status_text = self._status_text() - units_submenu = self._build_units_submenu() - + # Use a callable for the status item so pystray re-evaluates it + # every time the menu is opened — keeps it in sync with the tooltip. return pystray.Menu( - pystray.MenuItem(status_text, None, enabled=False), + pystray.MenuItem(lambda item: self._status_text(), None, enabled=False), pystray.Menu.SEPARATOR, - pystray.MenuItem("Units", units_submenu), + pystray.MenuItem("Units", lambda item: self._build_units_submenu()), pystray.Menu.SEPARATOR, pystray.MenuItem("Settings...", self._open_settings), pystray.MenuItem("Open Log Folder", self._open_logs),