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

We need more robust user-edit signals from items in a layer #34

Open
cudmore opened this issue May 20, 2022 · 0 comments
Open

We need more robust user-edit signals from items in a layer #34

cudmore opened this issue May 20, 2022 · 0 comments

Comments

@cudmore
Copy link
Member

cudmore commented May 20, 2022

As the user interacts with "layers", we can receive emitted events such as:

  • inserting (layer)
  • inserted (layer)
  • removing (layer)
  • removed (layer)

We need similar events for "items" in points and shapes layers (maybe labels layers).

This will allow plugins to be more interactive. Currently, plugins that interact with a layers "items" behave more like "batch" scripts and do not take into account edits made to the layer such as "items" added and deleted. Napari needs to emit a full set of editing signals such that plugins can easily implement a CRUD interface to create, read, update, and delete.

Thing like:

  • 'item about to be added'
  • 'item about to be deleted'.

Useful outcomes of this king of (proposed) event system are that analysis pipelines can:

  1. Update in response to edits
  2. Reject edits if the state of the plugin should not allow a given edit. For example, an event like "item about to be added" can be rejected.
  3. We can implement "undo" for edits such ass (add, delete, move). SUPER USEFULL for NAPARi !!!

Proposal

For each layer, we need (add, delete, select) events:

  • add

    • adding: about to add **
    • added: have been added
  • delete

    • deleting: about to delete **
    • deleted: have been deleted
  • select

    • selecting: about to select **
    • selected: have been selected

** plugin can reject add, delete, select if its internal state should not allow it.

Notes

This is where vispy responds to highlight event

# connects to signal
self.layer.events.highlight.connect(self._on_highlight_change)

# respond to signal
napari._vispy.layers.points.VispyPointsLayer._on_highlight_change
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

No branches or pull requests

1 participant