pyqt_reactive.forms.parameter_form_base
Abstract base class for parameter form managers.
This module defines the common interface and shared behavior for both PyQt and Textual parameter form implementations, establishing contracts and providing shared functionality.
Classes
|
Configuration for parameter form managers. |
|
Abstract base class for parameter form managers. |
- class pyqt_reactive.forms.parameter_form_base.ParameterFormConfig(field_id: str, parameter_info: Dict | None = None, is_global_config_editing: bool = False, global_config_type: Type | None = None, placeholder_prefix: str = 'Pipeline default', use_scroll_area: bool | None = None, enable_debug: bool = False, debug_target_params: set | None = None, framework: str = 'textual', color_scheme: Any | None = None, function_target: Any | None = None)[source]
Configuration for parameter form managers.
This dataclass encapsulates all configuration options for parameter form managers, providing a clean interface for customizing form behavior.
- parameter_info
Optional parameter information dictionary
- Type:
Dict | None
- global_config_type
Type of global configuration being edited
- Type:
Type | None
- color_scheme
Optional color scheme for PyQt
- Type:
Any | None
- function_target
Optional function target for docstring fallback
- Type:
Any | None
- classmethod for_pyqt(field_id: str, **kwargs) ParameterFormConfig[source]
Create configuration for PyQt parameter form manager.
- classmethod for_textual(field_id: str, **kwargs) ParameterFormConfig[source]
Create configuration for Textual parameter form manager.
- with_debug(enabled: bool = True, target_params: set | None = None) ParameterFormConfig[source]
Return a copy with debug settings configured.
- with_global_config(global_config_type: Type, editing: bool = True) ParameterFormConfig[source]
Return a copy with global configuration settings.
- __init__(field_id: str, parameter_info: Dict | None = None, is_global_config_editing: bool = False, global_config_type: Type | None = None, placeholder_prefix: str = 'Pipeline default', use_scroll_area: bool | None = None, enable_debug: bool = False, debug_target_params: set | None = None, framework: str = 'textual', color_scheme: Any | None = None, function_target: Any | None = None) None
- class pyqt_reactive.forms.parameter_form_base.ParameterFormManagerBase(parameters: Dict[str, Any], parameter_types: Dict[str, Type], config: ParameterFormConfig)[source]
Abstract base class for parameter form managers.
This class defines the common interface and shared behavior for both PyQt and Textual parameter form implementations. It provides:
Common initialization patterns
Shared utility access
Abstract methods that must be implemented
Common parameter management operations
Debug logging infrastructure
Subclasses must implement the abstract methods to provide framework-specific widget creation and form building functionality.
- __init__(parameters: Dict[str, Any], parameter_types: Dict[str, Type], config: ParameterFormConfig)[source]
Initialize the parameter form manager with common setup.
- Parameters:
parameters – Dictionary of parameter names to current values
parameter_types – Dictionary of parameter names to types
config – Configuration object for the form manager
- abstractmethod build_form() Any[source]
Build the complete form UI.
This method must be implemented by subclasses to create the framework-specific form UI containing all parameter widgets.
- Returns:
The framework-specific form widget/container
- abstractmethod create_parameter_widget(param_name: str, param_type: Type, current_value: Any) Any[source]
Create a widget for a single parameter.
This method must be implemented by subclasses to create framework-specific widgets for individual parameters.
- Parameters:
param_name – The parameter name
param_type – The parameter type
current_value – The current parameter value
- Returns:
The framework-specific widget
- abstractmethod create_nested_form(param_name: str, param_type: Type, current_value: Any) Any[source]
Create a nested form for dataclass parameters.
This method must be implemented by subclasses to create framework-specific nested forms for dataclass parameters.
- Parameters:
param_name – The parameter name
param_type – The dataclass type
current_value – The current dataclass value
- Returns:
The framework-specific nested form widget/container
- abstractmethod update_widget_value(widget: Any, value: Any) None[source]
Update a widget’s value.
This method must be implemented by subclasses to update framework-specific widget values.
- Parameters:
widget – The framework-specific widget
value – The new value to set
- abstractmethod get_widget_value(widget: Any) Any[source]
Get a widget’s current value.
This method must be implemented by subclasses to retrieve values from framework-specific widgets.
- Parameters:
widget – The framework-specific widget
- Returns:
The current widget value
- update_parameter(param_name: str, value: Any) None[source]
Update a parameter value with type conversion and nested handling.
This method provides common parameter update logic that handles type conversion, nested parameters, and debug logging. It updates both the internal data model and the corresponding widget.
- Parameters:
param_name – The parameter name to update
value – The new value
- reset_all_parameters(defaults: Dict[str, Any] = None) None[source]
Reset all parameters to their default values.
- Parameters:
defaults – Optional dictionary of default values to use
- reset_parameter(param_name: str, default_value: Any = None) None[source]
Reset a parameter to its default value.
- Parameters:
param_name – The parameter name to reset
default_value – Optional default value (uses type default if None)