|
|
| Line 36: |
Line 36: |
| == Toolbar == | | == Toolbar == |
|
| |
|
| === Toolbar icons ===
| | FIELD_MESSAGE_boboget |
| | |
| Setting a standard Sugar toolbar.
| |
| from sugar.activity import activity
| |
| ...
| |
| class MyActivity(activity.Activity):
| |
| ...
| |
| toolbox = activity.ActivityToolbox(self)
| |
| self.set_toolbox(toolbox)
| |
| toolbox.show()
| |
| | |
| Adding a custom toolbar and icons.
| |
| from sugar.graphics.toolbutton import ToolButton
| |
| from sugar.activity import activity
| |
| ...
| |
| class MyActivity(activity.Activity):
| |
| ...
| |
| mytoolbox = gtk.Toolbar()
| |
| helpbut = ToolButton('help') #Stock help icon
| |
| helpbut.set_tooltip(_("Get help"))
| |
| helpbut.connect('clicked', self.help_button_pressed)
| |
| mytoolbox.insert(helpbut, -1)
| |
| helpbut.show()
| |
| mytoolbox.show()
| |
|
| |
| toolbox = activity.ActivityToolbox(self)
| |
| toolbox.add_toolbar("mytoolbar",mytoolbox)
| |
| self.set_toolbox(toolbox)
| |
| toolbox.show()
| |
| | |
| In addition to the standard icons in /usr/share/icons/sugar/scalable/ (eg, "go-next"), you can create additional icons by putting an svg in your activity's icons/ directory. E.g.,
| |
| icons/my-icon.svg
| |
| And then use it.
| |
| mybut = ToolButton('my-icon')# without extension
| |
|
| |
|
| == Files == | | == Files == |