Ticket #4221: 0001-Palette-handle-the-case-where-setting-the-transient-.patch

File 0001-Palette-handle-the-case-where-setting-the-transient-.patch, 1.4 KB (added by erikos, 11 years ago)

Palette: handle the case where setting the transient window does fail

  • src/sugar3/graphics/palettewindow.py

    From 6ab2d01435722abba94849d944cccee222074923 Mon Sep 17 00:00:00 2001
    From: Simon Schampijer <simon@laptop.org>
    Date: Thu, 14 Mar 2013 12:00:22 +0100
    Subject: [PATCH] Palette: handle the case where setting the transient window
     does fail, SL #4221
    
    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 <simon@laptop.org>
    ---
     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 c48ae55..995e258 100644
    a b class PaletteWindow(GObject.GObject): 
    623623            self._alignment = self._invoker.get_alignment(full_size_request)
    624624
    625625            self.update_position()
    626             self._widget.set_transient_for(self._invoker.get_toplevel())
     626            try:
     627                self._widget.set_transient_for(self._invoker.get_toplevel())
     628            except TypeError:
     629                # the expected parent window did likely change e.g. SL #4221
     630                # popdown the Palette
     631                self.emit('popdown')
     632                return
    627633
    628634        self._popdown_anim.stop()
    629635