diff options
author | Agustin Zubiaga <aguz@sugarlabs.org> | 2013-11-26 01:45:18 (GMT) |
---|---|---|
committer | Agustin Zubiaga <aguz@sugarlabs.org> | 2013-11-26 01:45:18 (GMT) |
commit | e2bf72c67996969b4d46d552e8f7b231f3d9e250 (patch) | |
tree | 9208535a0bdfb62b0ad39ecc4a85513baee5b88c | |
parent | 4320b06a2c41fb580ba0c68803c09e860b1a18c6 (diff) |
Add support for toolbutton accelerators
-rw-r--r-- | simpleactivity.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/simpleactivity.py b/simpleactivity.py index 9ea8694..3ae2d8f 100644 --- a/simpleactivity.py +++ b/simpleactivity.py @@ -131,8 +131,8 @@ class SimpleActivity(activity.Activity): return toolbar_btn.props.page - def add_toolbutton(self, icon=None, cb=None, tooltip=None, index=-1, - toolbar=None): + def add_toolbutton(self, icon=None, cb=None, tooltip=None, + accelerator=None, index=-1, toolbar=None): """ Creates a ToolButton and add it to the main toolbar or another. @@ -142,6 +142,7 @@ class SimpleActivity(activity.Activity): icon: The name of the icon you want to use callback: The method you want to call when the button is clicked tooltip: The tooltip you want to show + accelerator: An accelerator to use index: The place of the toolbar you want to take toolbar: The toolbar where you want to add this button If you do not give this parameter, it will use the main @@ -153,6 +154,9 @@ class SimpleActivity(activity.Activity): """ toolbutton = ToolButton(icon) if icon is not None else ToolButton() + if accelerator is not None: + toolbutton.props.accelerator = accelerator + if cb is not None: toolbutton.connect('clicked', cb) |