Skip to content

Commit 07b3873

Browse files
committed
fix(component editor): fixed the Tkinter callback exception that was occurring when the component editor window was closed before a delayed usage instructions popup could be displayed.
1 parent 991ceb4 commit 07b3873

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

ardupilot_methodic_configurator/frontend_tkinter_component_editor_base.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,10 @@ def _check_show_usage_instructions(self) -> None:
294294

295295
def _display_component_editor_usage_instructions(self, parent: tk.Tk) -> None:
296296
"""Display usage instructions for the component editor."""
297+
# Check if parent window still exists before showing popup
298+
if not parent.winfo_exists():
299+
return
300+
297301
# pylint: disable=duplicate-code
298302
usage_popup_window = BaseWindow(parent)
299303
style = ttk.Style()

tests/test_frontend_tkinter_component_editor_base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1742,6 +1742,7 @@ def test_user_sees_helpful_usage_instructions_on_first_use( # pylint: disable=t
17421742

17431743
# Create a mock Tk parent for testing
17441744
mock_parent = MagicMock()
1745+
mock_parent.winfo_exists.return_value = True
17451746

17461747
# Act: Display usage instructions
17471748
editor_for_usage_tests._display_component_editor_usage_instructions(mock_parent)

0 commit comments

Comments
 (0)