From fc53bf86676fd80a4be6fecf953364da4eb991ce Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Thu, 31 May 2007 09:30:16 +0000 Subject: Support icons inside the activity --- diff --git a/sugar/activity/activityfactoryservice.py b/sugar/activity/activityfactoryservice.py index 4f61423..ea0ff8c 100644 --- a/sugar/activity/activityfactoryservice.py +++ b/sugar/activity/activityfactoryservice.py @@ -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() diff --git a/sugar/activity/bundle.py b/sugar/activity/bundle.py index 9410f24..df67601 100644 --- a/sugar/activity/bundle.py +++ b/sugar/activity/bundle.py @@ -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 diff --git a/sugar/graphics/toolbutton.py b/sugar/graphics/toolbutton.py index 2f6e9bf..1967dd0 100644 --- a/sugar/graphics/toolbutton.py +++ b/sugar/graphics/toolbutton.py @@ -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() -- cgit v0.9.1