common

Shared bootstrap + data for the Home-screen variant generators.

These modules render THIRTY candidate Home screens out of the real Qt widgets (spacr.qt.widgets.tile.HTile, Card, Section, …) and the real app registry (spacr.qt.app.APPS), then grab each one to a PNG under spacr/resources/home/versions/.

Nothing here is installed into the app. It is a review surface: the user picks a layout, and because every layout is built from real widgets, whatever they pick is known-buildable.

Determinism

  • QT_QPA_PLATFORM=offscreen and a throwaway QSettings path, so the renders do not depend on the reviewer’s saved theme / font scale.

  • No live system state. Every “recent run”, disk figure and GPU number is a fixed literal in MOCK — a home screen that renders differently every run cannot be reviewed.

Attributes

Classes

Ctx

Per-theme rendering context: palette, stylesheet, icon cache.

Functions

all_keys(→ List[str])

Every app key, in registry order.

alphabetical(→ List[str])

All keys sorted by display name.

app_map(→ Dict[str, Tuple[str, str, str, str]])

key -> (key, name, blurb, section).

apps(→ List[Tuple[str, str, str, str]])

The real (key, name, blurb, section) list, unmodified.

available_themes(→ Tuple[str, Ellipsis])

Themes to render: dark + light, plus space when the palette exists.

blurb_of(→ str)

One-line description of an app key.

bootstrap()

Create (or return) the offscreen QApplication, isolated + fonted.

by_frequency(→ List[str])

All keys, most-used first (see USE_COUNTS).

cats_current(→ List[Tuple[str, List[str]]])

Today's five sections, straight out of spacr.qt.app.

check_coverage(→ None)

Raise if a categorisation drops, duplicates or invents a key.

core_keys(→ List[str])

The Core-pipeline app keys, in registry order.

here(→ str)

Absolute path of this _generators directory.

n_apps(→ int)

How many apps the registry holds right now.

name_of(→ str)

Display name of an app key.

pinned_first(→ List[str])

Pinned keys first, then everything else by frequency.

repo_root(→ str)

Absolute path of the spacr checkout root (five levels up).

versions_dir(→ str)

Absolute path of spacr/resources/home/versions.

Module Contents

class common.Ctx(app, theme: str)[source]

Per-theme rendering context: palette, stylesheet, icon cache.

apply_theme(target=None) None[source]

Apply this theme, to target if given, else the application.

QApplication.setStyleSheet re-polishes EVERY top-level widget. Inside pytest-qt the application is shared, so widgets belonging to other tests – including ones mid-teardown whose C++ side is already gone – get re-polished, and the process SEGFAULTS. That is what took the tests/qt suite down here, and it is the same trap the theme work hit with QApplication.topLevelWidgets().

A stylesheet set on a widget cascades to its children, so styling the root being rendered is equivalent for our purposes and touches nothing else. The application-wide path is used only when bootstrap() created the application, i.e. in the standalone generator.

icon(key: str)[source]

A themed QIcon for an app key (same rules as the app).

The spaCR wordmark logo, re-inked for this theme.

pixmap(key: str, px: int)[source]

The app icon rendered to a px square pixmap.

qss() str[source]

This theme’s stylesheet.

background=None: the Space theme degrades to its gradient sky rather than depending on a cached generated image.

P[source]
app[source]
theme[source]
common.all_keys() List[str][source]

Every app key, in registry order.

common.alphabetical() List[str][source]

All keys sorted by display name.

common.app_map() Dict[str, Tuple[str, str, str, str]][source]

key -> (key, name, blurb, section).

common.apps() List[Tuple[str, str, str, str]][source]

The real (key, name, blurb, section) list, unmodified.

common.available_themes() Tuple[str, Ellipsis][source]

Themes to render: dark + light, plus space when the palette exists.

space is another agent’s work-in-progress; this probes for it rather than depending on it.

common.blurb_of(key: str) str[source]

One-line description of an app key.

common.bootstrap()[source]

Create (or return) the offscreen QApplication, isolated + fonted.

Redirects QSettings at a temp directory before anything reads a preference, so preferences.get_font_scale() (which HTile/scaled_px consult) always answers 1.0 regardless of what the reviewer has saved.

common.by_frequency() List[str][source]

All keys, most-used first (see USE_COUNTS).

common.cats_current() List[Tuple[str, List[str]]][source]

Today’s five sections, straight out of spacr.qt.app.

common.check_coverage(cats: Sequence[Tuple[str, Sequence[str]]]) None[source]

Raise if a categorisation drops, duplicates or invents a key.

common.core_keys() List[str][source]

The Core-pipeline app keys, in registry order.

Read from spacr.qt.app.SECTION_CORE rather than compared against a typed section name. The section used to be called “Core pipeline”; it is now “Core”, and the two variants that filtered on the old string silently produced an empty list — variant 18, whose entire content is the core nine, rendered nine missing tiles, and variant 24 lost every Ctrl+N badge.

common.here() str[source]

Absolute path of this _generators directory.

common.n_apps() int[source]

How many apps the registry holds right now.

Every “N apps” the variants draw or write goes through here. The count used to be typed into two dozen strings as 29; the registry then grew Distributed Jobs, Classifier Evaluation and Run History and every one of those strings became a lie that no test could see, because a literal cannot disagree with itself.

common.name_of(key: str) str[source]

Display name of an app key.

common.pinned_first() List[str][source]

Pinned keys first, then everything else by frequency.

common.repo_root() str[source]

Absolute path of the spacr checkout root (five levels up).

common.versions_dir() str[source]

Absolute path of spacr/resources/home/versions.

common.CANVAS_H = 900[source]
common.CANVAS_W = 1440[source]
common.CATS_BROAD3[source]
common.CATS_INTENT4[source]
common.CATS_NARROW8[source]
common.CATS_QUESTIONS[source]
common.CATS_STAGE5[source]
common.MOCK[source]
common.PINNED = ['mask', 'measure', 'annotate', 'classify', 'plate_view', 'report'][source]
common.UNUSED_APP_COUNT = 4[source]
common.USE_COUNTS[source]