[sugar] keyboard bindings for buttons and palettes

Tomeu Vizoso tomeu at tomeuvizoso.net
Tue Feb 26 08:06:32 EST 2008


have been thinking a bit about the best way to add key bindings
(accelerators) to activities and the shell, and have come up with a
proof of concept patch at:


For adding a Ctrl-B accelerator to the Back button in browse, we would
need to change the code in the following way:

-        self._back = ToolButton('go-previous-paired')
-        self._back.set_tooltip(_('Back'))
+        self._back = ToolButton('go-previous-paired', _('Back'), _('<Ctrl>B'))

The good:

- The labels and accelerators are set at the same time so they will
appear related when translating. Every language team can set its own
policy regarding accelerators.

The bad:

- Every widget will have to listen for 'hierarchy-changed' in order to
set the accelerator for the group of its top level window.

Can anybody think of a better way to do this? If not, I'll come with a
more refined patch and will ask for review. I think accelerators can
improve usability quite a bit.



More information about the Sugar mailing list