feat: enhance settings dialog and update check logging #4

Merged
serversdown merged 2 commits from event-db into main 2026-06-01 17:30:49 -04:00
2 changed files with 22 additions and 10 deletions
Showing only changes of commit 4870f3ee87 - Show all commits
+14 -5
View File
@@ -487,12 +487,21 @@ class SettingsDialog:
def _build_tab_updates(self, nb): def _build_tab_updates(self, nb):
f = self._tab_frame(nb, "Updates") f = self._tab_frame(nb, "Updates")
tk.Label(f, text="Auto-Update Source", anchor="w").grid( # Current version display
tk.Label(f, text="Current Version", anchor="w").grid(
row=0, column=0, sticky="w", padx=(8, 4), pady=(8, 2) row=0, column=0, sticky="w", padx=(8, 4), pady=(8, 2)
) )
tk.Label(
f, text="v{}".format(watcher.VERSION), anchor="w",
font=("TkDefaultFont", 9, "bold"),
).grid(row=0, column=1, sticky="w", padx=(0, 8), pady=(8, 2))
tk.Label(f, text="Auto-Update Source", anchor="w").grid(
row=1, column=0, sticky="w", padx=(8, 4), pady=(8, 2)
)
radio_frame = tk.Frame(f) radio_frame = tk.Frame(f)
radio_frame.grid(row=0, column=1, sticky="w", padx=(0, 8), pady=(8, 2)) radio_frame.grid(row=1, column=1, sticky="w", padx=(0, 8), pady=(8, 2))
ttk.Radiobutton( ttk.Radiobutton(
radio_frame, text="Gitea (default)", radio_frame, text="Gitea (default)",
@@ -513,10 +522,10 @@ class SettingsDialog:
).grid(row=0, column=2, sticky="w") ).grid(row=0, column=2, sticky="w")
tk.Label(f, text="Update Server URL", anchor="w").grid( tk.Label(f, text="Update Server URL", anchor="w").grid(
row=1, column=0, sticky="w", padx=(8, 4), pady=4 row=2, column=0, sticky="w", padx=(8, 4), pady=4
) )
self._update_url_entry = ttk.Entry(f, textvariable=self.var_update_url, width=42) self._update_url_entry = ttk.Entry(f, textvariable=self.var_update_url, width=42)
self._update_url_entry.grid(row=1, column=1, sticky="ew", padx=(0, 8), pady=4) self._update_url_entry.grid(row=2, column=1, sticky="ew", padx=(0, 8), pady=4)
tk.Label( tk.Label(
f, f,
@@ -528,7 +537,7 @@ class SettingsDialog:
"still works when disabled." "still works when disabled."
), ),
justify="left", fg="#555555", wraplength=380, justify="left", fg="#555555", wraplength=380,
).grid(row=2, column=0, columnspan=2, sticky="w", padx=(8, 8), pady=(4, 8)) ).grid(row=3, column=0, columnspan=2, sticky="w", padx=(8, 8), pady=(4, 8))
self._on_update_source_change() self._on_update_source_change()
+8 -5
View File
@@ -126,17 +126,17 @@ def check_for_update():
cfg = _read_config() cfg = _read_config()
update_source = str(cfg.get("update_source", "gitea")).strip().lower() update_source = str(cfg.get("update_source", "gitea")).strip().lower()
update_url = str(cfg.get("update_url", "")).strip() update_url = str(cfg.get("update_url", "")).strip()
except Exception: except Exception as exc:
_update_log("config read failed in check_for_update: {} — defaulting to gitea".format(exc))
update_source = "gitea" update_source = "gitea"
update_url = "" update_url = ""
if update_source == "disabled":
return None, None
_update_log("Checking for update (source={}, version={})".format( _update_log("Checking for update (source={}, version={})".format(
update_source, _CURRENT_VERSION update_source, _CURRENT_VERSION
)) ))
if update_source == "disabled":
return None, None
if update_source == "url": if update_source == "url":
return _check_for_update_url(update_url) return _check_for_update_url(update_url)
else: else:
@@ -472,8 +472,11 @@ class WatcherTray:
def _icon_updater(self): def _icon_updater(self):
"""Periodically refresh the tray icon and check for updates.""" """Periodically refresh the tray icon and check for updates."""
_update_log("Updater thread started (version={}, first check in ~30s)".format(_CURRENT_VERSION))
last_status = None last_status = None
update_check_counter = 0 # check every ~5 min (30 × 10s ticks) # Initial first-check fires at counter==3 (~30s) so we get a confirmation
# line in the log soon after startup; subsequent checks every ~5 min.
update_check_counter = 27
while not self.stop_event.is_set(): while not self.stop_event.is_set():
icon_status = self._tray_status() icon_status = self._tray_status()