render

Render the thirty Home-screen candidates to PNGs.

Standalone:

python spacr/resources/home/versions/_generators/render.py
python .../render.py --only 7 --only 23      # just those two
python .../render.py --themes dark           # one theme
python .../render.py --check                 # audit existing PNGs only

Writes, under spacr/resources/home/versions/:

vNN_<slug>/dark.png   vNN_<slug>/light.png   [vNN_<slug>/space.png]
_sheet.png            all thirty, numbered, dark
VARIANTS.md           one paragraph per variant

Every render is deterministic: offscreen Qt, a throwaway QSettings path, bundled fonts, and fixed mock content (see common).

Attributes

Functions

audit(→ Dict[str, list])

Inspect a laid-out page for the defects that invalidate a render.

build_sheet(→ str)

Compose all thirty renders into one numbered grid. Returns the path.

load_audit(→ Dict[Tuple[int, str], Dict[str, list]])

The cached audit, or an empty dict when there is none.

main(→ int)

measure_sidebar(→ Tuple[int, int])

(height the Sidebar's rows need, height a 1440x900 window gives).

render_all(→ Dict[Tuple[int, str], Dict[str, list]])

Render every (variant, theme) pair. Returns the audit per pair.

render_one(→ Dict[str, list])

Build one variant in one theme, grab it, save it. Returns its audit.

save_audit(→ None)

Persist the audit, keyed "<n>|<theme>" so it round-trips JSON.

self_check(→ dict)

Verify every PNG exists, is 1440x900, and is not near-uniform.

variant_dir(→ str)

vNN_<slug> directory for a variant, absolute.

write_markdown(→ str)

Write VARIANTS.md. Returns its path.

Module Contents

render.audit(page) Dict[str, list][source]

Inspect a laid-out page for the defects that invalidate a render.

  • elided labels — an ellipsis where the name should be;

  • clipped plain labels — text wider than the box drawing it;

  • visible scrollbars;

  • a layout whose minimum height exceeds the canvas, which means Qt squeezed something to make it fit.

render.build_sheet(specs: Sequence[dict], theme: str = 'dark', cols: int = 5, thumb_w: int = 440) str[source]

Compose all thirty renders into one numbered grid. Returns the path.

render.load_audit() Dict[Tuple[int, str], Dict[str, list]][source]

The cached audit, or an empty dict when there is none.

render.main(argv: List[str] | None = None) int[source]
render.measure_sidebar(app) Tuple[int, int][source]

(height the Sidebar's rows need, height a 1440x900 window gives).

Measures the scrolled content, not the widget. The QScrollArea these renders argued for has since landed in spacr.qt.app, so Sidebar.layout().minimumSize() is now about 85 px — the height of a title over a collapsible viewport — and says nothing at all about whether the navigation fits. The number that still means something is how tall the rows inside the viewport are.

render.render_all(app, specs: Sequence[dict], themes: Sequence[str]) Dict[Tuple[int, str], Dict[str, list]][source]

Render every (variant, theme) pair. Returns the audit per pair.

render.render_one(app, spec: dict, theme: str, out_path: str) Dict[str, list][source]

Build one variant in one theme, grab it, save it. Returns its audit.

render.save_audit(reports: Dict[Tuple[int, str], Dict[str, list]]) None[source]

Persist the audit, keyed "<n>|<theme>" so it round-trips JSON.

render.self_check(specs: Sequence[dict], themes: Sequence[str]) dict[source]

Verify every PNG exists, is 1440x900, and is not near-uniform.

render.variant_dir(spec: dict) str[source]

vNN_<slug> directory for a variant, absolute.

render.write_markdown(specs: Sequence[dict], themes: Sequence[str], reports: Dict[Tuple[int, str], Dict[str, list]], sidebar_h: int, sidebar_avail: int) str[source]

Write VARIANTS.md. Returns its path.

render.AUDIT_CACHE = '_audit.json'[source]