fsleyes_widgets.utils.runwindow
This module provides classes and functions for running a non-interactive process, and displaying its output.
This module provides the RunPanel and ProcessManager
classes, and a couple of associated convenience functions.
A panel which displays a multiline text control, and a couple of buttons along the bottom. |
|
A thread which manages the execution of a child process, and capture of its output. |
|
Runs the given command, displaying the output in a |
- class fsleyes_widgets.utils.runwindow.RunPanel(parent)[source]
Bases:
PanelA panel which displays a multiline text control, and a couple of buttons along the bottom.
RunPanelinstances are created by therun()function, and used/controlled by theProcessManager.One of the buttons is intended to closes the window in which this panel is contained. The second button is intended to terminate the running process. Both buttons are unbound by default, so must be manually configured by the creator.
The text panel and buttons are available as the following attributes:
text: The text panel.closeButton: The Close window button.killButton: The Terminate process button.
Create a
RunPanel.- Parameters:
parent – The
wxparent object.
- class fsleyes_widgets.utils.runwindow.ProcessManager(cmd, parent, runPanel, onFinish)[source]
Bases:
ThreadA thread which manages the execution of a child process, and capture of its output.
The process output is displayed in a
RunPanelwhich must be passed to theProcessManageron creation.The
termProc()method can be used to terminate the child process before it has completed.Create a
ProcessManager.- Parameters:
cmd – String or list of strings, the command to be executed.
parent –
wxparent object.runPanel – A
RunPanelinstance , for displaying the child process output.onFinish – Callback function to be called when the process finishes. May be
None. Must accept two parameters, the GUIparentobject, and the process return code.
- fsleyes_widgets.utils.runwindow.run(name, cmd, parent, onFinish=None, modal=True)[source]
Runs the given command, displaying the output in a
RunPanel.- Parameters:
name – Name of the tool to be run, used in the window title.
cmd – String or list of strings, specifying the command to be executed.
parent –
wxparent object.modal – If
True, the frame which contains theRunPanelwill be modal.onFinish – Function to be called when the process ends. Must accept two parameters - a reference to the
wxframe/dialog displaying the process output, and the exit code of the application.