8.6.8.2.6. pymodaq_gui.utils.widgets.multistate_led module
- class pymodaq_gui.utils.widgets.multistate_led.LedState(*values)[source]
Bases:
StrEnumDefault two-state set for
MultistateLED— visually matches QLED.Members behave as plain
str(e.g.LedState.TRUE == 'true'), so existing code passing'true'/'false'string literals keeps working unchanged.- FALSE = 'False'
- TRUE = 'True'
- class pymodaq_gui.utils.widgets.multistate_led.MultistateLED(parent=None, states=None, readonly=True, clickable_cycle=True, size=20, shape='circle', gradient='radial')[source]
Bases:
QWidgetA painted LED indicator that can represent any number of named states.
Each state is a (name, color) pair supplied at construction time. The widget emits
state_changedwith the state name whenever the active state changes.- Parameters:
parent (
QWidget, optional)states (
listof(str,str | QColor), optional) – Ordered[(name, color), ...]pairs. name can be a plain string or aStrEnummember (e.g.LedStateorStatus) — both compare equal to their string value, so mixing the two is safe. color can be a hex string ('#rrggbb'), an SVG color name, or aQColorinstance (e.g. fromStatusPalette). Defaults toDEFAULT_STATES(a two-state red/green set keyed onLedState).readonly (
bool) – WhenTrue(default) clicking has no effect. Setsself.clickabletonot readonly— assignw.clickabledirectly to change at runtime (same pattern asQLED).clickable_cycle (
bool) – WhenTrue(default) each click advances to the next state in order, wrapping around. WhenFalse, clicking only toggles between the first and last state.size (
int) – Diameter / side length of the shape in pixels (default 20).shape (
str) – Visual shape: one of'circle','square','triangle','diamond','rectangle'. Defaults to'circle'.gradient (
str) – Fill style passed tomake_brush(). One of'flat'(default),'radial','linear','glow'.
Methods
cycle()Advance to the next state programmatically (ignores
clickable).Return the current state name.
set_state(name)Set the active state by name.
set_states(states)Replace the full state list.
Return the ordered list of state names.
changeEvent
mouseReleaseEvent
paintEvent
set_gradient
set_shape
set_size
sizeHint
state_changed
- state_changed
- staticMetaObject = PySide6.QtCore.QMetaObject("MultistateLED" inherits "QWidget": Methods: #33 type=Signal, signature=state_changed(QString), parameters=QString )