-
Notifications
You must be signed in to change notification settings - Fork 49
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
After update to 0.7.0 magicgui stop handling optional return #541
Comments
thanks @Czaki, good find. I'd say that calling a callback that was registered for I think this line here was allowing for It's something of a tricky situation I guess, since I wouldn't have knowingly opted to provide implicit support for calling a callback that says it needs a So, we've got a few options now (let me know what you prefer):
my preference is probably number three... is that ok with you? |
I also like this option. But maybe it should not be done in a way that will force napari to support only latest magicgui (but maybe a set off if will be enough). I will first implement 1 to test it But I like conversion to 3. |
yeah, I agree... whatever solution we come up with should not require napari to bump it's version requirement |
but it may be just |
Also type annotation should accept Types generic ( Currently mypy:
|
just thinking aloud here as I think about this topic (and will probably make a new issue for this). In retrospect, I think the # napari instantiates the widget somewhere
wdg = some_factory()
# connect callback:
if satisfies_some_condition(wdg.return_annotation):
wdg.called.connect(_mgui.add_layer_data_to_viewer)
# add it to the viewer
viewer.window.add_dock_widget(wdg) that will definitely require a gradual deprecation, but as I think about the complexities of processing return annotation types (e.g. do we support subtypes? etc...) i think it's probably better to remove that feature rather than elaborate upon it |
Describe the bug
A clear and concise description of what the bug is.
Up to version 0.6.1, it is possible to annotate
Optional[ImageData]
, and it works without problems.Since 0.7.0 the
magicgui/src/magicgui/widgets/_function_gui.py
Line 342 in b675ca9
does not return
add_layer
callbackIs this a real bug change or an intentional change that needs to be handled on the napari side?
To Reproduce
Steps to reproduce the behavior:
Use test form this PR with magicgui 0.6.1 and 0.7.2
napari/napari#5595
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: