spacr.qt.setup_screen

Manage first-run setup questions and their saved answers.

Every question has a usable default, so setup can be dismissed without leaving the application unconfigured. The screen is offered once per spaCR version, allowing new questions to appear after an update while preserving answers saved for existing settings.

Functions

answered_version(→ str)

The spaCR version that last completed the setup screen, or "".

apply(→ List[str])

Write the answers through the preference module. Returns what failed.

current(→ Dict[str, Any])

What the answers are now, for the screen to open on.

current_version(→ str)

The running spaCR version, or "unknown".

mark_answered(→ None)

Record that this version's setup has been seen.

questions(→ List[Tuple[str, str, Callable, Callable, Any]])

Build the question list against the live preference module.

should_open(→ bool)

Should the setup screen open now?

skipped_on_purpose(→ bool)

Has this launch asked not to be shown the setup screen?

take_the_setup_flags(argv)

(remaining argv, asked to skip). Consumes the flags it recognises.

Module Contents

spacr.qt.setup_screen.answered_version() → str[source]

The spaCR version that last completed the setup screen, or "".

spacr.qt.setup_screen.apply(answers: Dict[str, Any]) → List[str][source]

Write the answers through the preference module. Returns what failed.

ONE SETTING’S REFUSAL MUST NOT LOSE THE OTHERS. Each is written on its own, so a value the preference module rejects is reported and the rest are still saved – a setup screen that discards six good answers because the seventh was bad has cost the user the whole screen.

Parameters:

answers – {question key: value} from the setup screen, keyed as in questions() (e.g. "language", "theme"); keys that are not questions are ignored, and each value is passed to its question’s setter.

spacr.qt.setup_screen.current() → Dict[str, Any][source]

What the answers are now, for the screen to open on.

spacr.qt.setup_screen.current_version() → str[source]

The running spaCR version, or "unknown".

spacr.qt.setup_screen.mark_answered(version: str) → None[source]

Record that this version’s setup has been seen.

Parameters:

version – the spaCR version whose setup was seen, normally current_version(); stored as str.

spacr.qt.setup_screen.questions() → List[Tuple[str, str, Callable, Callable, Any]][source]

Build the question list against the live preference module.

spacr.qt.setup_screen.should_open(version: str | None = None) → bool[source]

Should the setup screen open now?

Parameters:

version – the running version. Defaults to current_version().

True on a profile that has never answered, and again after an UPDATE. False otherwise, so a user who dismissed it is not asked again until something changes.

spacr.qt.setup_screen.skipped_on_purpose(environ=None) → bool[source]

Has this launch asked not to be shown the setup screen?

THE SCREEN IS MODAL AND IT IS NOW THE FIRST THING A LAUNCH DRAWS, which is right at a desk and wrong on a server: a batch job that inherits a stale profile would sit on an invisible modal dialog until it was killed, and the only symptom would be a run that never starts.

So a launch can say no, and one already has when it runs under the offscreen or minimal platform plugin – nobody is there to answer a question drawn into a buffer nothing displays.

spacr.qt.setup_screen.take_the_setup_flags(argv)[source]

(remaining argv, asked to skip). Consumes the flags it recognises.

They are consumed rather than ignored because launch reads the first argument as the module to open into, and an unconsumed --no-setup would be looked up as a module name and quietly open nothing.

Parameters:

argv – the command-line words after the program name, or None; a word in SKIP_FLAGS (compared stripped and lower-cased) is removed and counts as asking to skip.

Nested helpers

questions.choices_of(names)

Names paired with their readable spellings, for a picker.

spacr/qt/setup_screen.py:125