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

Add callback for device (un)loaded #149

Open
ianhi opened this issue Feb 18, 2022 · 3 comments · May be fixed by #163
Open

Add callback for device (un)loaded #149

ianhi opened this issue Feb 18, 2022 · 3 comments · May be fixed by #163

Comments

@ianhi
Copy link
Contributor

ianhi commented Feb 18, 2022

I was looking at disabling or enabling gui elements in napari-micromanager depending on whether certain devices are loaded (https://github.com/tlambert03/napari-micromanager/pull/99) and it seems to me that this would be made much easier if there were the following callabcks were added:

deviceLoaded(device, deviceType)
deviceUnloaded(device, deviceType)

In the case of napari-micromanager this is important because state can be modified either through the GUI or by a user from a script (e..g jupyter). I imagine that this could also be helpful for a user of pycromanager where the same issue can arise.

cc @tlambert03 and @fdrgsp

@marktsuchida
Copy link
Member

I think they should be onDeviceLoaded but onDeviceWillBeUnloaded, because you probably want to stop observing the device before it gets unloaded.

@ianhi
Copy link
Contributor Author

ianhi commented Feb 28, 2022

@marktsuchida how does adding this here fit in with you thoughts in #150 (comment) ?

@ianhi ianhi linked a pull request Feb 28, 2022 that will close this issue
@marktsuchida
Copy link
Member

Actually these events cannot be generated by the app, because they can happen while loading a config file, or unloading all devices. I think it in fact makes a lot of sense to add these.

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 a pull request may close this issue.

2 participants