From 9f981bb5dcabf6072db0faf4b791dc359d0393f1 Mon Sep 17 00:00:00 2001 From: Aleksey Lim Date: Fri, 18 Sep 2009 15:09:03 +0000 Subject: [PATCH] Color of sugar.activity.widgets.ActivityButton is owners all time despite of 'icon-color' metadata property #1368 --- src/sugar/activity/widgets.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/sugar/activity/widgets.py b/src/sugar/activity/widgets.py index 76ccd24f..75e99074 100644 --- a/src/sugar/activity/widgets.py +++ b/src/sugar/activity/widgets.py @@ -33,13 +33,17 @@ from sugar.bundle.activitybundle import ActivityBundle _ = lambda msg: gettext.dgettext('sugar-toolkit', msg) -def _create_activity_icon(): +def _create_activity_icon(metadata): + if 'icon-color' in metadata: + color = XoColor(metadata['icon-color']) + else: + client = gconf.client_get_default() + color = XoColor(client.get_string('/desktop/sugar/user/color')) + from sugar.activity.activity import get_bundle_path bundle = ActivityBundle(get_bundle_path()) - - client = gconf.client_get_default() - color = XoColor(client.get_string('/desktop/sugar/user/color')) icon = Icon(file=bundle.get_icon(), xo_color=color) + return icon @@ -48,7 +52,7 @@ class ActivityButton(ToolButton): def __init__(self, activity, **kwargs): ToolButton.__init__(self, **kwargs) - icon = _create_activity_icon() + icon = _create_activity_icon(activity.metadata) self.set_icon_widget(icon) icon.show() @@ -67,7 +71,7 @@ class ActivityToolbarButton(ToolbarButton): ToolbarButton.__init__(self, page=toolbar, **kwargs) - icon = _create_activity_icon() + icon = _create_activity_icon(activity.metadata) self.set_icon_widget(icon) icon.show()