-
-
Notifications
You must be signed in to change notification settings - Fork 784
Closed
Labels
bugA crash or error in behavior.A crash or error in behavior.
Description
Describe the bug
When a window is created upon the click of a button or other widget in a main window, IDs of widgets within that sub-window are not cleared, causing window creation and displaying to fail when the window is closed and re-opened.
Steps to reproduce
- Create any main window with some widget that instantiates and shows another window when the widget is pressed, clicked, etc.
- The sub-window should use widget IDs, such as paths (I use this format for determining which widget to update when a network event is received in my application).
- Close the window and try to re-open it. You will get an error along the lines of
KeyError: "There is already a widget with the id '/devices/0/inputs/0/sends/0/Gain/value'"
Expected behavior
Widget IDs should be cleared when the window is either closed, deleted, or otherwise ceases to exist.
Screenshots
No response
Environment
- Operating System: Windows 10 22H2 (AMD64) build 19045.4291
- Python version: 3.12.2
- Software versions:
- Briefcase: 0.3.17
- Toga: 0.4.2+
Logs
[19:49:53] Error in handler: "There is already a widget with the id '/devices/0/inputs/0/sends/0/Gain/value'" subprocess.py:681
Traceback (most recent call last): subprocess.py:681
File "C:\Users\ethin\source\venvs\uaccess\Lib\site-packages\toga\handlers.py", line 80, in _handler subprocess.py:681
result = handler(interface, *args, **kwargs) subprocess.py:681
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ subprocess.py:681
File "C:\Users\ethin\source\uaccess\src\uaccess\app.py", line 216, in open_sends subprocess.py:681
self.sends_dialogs[widget.id].build() subprocess.py:681
File "C:\Users\ethin\source\uaccess\src\uaccess\dialogs\sends_dialog.py", line 27, in build subprocess.py:681
self.sends_content.add(edit) subprocess.py:681
File "C:\Users\ethin\source\venvs\uaccess\Lib\site-packages\toga\widgets\base.py", line 100, in add subprocess.py:681
child.window = self.window subprocess.py:681
^^^^^^^^^^^^ subprocess.py:681
File "C:\Users\ethin\source\venvs\uaccess\Lib\site-packages\toga\widgets\base.py", line 227, in window subprocess.py:681
window.app.widgets._add(self) subprocess.py:681
File "C:\Users\ethin\source\venvs\uaccess\Lib\site-packages\toga\app.py", line 192, in _add subprocess.py:681
raise KeyError(f"There is already a widget with the id {widget.id!r}") subprocess.py:681
KeyError: "There is already a widget with the id '/devices/0/inputs/0/sends/0/Gain/value'" subprocess.py:681
Additional context
No response
Metadata
Metadata
Assignees
Labels
bugA crash or error in behavior.A crash or error in behavior.