From b3048112d67db0c4901c49bf366d43e55d9b2fd5 Mon Sep 17 00:00:00 2001 From: Simon Schampijer Date: Thu, 14 Mar 2013 12:00:22 +0100 Subject: [PATCH] Palette: handle the case where setting the transient window does fail, SL #4221 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The expected parent window did likely change, for example this can happen when we switch the Home Views while a Palette of a canvas icon is popping up (SL #4221). In that case send the 'popdown' signal so that for example the hovering state feedback can be cleared. Signed-off-by: Simon Schampijer Acked-by: Manuel QuiƱones --- src/sugar3/graphics/palettewindow.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/sugar3/graphics/palettewindow.py b/src/sugar3/graphics/palettewindow.py index c48ae55e..995e2581 100644 --- a/src/sugar3/graphics/palettewindow.py +++ b/src/sugar3/graphics/palettewindow.py @@ -623,7 +623,13 @@ class PaletteWindow(GObject.GObject): self._alignment = self._invoker.get_alignment(full_size_request) self.update_position() - self._widget.set_transient_for(self._invoker.get_toplevel()) + try: + self._widget.set_transient_for(self._invoker.get_toplevel()) + except TypeError: + # the expected parent window did likely change e.g. SL #4221 + # popdown the Palette + self.emit('popdown') + return self._popdown_anim.stop()