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

CliSetupPanel

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.QWidget

Install one command-line tool and see its sign-in through.

Parameters:
  • parent – the owning widget.

  • threaded – False runs 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.

cancel() → None[source]

Stop the installer, or stop waiting for the sign-in.

copy_command() → str[source]

Put the command on the clipboard.

Returns:

the command copied, which stays on screen either way.

done() → None[source]

Close the panel and have the owner look at the tool again.

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:

True when an installer was started.

is_busy() → bool[source]

Whether an installer is running.

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:
Returns:

whether the sign-in started.

sign_in_failed(message: str) → None[source]

Say that a sign-in the owner was running has ended unfinished.

Parameters:

message – what happened and what to do, already translated.

tool_label() → str[source]

The name of the tool this panel is installing or signing in to.

Returns:

its label, such as "Claude", or "" before the panel has been given a tool.