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
A QPushButton capable of execute shell commands.
- Parameters:
parent (QWidget, optional) – The parent widget for the shell command
command (str or list, optional) – A string for a single command to run, or a list of strings for multiple commands
title (str or list, optional) – Title of the command to run, shown in the display. If a list, number of elements must match that of command
init_channel (str, optional) – The channel to be used by the widget
- 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
- 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.
- Return type:
bool
- 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
Note
See QPushButton Documentation for all inherited properties and methods.