mafw.steering_gui.views.filter_editors

Editors for different filter types in the steering GUI.

Author:

Bulgheroni Antonio (antonio.bulgheroni@ec.europa.eu)

Description:

Collection of widgets for editing model, field, condition, conditional, and logic filters.

Classes

ConditionDefinition([parent])

Reusable widget containing the core condition definition controls: Field/Name selection, Operator selection, and Value input.

ConditionEditor([parent])

Editor for Condition.

ConditionalFilterEditor([parent])

Editor for ConditionalFilterConfig.

ConditionsTableModel(config[, parent])

Table model for displaying conditions in a FieldFilterConfig.

FieldFilterEditor([parent])

Editor for FieldFilterConfig.

FieldNameWidget([parent])

Name editor for model-level conditions based on model fields.

FreeNameWidget(model_name, field_name[, parent])

Name editor for field-level conditions with free text.

ListEditor([parent])

Editor for list-based conditions.

ListValueRow(field_type[, parent])

Row widget for list-based values.

LogicEditor([parent])

Editor for Logic expressions.

LogicSyntaxHighlighter([parent])

Syntax highlighter for logic expressions.

LogicTextEdit([parent])

Plain text editor with QCompleter support for logic conditions.

ModelFieldsTableModel(model_info, ...[, parent])

Table model for displaying model fields and their filters.

ModelFilterEditor([parent])

Editor for ModelFilterConfig.

ProcessorFilterEditor([parent])

Editor for processor-level filter configuration.

ProcessorModelsTableModel(processor_config, ...)

Table model for displaying available processor models.

RangeEditor([parent])

Editor for BETWEEN conditions.

SingleValueEditor([parent])

Editor for a single value condition.

ValueEditorBase

Base class for condition value editors.

class mafw.steering_gui.views.filter_editors.ConditionDefinition(parent: QWidget | None = None)[source]

Bases: QWidget

Reusable widget containing the core condition definition controls: Field/Name selection, Operator selection, and Value input.

is_complete() bool[source]

Return whether the current condition has a valid value selection.

set_condition(condition: Condition, parent: ModelFilterConfig | FieldFilterConfig | ConditionalFilterConfig, condition_name: str) None[source]

Bind the editor to the provided condition.

class mafw.steering_gui.views.filter_editors.ConditionEditor(parent: QWidget | None = None)[source]

Bases: QWidget

Editor for Condition.

is_complete() bool[source]

Return whether the current condition has a valid value selection.

set_condition(condition: Condition, parent: ModelFilterConfig | FieldFilterConfig | ConditionalFilterConfig, condition_name: str) None[source]

Bind the editor to the provided condition.

class mafw.steering_gui.views.filter_editors.ConditionalFilterEditor(parent: QWidget | None = None)[source]

Bases: QWidget

Editor for ConditionalFilterConfig.

class mafw.steering_gui.views.filter_editors.ConditionsTableModel(config: FieldFilterConfig, parent: QWidget | None = None)[source]

Bases: QAbstractTableModel

Table model for displaying conditions in a FieldFilterConfig.

class mafw.steering_gui.views.filter_editors.FieldFilterEditor(parent: QWidget | None = None)[source]

Bases: QWidget

Editor for FieldFilterConfig.

set_config(data: FieldFilterConfig | str, processor_config: ProcessorConfig, index: QModelIndex) None[source]

Update the editor with configuration data.

class mafw.steering_gui.views.filter_editors.FieldNameWidget(parent: QWidget | None = None)[source]

Bases: QWidget

Name editor for model-level conditions based on model fields.

get_name() str[source]

Return the selected field name.

get_type() type[source]

Return the python type for the selected field.

set_existing_names(names: Iterable[str], current: str | None) None[source]

Filter out names already used by sibling conditions.

set_model_info(model_info: ModelInfo | None) None[source]

Populate the combo box with fields from the provided model info.

set_name(name: str) None[source]

Set the selected field name.

class mafw.steering_gui.views.filter_editors.FreeNameWidget(model_name: str, field_name: str, parent: QWidget | None = None)[source]

Bases: QWidget

Name editor for field-level conditions with free text.

get_name() str[source]

Return the entered condition name.

get_type() type[source]

Return the python type for the configured field.

matches(model_name: str, field_name: str) bool[source]

Return whether the widget matches the provided context.

set_name(name: str) None[source]

Set the displayed condition name.

update_context(model_name: str, field_name: str) None[source]

Update the model/field context used for typing.

class mafw.steering_gui.views.filter_editors.ListEditor(parent: QWidget | None = None)[source]

Bases: ValueEditorBase

Editor for list-based conditions.

get_value() list[Any][source]

Return the current value.

set_field_type(field_type: type) None[source]

Update the editor to reflect the provided field type.

set_value(value: Any) None[source]

Set the current value.

class mafw.steering_gui.views.filter_editors.ListValueRow(field_type: type, parent: QWidget | None = None)[source]

Bases: QWidget

Row widget for list-based values.

class mafw.steering_gui.views.filter_editors.LogicEditor(parent: QWidget | None = None)[source]

Bases: QWidget

Editor for Logic expressions.

is_valid() bool[source]

Return whether the current logic expression is valid.

set_config(data: ProcessorConfig | ModelFilterConfig | FieldFilterConfig, processor_config: ProcessorConfig, index: QModelIndex) None[source]

Bind the editor to the provided configuration data.

class mafw.steering_gui.views.filter_editors.LogicSyntaxHighlighter(parent: Any = None)[source]

Bases: QSyntaxHighlighter

Syntax highlighter for logic expressions.

class mafw.steering_gui.views.filter_editors.LogicTextEdit(parent: QWidget | None = None)[source]

Bases: QPlainTextEdit

Plain text editor with QCompleter support for logic conditions.

class mafw.steering_gui.views.filter_editors.ModelFieldsTableModel(model_info: ModelInfo, model_config: ModelFilterConfig | None, processor_config: ProcessorConfig, parent: QWidget | None = None)[source]

Bases: QAbstractTableModel

Table model for displaying model fields and their filters.

class mafw.steering_gui.views.filter_editors.ModelFilterEditor(parent: QWidget | None = None)[source]

Bases: QWidget

Editor for ModelFilterConfig.

set_config(data: ModelFilterConfig | str, processor_config: ProcessorConfig, index: QModelIndex) None[source]

Update the editor with configuration data.

class mafw.steering_gui.views.filter_editors.ProcessorFilterEditor(parent: QWidget | None = None)[source]

Bases: QWidget

Editor for processor-level filter configuration.

set_config(config: ProcessorConfig) None[source]

Update the editor with processor configuration data.

class mafw.steering_gui.views.filter_editors.ProcessorModelsTableModel(processor_config: ProcessorConfig, advertised_models: list[str], all_models: list[str], parent: QWidget | None = None)[source]

Bases: QAbstractTableModel

Table model for displaying available processor models.

get_model_name(row: int) str[source]

Return the model name for the given row.

class mafw.steering_gui.views.filter_editors.RangeEditor(parent: QWidget | None = None)[source]

Bases: ValueEditorBase

Editor for BETWEEN conditions.

get_value() list[Any][source]

Return the current value.

set_field_type(field_type: type) None[source]

Update the editor to reflect the provided field type.

set_value(value: Any) None[source]

Set the current value.

class mafw.steering_gui.views.filter_editors.SingleValueEditor(parent: QWidget | None = None)[source]

Bases: ValueEditorBase

Editor for a single value condition.

get_value() Any[source]

Return the current value.

set_field_type(field_type: type) None[source]

Update the editor to reflect the provided field type.

set_value(value: Any) None[source]

Set the current value.

class mafw.steering_gui.views.filter_editors.ValueEditorBase[source]

Bases: QWidget

Base class for condition value editors.

get_value() Any[source]

Return the current value.

set_field_type(field_type: type) None[source]

Update the editor to reflect the provided field type.

set_value(value: Any) None[source]

Set the current value.

mafw.steering_gui.views.filter_editors._create_value_widget(field_type: type, parent: QWidget | None = None) QWidget[source]

Create an editor widget suitable for the provided field type.

mafw.steering_gui.views.filter_editors._get_widget_value(widget: QWidget) Any[source]

Return the current value from a value widget.

mafw.steering_gui.views.filter_editors._operators_for_type(field_type: type) list[LogicalOp][source]

Return the allowed operators for the given field type.

mafw.steering_gui.views.filter_editors._set_widget_value(widget: QWidget, value: Any) None[source]

Set the current value on a value widget.

mafw.steering_gui.views.filter_editors._NO_VALUE_OPS = {LogicalOp.IS_NOT_NULL, LogicalOp.IS_NULL}

Operators that do not require a value input.

mafw.steering_gui.views.filter_editors._OPERATOR_TOOLTIPS: dict[LogicalOp, str] = {LogicalOp.BETWEEN: 'Between the provided bounds', LogicalOp.BIT_AND: 'Bitwise AND against the provided value', LogicalOp.BIT_OR: 'Bitwise OR against the provided value', LogicalOp.EQ: 'Equal to', LogicalOp.GE: 'Greater than or equal to', LogicalOp.GLOB: 'Glob-style pattern matching', LogicalOp.GT: 'Greater than', LogicalOp.IN: 'Contained in the provided list', LogicalOp.IS_NOT_NULL: 'Value is not NULL', LogicalOp.IS_NULL: 'Value is NULL', LogicalOp.LE: 'Less than or equal to', LogicalOp.LIKE: 'SQL LIKE pattern matching', LogicalOp.LT: 'Less than', LogicalOp.NE: 'Not equal to', LogicalOp.NOT_IN: 'Not contained in the provided list', LogicalOp.REGEXP: 'Regular expression matching'}

Tooltip text for each logical operator.