Merge v1.4.1 from dev #2

Merged
serversdown merged 12 commits from dev into main 2026-03-17 14:31:51 -04:00
Showing only changes of commit 814b6f915e - Show all commits

View File

@@ -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),