From 445741588be6a7be3f5a3b6214d170d94eee9fa9 Mon Sep 17 00:00:00 2001
From: Aleksey Lim <alsroot@member.fsf.org>
Date: Thu, 17 Sep 2009 23:11:29 +0000
Subject: Color of sugar.activity.widgets.ActivityButton is owners all time despite of 'icon-color' metadata property #1368
---
src/sugar/activity/widgets.py | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/sugar/activity/widgets.py b/src/sugar/activity/widgets.py
index 76ccd24..75e9907 100644
a
|
b
|
from sugar.bundle.activitybundle import ActivityBundle |
33 | 33 | _ = lambda msg: gettext.dgettext('sugar-toolkit', msg) |
34 | 34 | |
35 | 35 | |
36 | | def _create_activity_icon(): |
| 36 | def _create_activity_icon(metadata): |
| 37 | if 'icon-color' in metadata: |
| 38 | color = XoColor(metadata['icon-color']) |
| 39 | else: |
| 40 | client = gconf.client_get_default() |
| 41 | color = XoColor(client.get_string('/desktop/sugar/user/color')) |
| 42 | |
37 | 43 | from sugar.activity.activity import get_bundle_path |
38 | 44 | bundle = ActivityBundle(get_bundle_path()) |
39 | | |
40 | | client = gconf.client_get_default() |
41 | | color = XoColor(client.get_string('/desktop/sugar/user/color')) |
42 | 45 | icon = Icon(file=bundle.get_icon(), xo_color=color) |
| 46 | |
43 | 47 | return icon |
44 | 48 | |
45 | 49 | |
… |
… |
class ActivityButton(ToolButton): |
48 | 52 | def __init__(self, activity, **kwargs): |
49 | 53 | ToolButton.__init__(self, **kwargs) |
50 | 54 | |
51 | | icon = _create_activity_icon() |
| 55 | icon = _create_activity_icon(activity.metadata) |
52 | 56 | self.set_icon_widget(icon) |
53 | 57 | icon.show() |
54 | 58 | |
… |
… |
class ActivityToolbarButton(ToolbarButton): |
67 | 71 | |
68 | 72 | ToolbarButton.__init__(self, page=toolbar, **kwargs) |
69 | 73 | |
70 | | icon = _create_activity_icon() |
| 74 | icon = _create_activity_icon(activity.metadata) |
71 | 75 | self.set_icon_widget(icon) |
72 | 76 | icon.show() |
73 | 77 | |