PyDMEnumButton

class pydm.widgets.enum_button.PyDMEnumButton(parent=None, init_channel=None)[source]

Bases: QWidget, PyDMWritableWidget, WidgetType

A QWidget that renders buttons for every option of Enum Items. For now, two types of buttons can be rendered: - Push Button - Radio Button

Parameters:
  • parent (QWidget) – The parent widget for the Label

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

  • Signals

  • -------

  • send_value_signal (int, float, str, bool or np.ndarray) – Emitted when the user changes the value.

check_enable_state()[source]

Checks whether or not the widget should be disable. This method also disables the widget and add a Tool Tip with the reason why it is disabled.

checkable

Whether or not the button should be checkable.

Return type:

bool

clear()[source]

Remove all inner widgets from the layout

customOrder

Index list in which items are to be displayed in the button group.

Return type:

List[str]

enum_strings_changed(new_enum_strings)[source]

Callback invoked when the Channel has new enum values. This callback also triggers a value_changed call so the new enum values to be broadcasted.

Parameters:

new_enum_strings (tuple) – The new list of values

handle_button_clicked(id)[source]

Handles the event of a button being clicked.

Parameters:

id (int) – The clicked button id.

horizontalSpacing

The horizontal gap of the QGridLayout containing the QButtonGroup.

Return type:

int

invertOrder

Whether or not to invert the order for the button group.

Return type:

bool

items

Items to be displayed in the button group.

This property can be overridden by the items coming from the control system. Because C++ QStringList expects a list type, we need to make sure that None is never returned.

Return type:

List[str]

marginBottom

The bottom margin of the QGridLayout of buttons.

Return type:

int

marginLeft

The left margin of the QGridLayout of buttons.

Return type:

int

marginRight

The right margin of the QGridLayout of buttons.

Return type:

int

marginTop

The top margin of the QGridLayout of buttons.

Return type:

int

minimumSizeHint()[source]

This property holds the recommended minimum size for the widget.

Return type:

QSize

orientation

Whether to lay out the bit indicators vertically or horizontally.

Return type:

int

paintEvent(_)[source]

Paint events are sent to widgets that need to update themselves, for instance when part of a widget is exposed because a covering widget was moved.

At PyDMDrawing this method handles the alarm painting with parameters from the stylesheet, configures the brush, pen and calls `draw_item` so the specifics can be performed for each of the drawing classes.

Parameters:

event (QPaintEvent) –

rebuild_layout()[source]

Method to reorganize the top-level widget and its contents according to the layout property values.

rebuild_widgets()[source]

Rebuild the list of widgets based on a new enum or generates a default list of fake strings so we can see something at Designer.

useCustomOrder

Whether or not to use custom order for the button group.

Return type:

bool

value_changed(new_val)[source]

Callback invoked when the Channel value is changed.

Parameters:

new_val (int) – The new value from the channel.

verticalSpacing

The vertical gap of the QGridLayout containing the QButtonGroup.

Return type:

int

widgetType

The widget type to be used when composing the group.

Return type:

WidgetType

Note

See QWidget Documentation for all inherited properties and methods.