-
Notifications
You must be signed in to change notification settings - Fork 28
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
Add support for event callbacks #153
Comments
I cannot agree. You may install a plugin for only one widget and do not want to use all others things from the plugin. |
Agreed, I think a preference like "startup items", similar to an OS, would be useful for this. |
just going through some issues here. I'm not sure this particular use case makes as much sense in the declarative schema. I kinda picture an API where a plugin would receive an object that looked very much like # pass plugin an object, that can track what gets connected
event_subscriptions = pass_plugin_the_viewer_proxy(plugin, viewer_proxy)
# add a callback that can undo those event connections to the plugin context
plugin_context.register_disposable(subscriptions)
# when plugin is deactivated, `context._dispose()` gets called that will call all "undo" things |
Just creating this issue to discuss a way for plugins to register events that happen on specific callbacks. For example, in napari/napari#4361, @psobolewskiPhD wants to be able to reset the dims sliders whenever new images are added.
Adding an
on:
argument for commands that would trigger function calls whenever specific events happen seems like a pretty useful thing for plugins to do!Of course there's still questions about when these things get activated... I might argue that if I install a plugin that provides specific callbacks, I want it activated every time I launch napari. Or maybe this goes in plugin preferences?
The text was updated successfully, but these errors were encountered: