From 84ad7331b3c8efa929118f897fbdbb61d1c0535e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fa=C5=82ek?= Date: Thu, 30 Jan 2020 15:43:56 +0100 Subject: [PATCH] Use windowTitle instead of getModel in _cleaunup_panel If someone tries to setModel on not exported or somehow broken device, getModel returns empty string and TaurusDevicePanels is broken, so after trying to close the widget, it cannot find and remove it. Then, after reopening (even with restarted device) the panel, it finds broken widget again and doesn't try to open the new one. `Name` is also used for setting window title and in this case it's always the same. --- svgsynoptic2/taurussynopticwidget.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/svgsynoptic2/taurussynopticwidget.py b/svgsynoptic2/taurussynopticwidget.py index 0e57c02..7a09406 100755 --- a/svgsynoptic2/taurussynopticwidget.py +++ b/svgsynoptic2/taurussynopticwidget.py @@ -305,8 +305,8 @@ def _cleanup_panel(self, w): become pretty bogged down.""" if self.registry: with self.registry.lock: - print "cleaning up panel for", w.getModel(), "..." - self._panels.pop(str(w.getModel()).lower(), None) + print "cleaning up panel for", w.windowTitle(), "..." + self._panels.pop(str(w.windowTitle()).lower(), None) w.setModel(None) print "done!"