pyqt_reactive.protocols.widget_protocols

Widget ABC contracts for OpenHCS UI frameworks.

Defines explicit contracts that all widgets must implement, eliminating duck typing in favor of fail-loud inheritance-based architecture.

Design Philosophy: - Explicit inheritance over duck typing - Fail-loud over fail-silent - Discoverable over scattered - Multiple inheritance for composable capabilities

Inspired by OpenHCS patterns: - StorageBackendMeta: Metaclass auto-registration - MemoryTypeConverter: ABC contracts with adapters - LibraryRegistryBase: Centralized operations

Classes

ChangeSignalEmitter()

ABC for widgets that emit change signals.

EnumSelectable()

ABC for widgets that can select from enum values.

PlaceholderCapable()

ABC for widgets that can display placeholder text.

RangeConfigurable()

ABC for widgets that support numeric range configuration.

ValueGettable()

ABC for widgets that can return a value.

ValueSettable()

ABC for widgets that can accept a value.

class pyqt_reactive.protocols.widget_protocols.ValueGettable[source]

ABC for widgets that can return a value.

All input widgets must implement this to participate in form value extraction.

abstractmethod get_value() Any[source]

Get the current value from the widget.

Returns:

The widget’s current value. None if no value set.

class pyqt_reactive.protocols.widget_protocols.ValueSettable[source]

ABC for widgets that can accept a value.

All input widgets must implement this to participate in form value updates.

abstractmethod set_value(value: Any) None[source]

Set the widget’s value.

Parameters:

value – The value to set. None clears the widget.

class pyqt_reactive.protocols.widget_protocols.PlaceholderCapable[source]

ABC for widgets that can display placeholder text.

Placeholders show inherited/default values without setting actual values.

abstractmethod set_placeholder(text: str) None[source]

Set placeholder text for the widget.

Parameters:

text – Placeholder text to display (e.g., “Pipeline default: 42”)

class pyqt_reactive.protocols.widget_protocols.RangeConfigurable[source]

ABC for widgets that support numeric range configuration.

Typically implemented by numeric input widgets (spinboxes, sliders).

abstractmethod configure_range(minimum: float, maximum: float) None[source]

Configure the valid range for numeric input.

Parameters:
  • minimum – Minimum allowed value

  • maximum – Maximum allowed value

class pyqt_reactive.protocols.widget_protocols.EnumSelectable[source]

ABC for widgets that can select from enum values.

Typically implemented by dropdowns and radio button groups.

abstractmethod set_enum_options(enum_type: type) None[source]

Configure widget with enum options.

Parameters:

enum_type – The Enum class to populate options from

abstractmethod get_selected_enum() Any[source]

Get the currently selected enum value.

Returns:

The selected enum member, or None if no selection

class pyqt_reactive.protocols.widget_protocols.ChangeSignalEmitter[source]

ABC for widgets that emit change signals.

Provides explicit contract for signal connection, eliminating duck typing of signal names (textChanged vs valueChanged vs currentIndexChanged).

abstractmethod connect_change_signal(callback: Callable[[Any], None]) None[source]

Connect callback to widget’s change signal.

The callback will be invoked whenever the widget’s value changes, receiving the new value as its argument.

Parameters:

callback – Function to call when widget value changes. Signature: callback(new_value: Any) -> None

abstractmethod disconnect_change_signal(callback: Callable[[Any], None]) None[source]

Disconnect callback from widget’s change signal.

Parameters:

callback – The callback function to disconnect