PyDMRelatedDisplayButton

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

Bases: QPushButton, PyDMWidget

A QPushButton capable of opening a new Display at the same of at 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

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

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.

displayFilename

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

Return type:

str

Type:

DEPRECATED

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

handle_open_new_window_action() None[source]

Handle the “Open in New Window” action.

Return type:

None.

macros

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

Return type:

list of str

mousePressEvent(self, e: Optional[QMouseEvent])[source]
openInNewWindow

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

Return type:

bool

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

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

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) –

showIcon

Whether or not we should show the selected Icon.

Return type:

bool

validate_password() bool[source]

If the widget is `passwordProtected`, this method will propmt 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.