Ticket #4008: 0001-Follow-up-fixes-for-the-lockable-Palette-support.patch

File 0001-Follow-up-fixes-for-the-lockable-Palette-support.patch, 1.8 KB (added by erikos, 11 years ago)

follow up fixes for toolkit

  • src/sugar3/graphics/palettewindow.py

    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): 
    11501150        return False
    11511151
    11521152    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'):
    11561156                self.parent.set_expanded(True)
    11571157
    11581158        if self.props.toggle_palette:
    class WidgetInvoker(Invoker): 
    11601160
    11611161    def __button_release_event_cb(self, widget, event):
    11621162        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
    11631168            if self.props.toggle_palette:
    11641169                self.notify_toggle_state()
    11651170        elif event.button == 3: