diff options
| author | Leonardo Guimaraes <leozinhoszg@gmail.com> | 2026-11-22 14:48:31 -0300 |
|---|---|---|
| committer | Leonardo Guimaraes <leozinhoszg@gmail.com> | 2026-11-22 14:48:31 -0300 |
| commit | 56c0bc848e75fa64628a7b006f33c7f0d3e02129 (patch) | |
| tree | b4100a78dceb162fa19b7ebab629c1c4379a65e5 /tools/progress_dashboard.py | |
| parent | 4958cb1e7230787b669bd65289fcb2d59061ea59 (diff) | |
progress_dashboard: project logo in the header, sticky filters, theme switch
The page embeds assets/logo.png as a data: URI, so it stays one file that
opens from disk; without the asset it shows no image. The filters, search
and section links stay at the top while scrolling, each status filter shows
its count, and a button clears the filters. Panel metrics are bars with
their ratio, panels without evidence move after the ones with it, and the
latest merges are a table with item tags and authors. A theme button
overrides the system theme (kept in localStorage when it is available);
the treemaps and the trend chart redraw on a theme change. Neutrals carry
a faint tint from the logo; status colours are unchanged.
Diffstat (limited to 'tools/progress_dashboard.py')
| -rw-r--r-- | tools/progress_dashboard.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tools/progress_dashboard.py b/tools/progress_dashboard.py index a4a137e31..bbb338853 100644 --- a/tools/progress_dashboard.py +++ b/tools/progress_dashboard.py | |||
| @@ -25,6 +25,7 @@ No game data leaves the inputs: the page and the JSON carry counts, pass/fail, e | |||
| 25 | own document text; never a shader name, a carved file name or a path into the game copy. | 25 | own document text; never a shader name, a carved file name or a path into the game copy. |
| 26 | """ | 26 | """ |
| 27 | import argparse | 27 | import argparse |
| 28 | import base64 | ||
| 28 | import datetime as dt | 29 | import datetime as dt |
| 29 | import hashlib | 30 | import hashlib |
| 30 | import json | 31 | import json |
| @@ -39,6 +40,7 @@ from concurrent.futures import ThreadPoolExecutor | |||
| 39 | 40 | ||
| 40 | ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | 41 | ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
| 41 | TEMPLATE = os.path.join(ROOT, "tools", "progress_dashboard.html") | 42 | TEMPLATE = os.path.join(ROOT, "tools", "progress_dashboard.html") |
| 43 | LOGO = os.path.join(ROOT, "assets", "logo.png") | ||
| 42 | SCHEMA = "leonida.progress/1" | 44 | SCHEMA = "leonida.progress/1" |
| 43 | STATUSES = ("verified", "implemented", "partial", "failed", "missing", "blocked", "unknown") | 45 | STATUSES = ("verified", "implemented", "partial", "failed", "missing", "blocked", "unknown") |
| 44 | PYTEST_MARKERS = re.compile(r"^import pytest|^ *HAVE_NUMPY =", re.M) # the CI selection rule (ci.yml) | 46 | PYTEST_MARKERS = re.compile(r"^import pytest|^ *HAVE_NUMPY =", re.M) # the CI selection rule (ci.yml) |
| @@ -865,11 +867,22 @@ def summary_line(snap): | |||
| 865 | "metrics": {m["id"]: {"v": m["value"], "n": m["numerator"], "d": m["denominator"], "f": m["definition"]} for m in snap["metrics"]}} | 867 | "metrics": {m["id"]: {"v": m["value"], "n": m["numerator"], "d": m["denominator"], "f": m["definition"]} for m in snap["metrics"]}} |
| 866 | 868 | ||
| 867 | 869 | ||
| 870 | def logo_src(): | ||
| 871 | """The project logo (assets/logo.png) as a data: URI, so the page stays one file that opens from disk; empty when | ||
| 872 | the asset is absent, and the page then shows no image.""" | ||
| 873 | try: | ||
| 874 | with open(LOGO, "rb") as f: | ||
| 875 | data = f.read() | ||
| 876 | except OSError: | ||
| 877 | return "" | ||
| 878 | return "data:image/png;base64," + base64.b64encode(data).decode("ascii") if data[:8] == b"\x89PNG\r\n\x1a\n" else "" | ||
| 879 | |||
| 880 | |||
| 868 | def render_page(snap, history): | 881 | def render_page(snap, history): |
| 869 | template = read_text(TEMPLATE) | 882 | template = read_text(TEMPLATE) |
| 870 | payload = json.dumps({"snapshot": snap, "history": history}, ensure_ascii=False, sort_keys=True) | 883 | payload = json.dumps({"snapshot": snap, "history": history}, ensure_ascii=False, sort_keys=True) |
| 871 | payload = payload.replace("</", "<\\/") # a document string can never close the script element | 884 | payload = payload.replace("</", "<\\/") # a document string can never close the script element |
| 872 | return template.replace("/*__PROGRESS_DATA__*/null", payload) | 885 | return template.replace("/*__PROGRESS_LOGO__*/", logo_src()).replace("/*__PROGRESS_DATA__*/null", payload) |
| 873 | 886 | ||
| 874 | 887 | ||
| 875 | def write_outputs(snap, out_dir): | 888 | def write_outputs(snap, out_dir): |