[Sugar-devel] [PATCH] Sugar-toolkit: Pack page in ToolbarButton when is conected to the window - OLPC #10930
godiard at sugarlabs.org
godiard at sugarlabs.org
Mon Jul 11 12:08:50 EDT 2011
From: Gonzalo Odiard <godiard at gmail.com>
To initialize keybindings, the buttons in the toolbars need be attached
to the activity. This patch pack the page to the toolbarbutton when this is
added to the activity to enable the buttons keybindings initialization.
---
src/sugar/graphics/toolbarbox.py | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/src/sugar/graphics/toolbarbox.py b/src/sugar/graphics/toolbarbox.py
index b674e8d..7e6023f 100644
--- a/src/sugar/graphics/toolbarbox.py
+++ b/src/sugar/graphics/toolbarbox.py
@@ -36,6 +36,15 @@ class ToolbarButton(ToolButton):
self.connect('clicked',
lambda widget: self.set_expanded(not self.is_expanded()))
+ self.connect('hierarchy-changed', self._hierarchy_changed_cb)
+
+ def _hierarchy_changed_cb(self, tool_button, previous_toplevel):
+ if hasattr(self.parent, 'owner'):
+ if self.page_widget:
+ self._unparent()
+ self.parent.owner.pack_start(self.page_widget)
+ self.set_expanded(False)
+
def get_toolbar_box(self):
if not hasattr(self.parent, 'owner'):
return None
--
1.7.4.4
More information about the Sugar-devel
mailing list