PyDMRelatedDisplayButton

class pydm.widgets.related_display_button.PyDMRelatedDisplayButton(parent: Optional[QWidget] = None, filename: str = None, init_channel: Optional[str] = None)[source]

Bases: QPushButton, PyDMWidget

A QPushButton capable of opening a new Display in the same or a new window.

Parameters:
  • parent (QWidget, optional) – The parent widget for the related display button

  • filename (str, optional) – The file to be opened

  • init_channel (str, optional) – The channel to be used by the widget

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.

eventFilter(self, a0: Optional[QObject], a1: Optional[QEvent]) bool[source]
handle_open_new_window_action() None[source]

Handle the “Open in New Window” action.

Return type:

None.

mousePressEvent(self, e: Optional[QMouseEvent])[source]
open_display(filename, macro_string='', target=None)[source]

Open the configured filename with the given target.

Parameters:

target (int) – PyDMRelatedDisplayButton.EXISTING_WINDOW or 0 will open the file on the same window. PyDMRelatedDisplayButton.NEW_WINDOW or 1 will result on a new process.

Returns:

display – The widget that was opened. Useful for testing and debug.

Return type:

Display

push_button_release_event(mouse_event: QMouseEvent) None[source]

Opens the related display given by filename. If the Shift Key is hold it will open in a new window.

Called when a mouse button is released. A widget receives mouse release events when it has received the corresponding mouse press event. 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 (QMouseEvent) –

readDisplayFilename() str[source]

DEPRECATED: use the ‘filenames’ property. This property simply returns the first filename from the ‘filenames’ property. The filename to open

Return type:

str

If True, any symlinks in the path to filename (including the base path of the parent display) will be followed, so that it will always use the canonical path. If False (default), the file will be searched without canonicalizing the path beforehand.

Note that it will not work on Windows if you’re using a Python version prior to 3.8.

Return type:

bool

readMacros() List[str][source]

The macro substitutions to use when launching the display, in JSON object format.

Return type:

list of str

readOpenInNewWindow() bool[source]

If true, the button will open the display in a new window, rather than in the existing window.

Return type:

bool

readPassword() str[source]

Password to be encrypted using SHA256.

Warning

To avoid issues exposing the password this method always returns an empty string.

Return type:

str

readPasswordProtected() bool[source]

Whether or not this button is password protected.

Returns:

  • bool

  • ——-

readProtectedPassword() str[source]

The encrypted password.

Return type:

str

readPyDMIcon() str[source]

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

readPyDMIconColor() QColor[source]

The color of the icon (color is only applied if using icon from the “Font Awesome” set) :rtype: QColor

readRecursiveDisplaySearch() bool[source]

Whether or not to search for a provided display file recursively in subfolders relative to the location of this display.

Returns:

If recursive search is enabled.

Return type:

bool

readShowIcon() bool[source]

Whether or not we should show the selected Icon.

Return type:

bool

setDisplayFilename(value: str) None[source]

DEPRECATED: use the ‘filenames’ property. Any value set to this property is appended to the ‘filenames’ property, then ‘displayFilename’ is cleared.

Parameters:

value (str) –

If True, any symlinks in the path to filename (including the base path of the parent display) will be followed, so that it will always use the canonical path. If False (default), the file will be searched using the non-canonical path.

Note that it will not work on Windows if you’re using a Python version prior to 3.8.

Parameters:

follow_symlinks (bool) –

setMacros(new_macros: List[str]) None[source]

The macro substitutions to use when launching the display, in JSON object format.

Parameters:

new_macros (list of str) –

setOpenInNewWindow(open_in_new: bool) None[source]

If true, the button will open the display in a new window, rather than in the existing window.

Parameters:

open_in_new (bool) –

setPassword(value: str) None[source]

Password to be encrypted using SHA256.

Parameters:
  • value (str) –

  • encrypted (The password to be) –

setPasswordProtected(value: bool) None[source]

Whether or not this button is password protected.

Parameters:

value (bool) –

setPyDMIcon(value: str) None[source]

Name of icon to be set from Qt provided standard icons or from the “Font Awesome” 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 “Font Awesome” icons.

Parameters:

value (str) –

setPyDMIconColor(state_color: QColor) None[source]

The color of the icon (color is only applied if using icon from the “Font Awesome” set) :param new_color: :type new_color: QColor

setRecursiveDisplaySearch(new_value) None[source]

Set whether or not to search for a provided display file recursively in subfolders relative to the location of this display.

Parameters:

new_value – If recursive search should be enabled.

setShowIcon(value: bool) None[source]

Whether or not we should show the selected Icon.

Parameters:

value (bool) –

validate_password() bool[source]

If the widget is `passwordProtected`, this method will prompt the user for the correct password.

Returns:

True in case the password was correct of if the widget is not password protected.

Return type:

bool

Note

See QPushButton Documentation for all inherited properties and methods.