Changes
Jump to navigation
Jump to search
Line 36:
Line 36:
− === Toolbar icons ===+
−
− 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
Development Team/Almanac/Code Snippets (view source)
Revision as of 19:15, 16 December 2008
, 19:15, 16 December 2008FIELD_OTHER
== Toolbar ==
== Toolbar ==
FIELD_MESSAGE_boboget
== Files ==
== Files ==