From 9d3a0759ad4d13ac970ff248a602dc14956f5e70 Mon Sep 17 00:00:00 2001
From: Simon Schampijer <simon@laptop.org>
Date: Fri, 23 Nov 2012 10:26:51 +0100
Subject: [PATCH toolkit-gtk3] Follow up fixes for the lockable Palette
support
- 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 <simon@laptop.org>
---
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 cadb4fe..7063681 100644
a
|
b
|
class WidgetInvoker(Invoker): |
1150 | 1150 | return False |
1151 | 1151 | |
1152 | 1152 | def __click_event_cb(self, button): |
1153 | | if self.props.lock_palette: |
1154 | | if not self.locked: |
1155 | | self.locked = True |
| 1153 | if self.props.lock_palette and not self.locked: |
| 1154 | self.locked = True |
| 1155 | if hasattr(self.parent, 'set_expanded'): |
1156 | 1156 | self.parent.set_expanded(True) |
1157 | 1157 | |
1158 | 1158 | if self.props.toggle_palette: |
… |
… |
class WidgetInvoker(Invoker): |
1160 | 1160 | |
1161 | 1161 | def __button_release_event_cb(self, widget, event): |
1162 | 1162 | if event.button == 1 and not self._click_hid: |
| 1163 | if self.props.lock_palette and not self.locked: |
| 1164 | self.locked = True |
| 1165 | if hasattr(self.parent, 'set_expanded'): |
| 1166 | self.parent.set_expanded(True) |
| 1167 | |
1163 | 1168 | if self.props.toggle_palette: |
1164 | 1169 | self.notify_toggle_state() |
1165 | 1170 | elif event.button == 3: |