Interactive dialog box for napari IO plugin


I’m trying to write a plugin for napari for general HDF5 import. (I found GitHub - portugueslab/napari-hdf5, but the project looks inactive). I think it would be helpful to show a dialog box to ask the dataset to read (as HDF5 import in Fiji), but I couldn’t find any documentation or examples for that kind of dialog box with magicgui. Could anyone suggest me an option for that purpose? Do I need to use raw Qt, or would there be any better method?

I did add a file dialog widget to magicgui a while ago, is something like this what you’re after?

You’re right, there’s not a lot of documentation about how to use stuff yet. The best suggestion I have right now is to look at the examples/

Does that help get you started?

1 Like

Hello @GenevieveBuckley, thank you for your reply! I truly appreciate.
Thank you for suggesting the Filedialog widget and the examples, I love the idea of easy integration by magicgui. What I’m wondering to make is something like the attached image, and I will try if it is possible to get the dialog shown using as in the example from the plugin. I would like to “block” the plugin code until it gets parameters from the dialog (since it needs to return the read image). Do you think it is possible?

1 Like

Could you use the magicgui “call button” to effectively block execution of the next steps until everything is ready?

The Snell’s law example in the readme here has an example of this. By decorating the function this way, it won’t run this function until the “calculate” button is clicked.

@magicgui(call_button="calculate", result_widget=True)
def snells_law(...

Thank you for your reply, it seems that I somehow overlooked this …
I think that helps me a lot to build that plugin. Thanks a lot!