From 28c891bb89bb0e5556f9359bc7d5b186da0976bc Mon Sep 17 00:00:00 2001 From: Tolonen Luka Date: Sun, 6 Oct 2024 15:08:32 +0300 Subject: [PATCH] Quick fix for a bug in preferences.py. The bug occurs when changing the tracker, after which preferences cannot be closed normally (pressing OK will cause a wx error and preferences won't close). You'll see preferences is re-opened (hidden and shown again) when the tracker is changed. This behavior is probably the cause of the bug... This commit is a quick fix that ignores the source of the bug --- invesalius/gui/preferences.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/invesalius/gui/preferences.py b/invesalius/gui/preferences.py index fa7e6eab2..37ba95cb5 100644 --- a/invesalius/gui/preferences.py +++ b/invesalius/gui/preferences.py @@ -92,7 +92,10 @@ def __bind_events(self): def OnOK(self, event): Publisher.sendMessage("Save Preferences") - self.EndModal(wx.ID_OK) + try: + self.EndModal(wx.ID_OK) + except wx._core.wxAssertionError: + self.Destroy() def OnCharHook(self, event): if event.GetKeyCode() == wx.WXK_ESCAPE: