TUI: show 'refreshed <time>' in the status subtitle
6d454fcbb23129f1893f33cfd12efd8a474b4fcb
humdrum <me@humdrum.me> · 2026-07-08 17:49
parent 7651a0dd
TUI: show 'refreshed <time>' in the status subtitle Track the last successful full refresh and surface it, so it's clear when data last updated (was showing current clock time, not the refresh time). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 files changed
tui/dashboard.py +5 −2
@@ -1095,6 +1095,7 @@ _page_id: str = "page-personal"
_connected: bool = False
_sports_id: str | None = None
_sports_live: bool = False
+ _last_refresh: datetime | None = None
def __init__(self, **kwargs):
super().__init__(**kwargs)
@@ -1233,6 +1234,8 @@ self._sports_live = any(g.get("state") == "in" for g in games)
else:
self._sports_id = None
self._sports_live = False
+ if connected:
+ self._last_refresh = datetime.now()
self._connected = connected
self._update_subtitle()
@@ -1341,10 +1344,10 @@ f"{pr.get('cpu_percent') or 0:.1f}",
)
def _update_subtitle(self) -> None:
- now = datetime.now().strftime("%-I:%M %p")
+ refreshed = self._last_refresh.strftime("%-I:%M:%S %p") if self._last_refresh else "—"
dot = "●" if self._connected else "○ offline"
page_name = dict(PAGES)[self._page_id]
- self.sub_title = f"{dot} {now} · {page_name} · {THEME_NAMES[self._theme_idx]}"
+ self.sub_title = f"{dot} refreshed {refreshed} · {page_name} · {THEME_NAMES[self._theme_idx]}"
def action_page(self, page_id: str) -> None:
if page_id == self._page_id: