-
Notifications
You must be signed in to change notification settings - Fork 53
Open
Labels
bugSomething isn't workingSomething isn't working
Description
This relates to #674 as I'm testing guiclass
.
Code
from dataclasses import field
from magicgui.experimental import guiclass
@guiclass
class MyDataclass:
colors: list[str] = field(default_factory=list)
if __name__ == '__main__':
obj = MyDataclass()
obj.gui.show(run=True)
Environment (please complete the following information):
- OS: Ubuntu 22.04
- backend:
pyqt5-qt5==5.15.16
- magicgui version:
magicgui==0.10.0
Steps
- Run the app
- Click on the plus to add a new list item
- Click on the minus button
Result
Traceback (most recent call last):
File "src/psygnal/_signal.py", line 1279, in _run_emit_loop
File "src/psygnal/_signal.py", line 1308, in _run_emit_loop_immediate
File "src/psygnal/_weak_callback.py", line 355, in cb
File "/home/migwell/.local/share/QGIS/QGIS3/profiles/default/python/plugins/MultiBandRaster/.venv/lib/python3.10/site-packages/magicgui/widgets/_concrete.py", line 752, in _remove_me
self._pop_widget(self.index(widget))
File "/usr/lib/python3.10/_collections_abc.py", line 1080, in index
raise ValueError
ValueError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/migwell/.local/share/QGIS/QGIS3/profiles/default/python/plugins/MultiBandRaster/.venv/lib/python3.10/site-packages/magicgui/widgets/bases/_value_widget.py", line 69, in _on_value_change
self.changed.emit(value)
File "src/psygnal/_signal.py", line 1201, in emit
File "src/psygnal/_signal.py", line 1296, in _run_emit_loop
File "src/psygnal/_signal.py", line 1279, in _run_emit_loop
File "src/psygnal/_signal.py", line 1308, in _run_emit_loop_immediate
File "src/psygnal/_weak_callback.py", line 355, in cb
File "/home/migwell/.local/share/QGIS/QGIS3/profiles/default/python/plugins/MultiBandRaster/.venv/lib/python3.10/site-packages/magicgui/widgets/_concrete.py", line 752, in _remove_me
self._pop_widget(self.index(widget))
File "/usr/lib/python3.10/_collections_abc.py", line 1080, in index
raise ValueError
psygnal._exceptions.EmitLoopError:
While emitting signal 'magicgui.widgets.PushButton.changed', an error occurred in a callback:
ValueError:
------------
SIGNAL EMISSION:
/home/migwell/.local/share/QGIS/QGIS3/profiles/default/python/plugins/MultiBandRaster/.venv/lib/python3.10/site-packages/magicgui/backends/_qtpy/application.py:29 in _mgui_run
return app.exec_()
/home/migwell/.local/share/QGIS/QGIS3/profiles/default/python/plugins/MultiBandRaster/.venv/lib/python3.10/site-packages/magicgui/widgets/bases/_value_widget.py:69 in _on_value_change
self.changed.emit(value) # <-- SIGNAL WAS EMITTED HERE
CALLBACK CHAIN:
src/psygnal/_signal.py:1279 in _run_emit_loop
... 3 more frames ...
/usr/lib/python3.10/_collections_abc.py:1080 in index
raise ValueError # <-- ERROR OCCURRED HERE
Local variables:
value = _ListEditChildWidget(value='', annotation=None, name='')
start = 0
stop = None
i = 2
v = PushButton(value=False, annotation=None, name='plus')
[1] 759116 IOT instruction (core dumped)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working