diff options
author | Rafael Ortiz <rafael@activitycentral.com> | 2011-07-08 15:43:35 (GMT) |
---|---|---|
committer | Rafael Ortiz <rafael@activitycentral.com> | 2011-07-08 15:43:35 (GMT) |
commit | a2e76e82caab5642350672b1e18096e9c5b6157e (patch) | |
tree | 41a8126982aeed148feb51dc40097acc8f03ba42 /terminal.py | |
parent | 4239129b57a51eb482fc1313fc1e6937c99580b8 (diff) |
fix for OLPC #10930 by Gonzalo odiard.
Diffstat (limited to 'terminal.py')
-rw-r--r-- | terminal.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/terminal.py b/terminal.py index 3008c40..b0aef58 100644 --- a/terminal.py +++ b/terminal.py @@ -109,6 +109,7 @@ class TerminalActivity(activity.Activity): self.set_toolbar_box(toolbar_box) toolbar_box.show() + self._update_accelerators(toolbar_box) self._notebook = Notebook() self._notebook.set_property("tab-pos", gtk.POS_TOP) @@ -119,6 +120,28 @@ class TerminalActivity(activity.Activity): self._create_tab(None) + def _update_accelerators(self, container): + for child in container.get_children(): + if isinstance(child, ToolButton): + if child.props.accelerator is not None: + # This code is copied from toolbutton.py + # to solve workaround bug described in OLPC #10930 + accel_group = self.get_data('sugar-accel-group') + keyval, mask = gtk.accelerator_parse( + child.props.accelerator) + # the accelerator needs to be set at the child, + # so the gtk.AccelLabel + # in the palette can pick it up. + child.child.add_accelerator('clicked', accel_group, + keyval, mask, + gtk.ACCEL_LOCKED | gtk.ACCEL_VISIBLE) + + if isinstance(child, ToolbarButton): + if child.get_page() is not None: + self._update_accelerators(child.get_page()) + if hasattr(child, 'get_children'): + self._update_accelerators(child) + def _create_edit_toolbar(self): edit_toolbar = activity.EditToolbar() edit_toolbar.undo.props.visible = False |