Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARC dev branch #4

Merged
merged 27 commits into from
Jul 10, 2024
Merged

ARC dev branch #4

merged 27 commits into from
Jul 10, 2024

Conversation

willGraham01
Copy link
Contributor

@willGraham01 willGraham01 commented Jun 18, 2024

Before submitting a pull request (PR), please read the contributing guide.

Please fill out as much of this template as you can, but if you have any problems or questions, just leave a comment and we will help out :)

Description

What is this PR

  • Bug fix
  • Addition of a new feature
  • Other

Why is this PR needed?

Intended to remain as a draft for quick comparison between ARC development and the current state of main. It also means that any test workflows added to main will automatically be run on this branch too.

Recommended to break convention here and just merge this PR rather than squash and merge. The commit history is already modular thanks to the ways of working that were adopted during the development period, though a squash merge would also be acceptable if we want to view this PR as providing an "alpha" version of the plugin.

What does this PR do?

Implements group layers! For more details, one should review the README and the commit log (and then head to the relevant PRs). However, key features include:

  • Creation of a group layers widget, intended to replace the old layer-list viewer for interacting with layers
  • Layers can be selected and reorganised into groups and subgroups in the new viewer
  • Selected layers appear in the corresponding widget controls
  • Changes made in the group layers view (including layer order, names, etc) will be reflected in the old viewer for consistency.

Note that some development features, notably the tests/blobs.py script and enter_debug methods for the main widget are still present.

References

#1

How has this PR been tested?

A testing framework has been built up and included in the development work, and so comes in with this PR.

Is this a breaking change?

No

Does this PR require an update to the documentation?

Yes, though again this is provided along with the new method.

We should probably write documentation as part of this.

Checklist:

  • The code has been tested locally
  • Tests have been added to cover all new functionality (unit & integration)
  • The documentation has been updated to reflect any changes
  • The code has been formatted with pre-commit

Copy link

codecov bot commented Jun 19, 2024

Codecov Report

Attention: Patch coverage is 89.74895% with 49 lines in your changes missing coverage. Please review.

Project coverage is 89.66%. Comparing base (b5eec6f) to head (5f5a079).

Files Patch % Lines
src/napari_experimental/group_layer_delegate.py 67.27% 18 Missing ⚠️
src/napari_experimental/group_layer.py 92.30% 12 Missing ⚠️
src/napari_experimental/group_layer_qt.py 88.15% 9 Missing ⚠️
src/napari_experimental/group_layer_actions.py 88.37% 5 Missing ⚠️
src/napari_experimental/_widget.py 95.83% 2 Missing ⚠️
src/napari_experimental/group_layer_node.py 94.11% 2 Missing ⚠️
src/napari_experimental/group_layer_controls.py 98.46% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main       #4      +/-   ##
==========================================
- Coverage   93.87%   89.66%   -4.21%     
==========================================
  Files           2        8       +6     
  Lines          49      484     +435     
==========================================
+ Hits           46      434     +388     
- Misses          3       50      +47     

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

willGraham01 and others added 11 commits June 20, 2024 10:36
* Add workflow step to run tests on head of napari

* Add optional dependency on napari-latest which fetches napari from the git repo directly

* Create an optional install that uses HEAD of napari, add it to list of tests

* Add note that napari-latest install is available to README

* Update README.md

Co-authored-by: Alessandro Felder <alessandrofelder@users.noreply.github.com>

---------

Co-authored-by: Alessandro Felder <alessandrofelder@users.noreply.github.com>
* Add conftest.py for shared fixtures and do a quick model check for our QtGroupLayerModel

* Typehints don't carry through fixtures
* allow renaming of groups and layers

* keep prefix for group layers and update setRoot

* remove unused tree_model

* add initial tests for renaming

* add test for editing state on double click

* move tests into test_group_layer_widget
* Ensure GroupLayer subclasses from our own subclass of Node

* Define ambiguously inherited attributes (IE ensure I don't break KM's tests)

* Actually use the nested structure fixture so ruff doesn't get angry

* Reorganise the test suite fixture layout since it's starting to get bloated

* Basic tests to check is_group and strict typing

* Self-review

* Allow _check_if_already_tracking to be optionally recursive. Write test for method.

* Update src/napari_experimental/group_layer.py

Co-authored-by: Kimberly Meechan <24316371+K-Meech@users.noreply.github.com>

* Dammit linter

---------

Co-authored-by: Kimberly Meechan <24316371+K-Meech@users.noreply.github.com>
* add group layer controls

* fix controls for latest changes to group layer

* remove syncing of selection

* add tests for group layer controls

* fix TypeError

* expand docstrings

* react to sub-groups
* Allow group_layer to return a flat index

* Enforce layer order updates through the GroupLayer events

* Rework how items are added to GroupLayers to make things more explicit

* Remove unused function

* Docstring Tidy (#27)

* Some docstrings for _widget

* Docstrings for GroupLayerNode class

* docstrings for group_layer_qt

* Docstrings for group_layer.py

* Add attributes and methods to classes where necessary

* Missed a rename

* Add tests for widget activity

* Test for layer deletion sync

* Ruff for 3.9 disagrees with 3.11

* strict keyword not in Py3.9
* Allow group_layer to return a flat index

* Enforce layer order updates through the GroupLayer events

* Rework how items are added to GroupLayers to make things more explicit

* Remove unused function

* Docstring Tidy (#27)

* Some docstrings for _widget

* Docstrings for GroupLayerNode class

* docstrings for group_layer_qt

* Docstrings for group_layer.py

* Add attributes and methods to classes where necessary

* Missed a rename

* Write method that fixes the min failing example

* Hey look, a docstring!

* Remove double-counting of positions after destination

* Test revise index method, remove redundant variable passed

* Maybe this is correct if I have a flat index sort a priori

* Fix ordering issue and allow for Groups to be assigned a flatindex

* Add 2nd test to check moving items out of different subgroups still tracks order correctly

* Remove un-necessary variable

* Remove commented-out experimental code

* Apply suggestions from @K-Meech code review
* MDLint + alessandrofelder -> brainglobe in README

* Create implementation deatils section

* Group and Node subclassing explanations

* Notes on indexing conventions

* Update README.md

Co-authored-by: Kimberly Meechan <24316371+K-Meech@users.noreply.github.com>

---------

Co-authored-by: Kimberly Meechan <24316371+K-Meech@users.noreply.github.com>
* add group layer delegate

* rename group layer delegate

* add context for right click menu

* working minimal right click menu

* fix syncing of selection

* update docstrings and remove unused functions

* fix double click edit

* simplify right click actions and context to fix tests

* update docstrings

* Force widget in tests to have a parent (#35)

* Allows toggling visibility of group layers (#30)

* toggle visiblity for group layers

* add tests for visiblity

* update docstrings

* fix failing tests

* remove logger and thumbnail role

* fix view controls when switching from group to layer

---------

Co-authored-by: Will Graham <32364977+willGraham01@users.noreply.github.com>
@willGraham01
Copy link
Contributor Author

@alessandrofelder I've opened #37 which fixes the issue with the automatic merge (it's an empty change because one commit was cherry-picked from main to ARC-dev-branch).

Once that's in, this PR will be merge-able into main, if you want to take the plunge 😬

willGraham01 and others added 3 commits July 8, 2024 14:36
* Fix seg-faults and broken drag-and-drop via overwriting index method

* Switch to unique ID trackers over reimplementing method. Allows safe overwride of __eq__ and __hash__

* Remove one bug from the README broken features section

---------

Co-authored-by: Alessandro Felder <alessandrofelder@users.noreply.github.com>
* Basic Sphinx build and docs structure

* Workflow to publish docs on pushes to main

* Separate sphinx requirements from package requirements

* Add building the docs section

* Reorganise group_layers docs

* Docs API for Groups & Nodes, some source docstring updates for text rendering

* Placeholder for widget docs

* Write widget docs page

* Add note on hashing things

* expand docs for group layers, delegates and context menu (#40)

---------

Co-authored-by: Kimberly Meechan <24316371+K-Meech@users.noreply.github.com>
@alessandrofelder alessandrofelder marked this pull request as ready for review July 10, 2024 12:48
Copy link
Member

@alessandrofelder alessandrofelder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Big thanks to @willGraham01 and @K-Meech for excellent work on this 🎉

@alessandrofelder alessandrofelder merged commit e3235c1 into main Jul 10, 2024
16 of 18 checks passed
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.

3 participants