Enable Return press on "keyboardable" widgets to call the wrapped function
While reviewing imagej/napari-imagej#70, @ctrueden was hoping that pressing Return while focusing on a keyboardable component of a magicgui widget would call the function with the current inputs. Specifically, he noted:
Pressing enter while one of the widget's components is focused, or while the Run button is focused, does not execute the module.
This is a problem that is seemingly better solved here.
For example, suppose I wrote the following widget:
@magic_factory()
def example_magic_widget(b: int) -> List["napari.types.LayerDataTuple"]:
return [(np.ones((4, 4)), {'name': f"foo{i}"}) for i in range(b)]
This generates the following widget in napari:
It might be nice that, while focused on/editing the b parameter, pressing Return would call the wrapped function.
Do you have more to add @ctrueden?
Nope, I think that about sums it up. Thanks @gselzer!