From 5609a744ef5e89c4d57a5239199a6afe5497590e Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Mon, 19 Oct 2026 21:22:34 +0200 Subject: Dashboard: freshness dot on the slackpkg tile Green when the last upgrade is within a day, yellow after one day, red after two; the age text beside it carries the meaning too. Co-Authored-By: Claude Opus 5.5 --- sb_builder/dashboard.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'sb_builder/dashboard.py') diff --git a/sb_builder/dashboard.py b/sb_builder/dashboard.py index 474af66..8c98040 100644 --- a/sb_builder/dashboard.py +++ b/sb_builder/dashboard.py @@ -34,6 +34,14 @@ GAP = 2 # px of surface between bar segments SPARK_POINTS = 60 # ~30 min at the default 30 s dashboard refresh +def upgrade_color(ts, now=None): + """Status color for the last upgrade: green within a day, yellow, red after two.""" + if ts is None: + return None + age = (now or time.time()) - ts + return STATUS["failed"] if age > 2 * 86400 else STATUS["aborted"] if age > 86400 else STATUS["ok"] + + def meter_color(pct, accent): """Fill color by severity: accent, then warning from 80%, critical from 90%.""" if pct >= 90: @@ -306,7 +314,9 @@ class Dashboard(QWidget): " · ".join(f"{o} {fmt_duration(None if ts is None else time.time() - ts)}" for o, ts in sync.items())) pkg = s.get("slackpkg") or {} - t["slackpkg"].set(fmt_age(pkg.get("upgrade")) if pkg.get("upgrade") else NA, + dot = upgrade_color(pkg.get("upgrade")) + t["slackpkg"].set(f'● {fmt_age(pkg["upgrade"])}' + if dot else NA, "last upgrade · lists updated " + fmt_duration( None if pkg.get("update") is None else time.time() - pkg["update"])) load, mem, disk = s.get("load"), s.get("mem"), s.get("disk") or {} -- cgit v1.2.3