Skip to content

refactor(structure_tree): consolidate StructureTreeModel into data_models and remove duplicate widget implementation#236

Open
Arbaaz123676 wants to merge 2 commits into
brainglobe:mainfrom
Arbaaz123676:refactor-structure-tree-model
Open

refactor(structure_tree): consolidate StructureTreeModel into data_models and remove duplicate widget implementation#236
Arbaaz123676 wants to merge 2 commits into
brainglobe:mainfrom
Arbaaz123676:refactor-structure-tree-model

Conversation

@Arbaaz123676

Copy link
Copy Markdown

Description

What is this PR

  • Bug fix
  • Addition of a new feature
  • Other (refactor)

Why is this PR needed?

The structure tree model (StructureTreeModel and StructureTreeItem) was previously defined in both data_models/structure_tree_model.py and widgets/structure_view.py. This duplication increased maintenance
overhead and risk of inconsistent behaviour.

What does this PR do?

  • Removes duplicate model implementation from structure_view.py
  • Uses the canonical implementation from data_models/structure_tree_model.py
  • Updates imports to ensure a single source of truth for the structure tree model

References

Fixes: #232

How has this PR been tested?

  • Tested locally using napari
  • Verified atlas loads successfully
  • Structure tree renders, expands, and selection works as expected
  • Confirmed no runtime errors after refactor

Is this a breaking change?

No. This refactor does not change public APIs or user-facing behaviour.

Does this PR require an update to the documentation?

No documentation changes are required as functionality remains unchanged.

Checklist:

  • The code has been tested locally
  • The code has been formatted with pre-commit

@Arbaaz123676

Copy link
Copy Markdown
Author

@IgorTatarnikov I have consolidated StructureTreeModel into data_models/structure_tree_model.py and removed the duplicate from structure_view.py, with all changes validated locally in napari. I’m happy to make additional changes required.

@codecov

codecov Bot commented Feb 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.02%. Comparing base (4cea26a) to head (58f7740).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #236      +/-   ##
==========================================
+ Coverage   97.03%   98.02%   +0.99%     
==========================================
  Files          14       14              
  Lines         640      556      -84     
==========================================
- Hits          621      545      -76     
+ Misses         19       11       -8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@alessandrofelder alessandrofelder self-requested a review April 30, 2026 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactoring

1 participant