spacr.qt.widgets.cli_setup_panel¶
Install a vendor command-line tool, then sign in to it, from a screen row.
The setup screen shows one of these under its AI provider marks and one under
its GitHub mark. Pressing Install there runs the tool’s own installer –
spacr.qt.ai.cli_install.run_install(), on a
spacr.qt.job_runner.JobRunner worker thread, never on the GUI thread
– and this panel shows what is happening: the command that is running, the
installer’s latest line of output, a Cancel button, and at the end either the
next step or a sentence the user can act on.
After a successful install the owner’s after_install starts the tool’s
sign-in, and CliSetupPanel.sign_in() watches for it to finish by asking
the tool’s own status command every few seconds, again off the GUI thread.
The command is on screen from the first moment to the last, with a Copy button beside it, for the user who would rather run it themselves.
Classes¶
Install one command-line tool and see its sign-in through. |
Module Contents¶
- class spacr.qt.widgets.cli_setup_panel.CliSetupPanel(parent: PySide6.QtWidgets.QWidget | None = None, *, threaded: bool = True, open_page: Callable[[str], bool] | None = None)[source]¶
Bases:
PySide6.QtWidgets.QWidgetInstall one command-line tool and see its sign-in through.
- Parameters:
parent – the owning widget.
threaded –
Falseruns the installer and the sign-in checks inline, for a test that drives the panel synchronously.open_page – opens an install page; the default browser by default.
- Variables:
state – what the panel is doing, one of this module’s states.
Build the panel, hidden until there is something to show.
- Parameters:
parent – the owning widget.
threaded – run jobs on a worker thread.
open_page – opens an install page.
- copy_command() str[source]¶
Put the command on the clipboard.
- Returns:
the command copied, which stays on screen either way.
- install(tool: Any, *, after_install: Callable[[], Any] | None = None, page: str = '') bool[source]¶
Run
tool’s installer off the GUI thread.Shows the command before anything runs and keeps it on screen. When none of the tool’s install methods can run on this computer, says which program is missing instead and offers the command and the install page.
- Parameters:
tool – a
spacr.qt.ai.providers.CommandLineTool.after_install – called on the GUI thread once the tool is installed, to start its sign-in.
page – the tool’s install page, offered when an install fails.
- Returns:
Truewhen an installer was started.
- shutdown() None[source]¶
Stop the installer and the sign-in watch, and retire the thread.
Called when the screen closes: an installer left running with no Cancel button on screen is one the user can no longer stop. The worker’s own answer is dropped once the thread is retired, so an install that was running is shown as cancelled here, and the panel no longer counts as busy.
- sign_in(tool: Any, start: Callable[[], bool]) bool[source]¶
Start
tool’s sign-in and watch for it to finish.- Parameters:
tool – a
spacr.qt.ai.providers.CommandLineTool.start – starts the sign-in – in a terminal for an AI CLI, in spaCR itself for the GitHub CLI – and says whether it started.
- Returns:
whether the sign-in started.