pyqt_reactive.services.widget_service

Consolidated Widget Service.

Merges: - WidgetFinderService: Finding widgets in ParameterFormManager - WidgetStylingService: Read-only styling, dimming, visual state management - WidgetUpdateService: Low-level widget value update operations

Key features: 1. Centralized widget finding, styling, and update logic 2. Type-safe widget retrieval with fail-loud behavior 3. Signal blocking during value updates 4. Read-only styling that maintains normal appearance

Classes

WidgetService()

Consolidated service for widget finding, styling, and value updates.

class pyqt_reactive.services.widget_service.WidgetService[source]

Consolidated service for widget finding, styling, and value updates.

Examples

service = WidgetService()

# Find widgets: checkbox = WidgetService.find_optional_checkbox(manager, param_name) widget = WidgetService.get_widget_safe(manager, param_name)

# Style widgets: WidgetService.make_readonly(widget, color_scheme) WidgetService.apply_dimming(widget, opacity=0.5)

# Update widget values: service.update_widget_value(widget, value, param_name, manager=manager)

__init__()[source]

Initialize widget service with dependencies.

static find_optional_checkbox(manager, param_name: str) QCheckBox | None[source]

Find optional checkbox for a parameter.

static find_nested_checkbox(manager, param_name: str) QCheckBox | None[source]

Find checkbox in nested manager’s container.

static find_group_box(container: QWidget, group_box_type: Type = None) QWidget | None[source]

Find group box within container.

static get_widget_safe(manager, param_name: str) QWidget | None[source]

Safely get a widget from manager’s widgets dict.

static find_all_input_widgets(container: QWidget, widget_ops) List[QWidget][source]

Find all input widgets within a container.

static get_parameter_display_info(param_name: str, param_type: Type, manager=None, description: str | None = None) Dict[str, Any][source]

Get parameter display information including description from ObjectState._parameter_descriptions.

Parameters:
  • param_name – Name of the parameter

  • param_type – Type of the parameter

  • manager – Optional ParameterFormManager instance for context

  • description – Optional parameter description to use

Returns:

Dictionary with display information (field_label, description, etc.)

static make_readonly(widget: QWidget, color_scheme) None[source]

Make a widget read-only without greying it out.

static apply_dimming(widget: QWidget, opacity: float = 0.5) None[source]

Apply visual dimming to a widget.

static remove_dimming(widget: QWidget) None[source]

Remove visual dimming from a widget.

static set_enabled_with_styling(widget: QWidget, enabled: bool, color_scheme=None) None[source]

Set widget enabled state with appropriate styling.

static clear_stylesheet(widget: QWidget) None[source]

Clear widget’s stylesheet.

static apply_error_styling(widget: QWidget, color_scheme) None[source]

Apply error styling to a widget.

static remove_error_styling(widget: QWidget) None[source]

Remove error styling from a widget.

update_widget_value(widget: QWidget, value: Any, param_name: str | None = None, skip_context_behavior: bool = False, manager=None) None[source]

Update widget value with signal blocking and optional placeholder application.

clear_widget_to_default_state(widget: QWidget) None[source]

Clear widget to its default/empty state for reset operations.

update_combo_box(widget: QComboBox, value: Any) None[source]

Update combo box with value matching.

update_checkbox_group(widget: QWidget, value: Any) None[source]

Update checkbox group using functional operations.

get_widget_value(widget: QWidget) Any[source]

Get widget value using ABC-based polymorphism.