Development Team/Almanac/sugar.activity.activity: Difference between revisions
No edit summary |
|||
| Line 14: | Line 14: | ||
== Class: ActivityToolbar == | == Class: ActivityToolbar, ActivityToolbox == | ||
=== What is the standard toolbar needed in most activities and how do I create it? === | === What is the standard toolbar needed in most activities and how do I create it? === | ||
| Line 26: | Line 26: | ||
self.set_toolbox(toolbox) | self.set_toolbox(toolbox) | ||
toolbox.show() | toolbox.show() | ||
== Class: EditToolbar == | |||
=== How do I add a standard edit toolbar to my activity? === | |||
The activity package has a standard edit toolbar with the following Members: | |||
* undo -- the undo button | |||
* redo -- the redo button | |||
* copy -- the copy button | |||
* paste -- the paste button | |||
* separator -- A separator between undo/redo and copy/paste | |||
You can create a standard edit tool bar using code similar to the following in the __init__ method of your activity's class after you have created a toolbox: | |||
#### EDIT TOOLBAR | |||
# Create the edit toolbar: | |||
self._edit_toolbar = activity.EditToolbar() | |||
# Add the edit toolbar: | |||
toolbox.add_toolbar(_('Edit'), self._edit_toolbar) | |||
# And make it visible: | |||
self._edit_toolbar.show() | |||