tab_datasource
freecad.datamanager_wb.domain.tab_datasource
¶
Tab data source protocol used by the generic tab controller.
Defines the TabDataSource protocol along with shared dataclasses used for
remove-unused operations across different tabs (VarSets and Aliases).
PostRemoveUpdate(child_items, clear_expressions)
dataclass
¶
UI update instructions after a remove-unused mutation.
The generic controller computes a new list of child items (after filtering) and whether the expressions list should be cleared.
Attributes:
| Name | Type | Description |
|---|---|---|
child_items |
list[ParentChildRef]
|
The filtered list of child refs that should be shown. |
clear_expressions |
bool
|
Whether the expressions list should be cleared. |
RemoveUnusedAndUpdateResult(remove_result, update)
dataclass
¶
RemoveUnusedResult(removed, still_used, failed)
dataclass
¶
Outcome of a remove-unused operation.
Attributes:
| Name | Type | Description |
|---|---|---|
removed |
list[str]
|
Child identifiers that were removed successfully. |
still_used |
list[str]
|
Child identifiers that were not removed because they were found to still have expression references. |
failed |
list[str]
|
Child identifiers that could not be removed due to parsing, document errors, or other failures. |
TabDataSource
¶
Protocol implemented by each tab's data backend.
The TabController is pure, tab-generic logic. It depends on this protocol
to obtain parents/children, compute expression references, and perform the
remove-unused mutation.
Implementations should treat string child identifiers as the canonical
Parent.Child form used by the UI.
get_child_refs(selected_parents)
¶
get_expression_items(selected_children)
¶
Return expression items and per-child reference counts.
Returns:
| Type | Description |
|---|---|
list[ExpressionItem]
|
A tuple of: |
dict[str, int]
|
|
tuple[list[ExpressionItem], dict[str, int]]
|
|
Source code in freecad/datamanager_wb/domain/tab_datasource.py
get_expression_reference_counts(selected_children)
¶
Return only the reference counts for selected children.
get_sorted_parents(*, exclude_copy_on_change=False)
¶
Return parent names sorted for display.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exclude_copy_on_change
|
bool
|
Whether to filter out parents that belong to copy-on-change groups (domain-specific). |
False
|
Source code in freecad/datamanager_wb/domain/tab_datasource.py
remove_unused_children(selected_children)
¶
Remove the selected children if they are unused.
Implementations must not remove items that still have expression references.