-
Notifications
You must be signed in to change notification settings - Fork 47
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
feat: add request_values convenience, shows modal dialog to request values #416
Conversation
for more information, see https://pre-commit.ci
…into param-dialog
Codecov Report
@@ Coverage Diff @@
## main #416 +/- ##
==========================================
- Coverage 88.87% 88.81% -0.06%
==========================================
Files 30 30
Lines 3865 3917 +52
==========================================
+ Hits 3435 3479 +44
- Misses 430 438 +8
Continue to review full report at Codecov.
|
@tlambert03 this is cool, and the API is pretty succinct! The documentation for the widget type is nice, too. Do you have some use cases in mind? |
yes, i got thinking about this from the In general, this could be used by napari anytime a command requires parameters |
Gotcha, thanks. I think I'm just having a bit of trouble thinking through when to use Since the major benefit of this functionality is convenience, I keep wondering if it would be useful to allow a postprocessing routine in the signature. For example, if you picked up the size, content, dtype, etc. for the new image command, you could pass a function to But that seems to close to what |
yep, much more lightweight. makes no assumptions about what someone is doing with the values downstream. In general actually, I kinda think
I can see the potential usefulness there. maybe for a follow up PR though. Currently, since request_values blocks, you would just achieve it as follows: if values := request_values(...):
do_something_with_values(**values) |
I definitely agree, and may be guilty of this in napari-imagej 😅
Yup, definitely should not go in this PR, especially as I cannot imagine how I'd want the API for that to look. Do you need to specify the output types of the Maybe we could add a modal option for |
adds
magicgui.widgets.show_values_dialog
which lets you show a modal dialog to retrieve a set of values from the userother examples: