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

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

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
expand docs for group layers, delegates and context menu
  • Loading branch information
K-Meech committed Jul 9, 2024
commit 8debccaf571293d62126ab6484e3bee1379607e7
11 changes: 11 additions & 0 deletions docs/source/group_layers/classes/group_layer_and_nodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@ This is a safe property to use as the hash value since it fulfils all necessary
This in itself is a (semi-)desirable situation for us though: even if two `GroupLayer`s contain the same nested structure, name, etc, this does not mean they are identical in terms of how the user has decided to organise them within the tree structure.
However, care should be taken when comparing for identical `GroupLayer` instances - if you want to check equality of `GroupLayer` attributes, you will need to explicitly check these via `GroupLayer1.<attribute> == GroupLayer2.<attribute>`.

## Propagation of selection

Each `GroupLayer` within a tree has its own `.selection` containing a list of `GroupLayer` or `GroupLayerNode`.
These selected items can be at any level within the tree (not just restricted to direct children).

To keep selection changes synced at all levels in the tree, the `GroupLayer`'s `propagate_selection` function is called every time the selection changes.
This propagates the selection to any nested `Group Layer`s inside of it.
Note that this propagation only happens in one direction (from parents to children)!
Also, only the selected items are currently updated with `propagate_selection`.
This means that, for example, the 'active' selected item might not be synced correctly to other levels in the tree.

## API Reference

### `GroupLayerNode`
Expand Down
2 changes: 2 additions & 0 deletions docs/source/group_layers/implementation.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ The key classes implemented in this plugin are
- `GroupLayerNode`, `GroupLayer`: These are the Python classes that provide the tree-structure that group layers require. We expand on these below.
- `QtGroupLayerControls`, `QtGroupLayerControlsContainer`: These classes are used to build the "control box" that the plugin provides when selecting a layer within the plugin. For all intents and purposes it mimics the existing napari layer viewer context window, but also reacts when selecting a group layer.
- `QtGroupLayerModel`, `QtGroupLayerView`: These subclass from the appropriate Qt abstract classes, and provide the model/tree infrastructure for working with `GroupLayers`. Beyond this, they do not contain any remarkable functionality beyond patching certain methods for consistency with the data being handled / displayed.
- `GroupLayerDelegate`: handles display of thumbnails / icons on layers and group layers, as well as displaying the right click context menu.
- `GroupLayerActions`, `ContextMenu`: These classes are used to build the right click context menu. `GroupLayerActions` can be expanded to add more options to this menu.

You can navigate to the respective pages for further information on each of these classes:

Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ When a new version is released (tag on `main`) or a push to `main` occurs with c

## Contributing

You can report bugs and request features by [raising an issue](https://github.com/brainglobe/napari-experimental/issues/23) on the GitHub repository - we have a few templates to help you fill out an issue if you haven't done so before.
You can report bugs and request features by [raising an issue](https://github.com/brainglobe/napari-experimental/issues/) on the GitHub repository - we have a few templates to help you fill out an issue if you haven't done so before.

We follow the same [contribution guidelines](https://napari.org/stable/developers/index.html) as the napari project.
Contributions are welcome to any of the plugins via pull request, and will be subject to review from appropriate maintainers.
Expand Down