pyqt_reactive.protocols.widget_adapters
Widget adapters that wrap Qt widgets to implement OpenHCS ABCs.
Normalizes Qt’s inconsistent APIs: - QLineEdit.text() vs QSpinBox.value() vs QComboBox.currentData() - QLineEdit.setText() vs QSpinBox.setValue() vs QComboBox.setCurrentIndex() - QLineEdit.setPlaceholderText() vs QSpinBox.setSpecialValueText()
All adapters implement consistent interface via ABCs: - get_value() / set_value() for all widgets - set_placeholder() for all widgets - connect_change_signal() for all widgets
Mirrors MemoryTypeConverter pattern - adapters normalize inconsistent APIs.
Classes
Adapter for QCheckBox implementing OpenHCS ABCs. |
|
|
Adapter for checkbox group (List[Enum]) implementing OpenHCS ABCs. |
Adapter for QComboBox implementing OpenHCS ABCs. |
|
|
Adapter for QDoubleSpinBox implementing OpenHCS ABCs. |
Adapter for QLineEdit implementing OpenHCS ABCs. |
|
|
Metaclass for PyQt widgets that need ABC support. |
|
Adapter for QSpinBox implementing OpenHCS ABCs. |
- class pyqt_reactive.protocols.widget_adapters.PyQtWidgetMeta(name, bases, namespace, /, **kwargs)[source]
Metaclass for PyQt widgets that need ABC support.
- class pyqt_reactive.protocols.widget_adapters.LineEditAdapter[source]
Adapter for QLineEdit implementing OpenHCS ABCs.
Normalizes Qt API to OpenHCS contracts: - .text() → .get_value() - .setText() → .set_value() - .setPlaceholderText() → .set_placeholder() - .textChanged → .connect_change_signal()
- class pyqt_reactive.protocols.widget_adapters.SpinBoxAdapter(parent=None)[source]
Adapter for QSpinBox implementing OpenHCS ABCs.
Handles None values using special value text mechanism. When value is None, displays placeholder text at minimum value.
- class pyqt_reactive.protocols.widget_adapters.DoubleSpinBoxAdapter(parent=None)[source]
Adapter for QDoubleSpinBox implementing OpenHCS ABCs.
Handles None values and floating-point ranges.
- class pyqt_reactive.protocols.widget_adapters.ComboBoxAdapter[source]
Adapter for QComboBox implementing OpenHCS ABCs.
Stores actual values in itemData, not just display text. Supports enum population and selection.
- populate_enum(enum_type: type) None[source]
Populate combobox with enum values.
- Parameters:
enum_type – The Enum class to populate from
- class pyqt_reactive.protocols.widget_adapters.CheckBoxAdapter[source]
Adapter for QCheckBox implementing OpenHCS ABCs.
Returns bool values, treats None as False.
- class pyqt_reactive.protocols.widget_adapters.CheckboxGroupAdapter(parent=None)[source]
Adapter for checkbox group (List[Enum]) implementing OpenHCS ABCs.
Manages a group of NoneAwareCheckBox widgets for multi-selection. Returns List[Enum] or None (for placeholder state).
This eliminates duck typing - instead of checking for _checkboxes attribute, we use proper ABC inheritance.
- checkbox_items() tuple[tuple[Any, Any], ...][source]
Return enum-to-checkbox items for group-level placeholder logic.
- get_value() Any[source]
Implement ValueGettable ABC.
- Returns:
None if all checkboxes are in placeholder state (inherit from parent)
List[Enum] of checked items if any checkbox has been clicked
- set_value(value: Any) None[source]
Implement ValueSettable ABC.
- Parameters:
value – None (placeholder state) or List[Enum] (concrete values)
- pyqt_reactive.protocols.widget_adapters.adapter_class
alias of
CheckboxGroupAdapter