PyDMShellCommand
- class pydm.widgets.shell_command.PyDMShellCommand(parent: Optional[QWidget] = None, command: Optional[Union[str, List[str]]] = None, title: Optional[Union[str, List[str]]] = None, init_channel: Optional[str] = None)[source]
Bases:
QPushButton
,PyDMWidget
,TermOutputMode
- PyDMIcon
Name of icon to be set from Qt provided standard icons or from the fontawesome icon-set. See “enum QStyle::StandardPixmap” in Qt’s QStyle documentation for full list of usable standard icons. See https://fontawesome.com/icons?d=gallery for list of usable fontawesome icons.
- Return type:
str
- PyDMIconColor
The color of the icon (color is only applied if using icon from the “Font Awesome” set) :rtype: QColor
- class TermOutputMode
Bases:
object
Enum to select the behavior of the stdout/stderr output from a subprocess.
- allowMultipleExecutions
Whether or not we should allow the same command to be executed even if it is still running.
- Return type:
bool
- check_enable_state() None [source]
override parent method, so this widget does not get disabled when the pv disconnects. This method adds a Tool Tip with the reason why it is disabled.
- command
use the ‘commands’ property. This property simply returns the first command from the ‘commands’ property. The shell command to run.
- Return type:
str
- Type:
DEPRECATED
- confirmDialog() bool [source]
Show the confirmation dialog with the proper message in case
`showConfirmMessage`
is True.- Returns:
True if the message was confirmed or if
`showCofirmMessage`
is False.- Return type:
bool
- confirmMessage
Message to be displayed at the Confirmation dialog.
- Return type:
str
- environmentVariables
Return the environment variables which would be set along with the shell command.
- Returns:
self.env_var
- Return type:
str
- execute_command(command: str) None [source]
Execute the shell command given by
`command`
. The process is available through the`process`
member.- Parameters:
command (str) – Shell command
- hide_warning_icon() None [source]
Hide the warning icon. This is called on a timer after the warning icon is shown.
- mouseReleaseEvent(mouse_event: QMouseEvent) None [source]
mouseReleaseEvent is called when a mouse button is released. This means that if the user presses the mouse inside your widget, then drags the mouse somewhere else before releasing the mouse button, your widget receives the release event.
- Parameters:
mouse_event –
- password
Password to be encrypted using SHA256.
Warning
To avoid issues exposing the password this method always returns an empty string.
- Return type:
str
- passwordProtected
Whether or not this button is password protected.
- Returns:
bool
——-
- protectedPassword
The encrypted password.
- Return type:
str
- redirectCommandOutput
Whether or not we should redirect the output of command to the shell.
This is deprecated in favor of the stdout property. If stdout has already been set, this property will be ignored and will log a warning when changed.
If the stdout property has not been changed, setting and checking this property will still work as it always had for backwards compatibility.
- runCommandsInFullShell
Whether or not to run cmds with Popen’s option for running them through a shell subprocess.
- Return type:
bool
- showConfirmDialog
Whether or not to display a confirmation dialog.
- Return type:
bool
- showIcon
Whether or not we should show the selected Icon.
- Return type:
bool
- show_warning_icon() None [source]
Show the warning icon. This is called when a shell command fails (i.e. exits with nonzero status)
- stderr
The behavior of the subprocess’s standard error stream.
The options are:
HIDE (default): hide the stderr
SHOW: print stderr to terminal
STORE: capture stderr for programmatic retrieval
- stdout
The behavior of the subprocess’s standard output stream.
The options are:
HIDE (default): hide the stdout
SHOW: print stdout to terminal
STORE: capture stdout for programmatic retrieval
This is implicitly linked to the older, soft deprecated parameter redirectCommandOutput, which can still be set to False to HIDE the stdout or True to SHOW the stdout, provided that stdout itself has not yet been set.
Note
See QPushButton Documentation for all inherited properties and methods.