diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-21 11:25:34 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-21 11:25:34 +0200 |
| commit | 9fa8a131c5b6cf291aaac608e4f508535ff86c64 (patch) | |
| tree | 64c1cf6b73a8d4e7622549b808c72a51d29c12f7 /sb_builder | |
| parent | be69467c2caefddc1f04d5be71d36f6b8d9c13d3 (diff) | |
| download | sb-builder-9fa8a131c5b6cf291aaac608e4f508535ff86c64.tar.gz sb-builder-9fa8a131c5b6cf291aaac608e4f508535ff86c64.zip | |
Dashboard: cap job titles in Recent jobs
A rich-text QLabel never shrinks below its content, so a slackrepo job
naming many packages widened the window past the screen. Titles longer
than TITLE_MAX characters are cut with an ellipsis; the Jobs tab still
shows them in full.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'sb_builder')
| -rw-r--r-- | sb_builder/dashboard.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sb_builder/dashboard.py b/sb_builder/dashboard.py index 3280168..0d68d6f 100644 --- a/sb_builder/dashboard.py +++ b/sb_builder/dashboard.py @@ -33,6 +33,7 @@ STATUS = {"ok": "#0ca30c", "aborted": "#fab219", "bad": "#ec835a", "failed": "#d "killed": "#fab219", "lost": "#ec835a"} GAP = 2 # px of surface between bar segments SPARK_POINTS = 60 # ~30 min at the default 30 s dashboard refresh +TITLE_MAX = 90 # chars of a job title in Recent jobs def upgrade_color(ts, now=None): @@ -377,7 +378,10 @@ class Dashboard(QWidget): if color: icon = f'<span style="color:{color}">{icon}</span>' dur = None if "start" not in j else j.get("end", time.time()) - j["start"] - rows.append(f"<tr><td>{icon} </td><td>{html.escape(job_title(j))} </td>" + title = job_title(j) + if len(title) > TITLE_MAX: # a rich-text label never shrinks: cap it or it widens the window + title = title[:TITLE_MAX - 1] + "…" + rows.append(f"<tr><td>{icon} </td><td>{html.escape(title)} </td>" f"<td>{j['status']} </td>" f"<td>{fmt_time(j.get('start', j['created']))} </td>" f"<td>{fmt_duration(dur)}</td></tr>") |
