From 6a01d9228d9fe8d01b9b4e202803c7733994b1a8 Mon Sep 17 00:00:00 2001 From: Simon Schampijer Date: Fri, 23 Nov 2012 10:26:51 +0100 Subject: [PATCH] Follow up fixes for the lockable Palette support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - do not call set_expanded when the parent does not have that attribute, this is the case in the custom abacus Palette in the Abacus activity - add the same code in the button release event callback that we have as well in the click event callback Signed-off-by: Simon Schampijer Acked-by: Manuel QuiƱones --- src/sugar3/graphics/palettewindow.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/sugar3/graphics/palettewindow.py b/src/sugar3/graphics/palettewindow.py index cadb4fee..70636817 100644 --- a/src/sugar3/graphics/palettewindow.py +++ b/src/sugar3/graphics/palettewindow.py @@ -1150,9 +1150,9 @@ class WidgetInvoker(Invoker): return False def __click_event_cb(self, button): - if self.props.lock_palette: - if not self.locked: - self.locked = True + if self.props.lock_palette and not self.locked: + self.locked = True + if hasattr(self.parent, 'set_expanded'): self.parent.set_expanded(True) if self.props.toggle_palette: @@ -1160,6 +1160,11 @@ class WidgetInvoker(Invoker): def __button_release_event_cb(self, widget, event): if event.button == 1 and not self._click_hid: + if self.props.lock_palette and not self.locked: + self.locked = True + if hasattr(self.parent, 'set_expanded'): + self.parent.set_expanded(True) + if self.props.toggle_palette: self.notify_toggle_state() elif event.button == 3: