mafw.steering_gui.models.filter_tree_model

Tree model representing the filter configuration hierarchy.

Author:

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

Description:

QAbstractItemModel implementation for displaying and editing filters, conditions, and logic associated with a processor.

Classes

ConditionKey(model_name, field_name, ...)

Stable key describing a condition entry in the filter tree.

FilterNodeType(*values)

Types of nodes in the filter tree.

FilterTreeItem(node_type[, data, parent, key])

Internal node for the FilterTreeModel.

FilterTreeModel(config[, parent])

Tree model for processor filters.

LogicKey(model_name, field_name)

Stable key describing a logic entry in the filter tree.

class mafw.steering_gui.models.filter_tree_model.ConditionKey(model_name: str, field_name: str | None, condition_name: str)[source]

Bases: object

Stable key describing a condition entry in the filter tree.

class mafw.steering_gui.models.filter_tree_model.FilterNodeType(*values)[source]

Bases: Enum

Types of nodes in the filter tree.

class mafw.steering_gui.models.filter_tree_model.FilterTreeItem(node_type: FilterNodeType, data: Any = None, parent: FilterTreeItem | None = None, key: str | None = None)[source]

Bases: object

Internal node for the FilterTreeModel.

class mafw.steering_gui.models.filter_tree_model.FilterTreeModel(config: ProcessorConfig, parent: Any = None)[source]

Bases: QAbstractItemModel

Tree model for processor filters.

_collect_condition_keys() set[ConditionKey][source]

Return the set of condition keys currently in the tree.

_collect_logic_keys() set[LogicKey][source]

Return the set of logic keys currently in the tree.

_has_logic(config: ProcessorConfig | ModelFilterConfig | FieldFilterConfig) bool[source]

Return whether the config currently has a logic buffer or original string.

_setup_model_data() None[source]

Build the tree structure from the ProcessorConfig.

collect_subtree_indexes(parent_index: QModelIndex | QPersistentModelIndex) list[QModelIndex | QPersistentModelIndex][source]

Return every index below the provided parent.

condition_key_for_index(index: QModelIndex | QPersistentModelIndex) ConditionKey | None[source]

Return a condition key for the provided index.

condition_key_for_item(item: FilterTreeItem) ConditionKey | None[source]

Return a condition key for the provided tree item.

condition_key_for_parent(parent: ModelFilterConfig | FieldFilterConfig, condition_name: str) ConditionKey | None[source]

Return the condition key for the given parent config and name.

find_condition_index(key: ConditionKey) QModelIndex[source]

Return the model index for a condition key if present.

find_index_for_data(data: ~typing.Any, parent_index: ~PySide6.QtCore.QModelIndex = <PySide6.QtCore.QModelIndex(-1, -1, 0x0, QObject(0x0))>) QModelIndex[source]

Find the QModelIndex for the given data object by searching the tree recursively.

find_logic_index(key: LogicKey) QModelIndex[source]

Return the model index for a logic key if present.

find_model_index(model_name: str) QModelIndex[source]

Find the QModelIndex for the given model name.

is_condition_warning(key: ConditionKey) bool[source]

Return whether the condition key is currently flagged.

is_logic_warning(key: LogicKey) bool[source]

Return whether the logic key is currently flagged.

logic_key_for_index(index: QModelIndex | QPersistentModelIndex) LogicKey | None[source]

Return a logic key for the provided index.

logic_key_for_item(item: FilterTreeItem) LogicKey | None[source]

Return a logic key for the provided tree item.

set_condition_warning(key: ConditionKey, enabled: bool) None[source]

Enable or disable the warning icon for the provided condition key.

set_logic_warning(key: LogicKey, enabled: bool) None[source]

Enable or disable the warning icon for the provided logic key.

class mafw.steering_gui.models.filter_tree_model.LogicKey(model_name: str | None, field_name: str | None)[source]

Bases: object

Stable key describing a logic entry in the filter tree.

mafw.steering_gui.models.filter_tree_model._RESOURCE_DIR = PosixPath('/tmp/mafw-docs-ya4y8cnx/v2.0.0/src/mafw/steering_gui/resources')

Base path for GUI resources used by the filter tree.

mafw.steering_gui.models.filter_tree_model._WARNING_ICON_PATH = PosixPath('/tmp/mafw-docs-ya4y8cnx/v2.0.0/src/mafw/steering_gui/resources/mynaui--danger-triangle.svg')

Icon path used to flag incomplete conditions.