Support icons inside the activity

master
Marco Pesenti Gritti 17 years ago
parent 9ea6b18027
commit fc53bf8667

@ -152,6 +152,8 @@ def run(bundle_path):
bundle.get_locale_path())
gettext.textdomain(bundle.get_service_name())
gtk.icon_theme_get_default().append_search_path(bundle.get_icons_path())
os.environ['SUGAR_BUNDLE_PATH'] = bundle_path
os.environ['SUGAR_BUNDLE_SERVICE_NAME'] = bundle.get_service_name()
os.environ['SUGAR_BUNDLE_NAME'] = bundle.get_name()

@ -139,6 +139,10 @@ class Bundle:
"""Get the locale path inside the activity bundle."""
return os.path.join(self._path, 'locale')
def get_icons_path(self):
"""Get the icons path inside the activity bundle."""
return os.path.join(self._path, 'icons')
def get_path(self):
"""Get the activity bundle path."""
return self._path

@ -21,12 +21,12 @@ from sugar.graphics.icon import Icon
from sugar.graphics.palette import *
class ToolButton(gtk.ToolButton):
def __init__(self, named_icon=None):
def __init__(self, icon_name=None):
gtk.ToolButton.__init__(self)
self.set_named_icon(named_icon)
self.set_icon(icon_name)
def set_named_icon(self, named_icon):
icon = Icon(named_icon)
def set_icon(self, icon_name):
icon = Icon(icon_name)
self.set_icon_widget(icon)
icon.show()

Loading…
Cancel
Save