PyDMEnumButton
- class pydm.widgets.enum_button.PyDMEnumButton(parent=None, init_channel=None)[source]
Bases:
QWidget
,PyDMWritableWidget
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.
- Q_ENUM(a0: Union[type, enum.Enum])
- 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.
- 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(button)[source]
Handles the event of a button being clicked.
- Parameters:
id (QAbstractButton) – The clicked button button.
- minimumSizeHint()[source]
This property holds the recommended minimum size for the widget.
- Return type:
QSize
- 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) –
- prop_type
alias of
Orientation
- readCustomOrder() → List[str][source]
Index list in which items are to be displayed in the button group.
- Return type:
List[str]
- readHorizontalSpacing() → int[source]
The horizontal gap of the QGridLayout containing the QButtonGroup.
- Return type:
int
- readInvertOrder() → bool[source]
Whether or not to invert the order for the button group.
- Return type:
bool
- readItems() → List[str][source]
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]
- readOrientation() → int | PyQt5.QtCore.Qt.Orientation[source]
Whether to lay out the bit indicators vertically or horizontally.
- Return type:
int
- readUseCustomOrder() → bool[source]
Whether or not to use custom order for the button group.
- Return type:
bool
- readVerticalSpacing() → int[source]
The vertical gap of the QGridLayout containing the QButtonGroup.
- Return type:
int
- readWidgetType() → WidgetType[source]
The widget type to be used when composing the group.
- Return type:
WidgetType
- 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.
- setHorizontalSpacing(new_spacing) → None[source]
Set the layout horizontal gap between buttons.
- Parameters:
new_spacing (int) –
- setMarginBottom(new_margin) → None[source]
Set the bottom margin of the QGridLayout of buttons.
- Parameters:
int –
- setMarginLeft(new_margin) → None[source]
Set the left margin of the QGridLayout of buttons.
- Parameters:
int –
- setMarginRight(new_margin) → None[source]
Set the right margin of the QGridLayout of buttons.
- Parameters:
int –
- setMarginTop(new_margin) → None[source]
Set the top margin of the QGridLayout of buttons.
- Parameters:
int –
- setOrientation(new_orientation) → None[source]
Whether to lay out the bit indicators vertically or horizontally.
- Parameters:
new_orientation (Qt.Orientation, int) –
- setVerticalSpacing(new_spacing) → None[source]
Set the layout vertical gap between buttons.
- Parameters:
new_spacing (int) –
Note
See QWidget Documentation for all inherited properties and methods.