EventEmitter loop in napari dock widget
See original GitHub issueDescribe the bug
RuntimeError: EventEmitter loop detected! occurs, although events should be blocked (as far as I understand).
ERROR:root:Unhandled exception:
Traceback (most recent call last):
File "/home/uwe/research/stardist/napari/magicgui/magicgui/widgets/_bases/value_widget.py", line 44, in <lambda>
lambda *x: self.changed(value=x[0] if x else None)
File "/home/uwe/research/stardist/napari/magicgui/magicgui/events.py", line 576, in __call__
raise RuntimeError("EventEmitter loop detected!")
RuntimeError: EventEmitter loop detected!
To Reproduce
Code for simple napari dock widget (bug is triggered when entering lowercase characters for param):
from napari_plugin_engine import napari_hook_implementation
from magicgui import magic_factory
def to_upper(event):
val = str(event.value)
if val != val.upper():
with event.source.changed.blocker():
event.source.value = val.upper()
def widget_init(widget):
widget.param.changed.connect(to_upper)
@magic_factory(widget_init=widget_init)
def widget(param: str):
pass
@napari_hook_implementation
def napari_experimental_provide_dock_widget():
return widget
Expected behavior
No RuntimeError: EventEmitter loop detected!.
Environment (please complete the following information):
- OS: Ubuntu 20.04 LTS
- magicgui version 0.2.7
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Starting the Event Loop - napari
Start a Qt event loop in which to run the application. napari.run(*[, force, gui_exceptions, ...]) Start the Qt Event Loop ...
Read more >Error when returning named shapes/surface layer multiple ...
Running a dock widget multiple times (i.e. pressing the call_button ) will cause an error with named shapes (and also surface , not...
Read more >Event emitter for deleting data within a layer (points, shapes ...
I have tried using viewer.active_layer.events.data.connect(my_callback) (similar to what is mentioned here An Introduction to the Event Loop in ...
Read more >napari: a multi-dimensional image viewer for Python - Zenodo
To specify a plugin in a Python script: import napari viewer = napari. ... </li> <li>Allow resizing left dock widgets (#4368)< ...
Read more >Turning napari GUI into plugins (Part 4) - GitHub Pages
Putting your GUI into the template. Now we will modify the code to add our widgets. In Github Desktop, let's create a separate...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

FYI, it also happens with
@magicguiand a wrapper function:as long as I can reproduce somewhere, I can probably fix it in both If I remember correctly, it had something to do with the order of connecting events… (though that shouldn’t matter).