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> Acked-by: Manuel Quiñones <manuq@laptop.org>
This commit is contained in:
parent
9c230ea498
commit
6a01d9228d
@ -1150,9 +1150,9 @@ class WidgetInvoker(Invoker):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def __click_event_cb(self, button):
|
def __click_event_cb(self, button):
|
||||||
if self.props.lock_palette:
|
if self.props.lock_palette and not self.locked:
|
||||||
if not self.locked:
|
|
||||||
self.locked = True
|
self.locked = True
|
||||||
|
if hasattr(self.parent, 'set_expanded'):
|
||||||
self.parent.set_expanded(True)
|
self.parent.set_expanded(True)
|
||||||
|
|
||||||
if self.props.toggle_palette:
|
if self.props.toggle_palette:
|
||||||
@ -1160,6 +1160,11 @@ class WidgetInvoker(Invoker):
|
|||||||
|
|
||||||
def __button_release_event_cb(self, widget, event):
|
def __button_release_event_cb(self, widget, event):
|
||||||
if event.button == 1 and not self._click_hid:
|
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:
|
if self.props.toggle_palette:
|
||||||
self.notify_toggle_state()
|
self.notify_toggle_state()
|
||||||
elif event.button == 3:
|
elif event.button == 3:
|
||||||
|
Loading…
Reference in New Issue
Block a user