pypeit.dashboard.launcher module

Launch PypeIt’s external inspection tools as subprocesses (design C8/C14/C15).

Uses Qt’s QProcess (S3-Q2) so launches are non-blocking and integrate with the event loop: stdout/stderr/return code are captured and the ActivityBar is updated on start and finish (observable launches, per the Debugging plan).

Generated by JXP and Claude.

class pypeit.dashboard.launcher.Launcher(activity=None, run_lock=None)[source]

Bases: object

Launches external tools as non-blocking subprocesses and reports progress/outcome to the activity bar.

Generated by JXP and Claude.

Parameters:
  • activity (ActivityBar) – The status/activity bar to report to (may be None).

  • run_lock (RunLock, optional) – The single-run lock (design X1); a run launched via run() holds it while active. May be None.

_drop(proc)[source]

Release a finished process reference.

Generated by JXP and Claude.

Parameters:

proc (QProcess) – The process to release.

Returns:

None.

_on_error(proc, cmd)[source]

Handle an inspection process that failed to start (e.g. command not found).

Generated by JXP and Claude.

Parameters:
  • proc (QProcess) – The failed process.

  • cmd (str) – The quoted command line.

Returns:

None.

_on_finished(proc, cmd, code, hint='viewer window')[source]

Handle process completion: report the outcome and capture output. The exact command stays shown after finishing (Stage 3b #2).

Generated by JXP and Claude.

Parameters:
  • proc (QProcess) – The finished process.

  • cmd (str) – The quoted command line.

  • code (int) – The exit code.

  • hint (str, optional) – Where the result appears.

Returns:

None.

_on_run_error(proc, cmd, on_finished)[source]

Handle a run that failed to start: release the lock and report.

Generated by JXP and Claude.

Parameters:
  • proc (QProcess) – The failed process.

  • cmd (str) – The quoted command line.

  • on_finished (callable) – Called as on_finished(-1) (or None).

Returns:

None.

_on_run_finished(proc, cmd, code, on_finished)[source]

Handle a finished run: release the lock, report, refresh.

Generated by JXP and Claude.

Parameters:
  • proc (QProcess) – The finished process.

  • cmd (str) – The quoted command line.

  • code (int) – The exit code.

  • on_finished (callable) – Called as on_finished(code) (or None).

Returns:

None.

_report(message, busy=False, build=True)[source]

Report a message to the activity bar (and the log), on the Build channel ((re)build runs) or the Inspection channel (viewer launches) per build (Stage 5 S5-Q9).

Generated by JXP and Claude.

Parameters:
  • message (str) – The message.

  • busy (bool, optional) – Show the busy indicator.

  • build (bool, optional) – Route to the Build channel (True, default) or the Inspection channel (False).

Returns:

None.

launch(argv, description=None, hint='viewer window')[source]

Launch argv as a detached-from-the-UI subprocess.

Generated by JXP and Claude.

Parameters:
  • argv (list) – The command and its arguments.

  • description (str, optional) – Human description for the activity bar (defaults to the program name).

  • hint (str, optional) – Where the result appears (e.g. 'Ginga window'); shown in the finished message so the user knows where to look.

Returns:

True if the process was started, False if it could not be launched (e.g. the target file is missing).

Return type:

bool

run(argv, description='Rebuilding', on_finished=None)[source]

Launch a PypeIt run (e.g. pypeit_run_to_calibstep): hold the single-run lock while it is active and refresh on completion (design C10/C15/X1).

Unlike launch() (inspection viewers), a run engages the run_lock so launch controls disable while it executes, and calls on_finished when it ends so the views can re-read the state.

Generated by JXP and Claude.

Parameters:
  • argv (list) – The run command and its arguments.

  • description (str, optional) – Human label for the activity bar (e.g. '(Re)building wv_calib').

  • on_finished (callable, optional) – Called as on_finished(code) when the run ends (success or failure), for the refresh-on-completion (C15).

Returns:

True if the process was started, False otherwise.

Return type:

bool