Hook up activity colors
This commit is contained in:
parent
e34d437fb9
commit
83bbe54bc8
@ -3,6 +3,8 @@ import dbus
|
||||
|
||||
from sugar import conf
|
||||
from sugar.activity import Activity
|
||||
from sugar.presence import PresenceService
|
||||
from sugar.canvas.IconColor import IconColor
|
||||
from PeopleWindow import PeopleWindow
|
||||
|
||||
class ActivityHost:
|
||||
@ -31,6 +33,14 @@ class ActivityHost:
|
||||
def get_icon_name(self):
|
||||
return self._icon_name
|
||||
|
||||
def get_icon_color(self):
|
||||
pservice = PresenceService.get_instance()
|
||||
activity = pservice.get_activity(self._id)
|
||||
if activity != None:
|
||||
return IconColor(activity.get_color())
|
||||
else:
|
||||
return conf.get_profile().get_color()
|
||||
|
||||
def share(self):
|
||||
self._people_window.share()
|
||||
self._activity.share()
|
||||
|
@ -33,7 +33,8 @@ class TasksItem(DonutItem):
|
||||
|
||||
def _add(self, activity):
|
||||
icon_name = activity.get_icon_name()
|
||||
item = self.add_piece(100 / 8, icon_name, IconColor())
|
||||
icon_color = activity.get_icon_color()
|
||||
item = self.add_piece(100 / 8, icon_name, icon_color)
|
||||
|
||||
# FIXME This really sucks. Fix goocanvas event handling.
|
||||
item.set_data('activity', activity)
|
||||
|
@ -1,6 +1,7 @@
|
||||
import gobject
|
||||
|
||||
from sugar.presence import PresenceService
|
||||
from sugar.canvas.IconColor import IconColor
|
||||
from sugar import conf
|
||||
|
||||
class ActivityInfo:
|
||||
@ -15,6 +16,11 @@ class ActivityInfo:
|
||||
|
||||
def get_title(self):
|
||||
return self._service.get_published_value('title')
|
||||
|
||||
def get_color(self):
|
||||
pservice = PresenceService.get_instance()
|
||||
activity = pservice.get_activity(self.get_id())
|
||||
return IconColor(activity.get_color())
|
||||
|
||||
def get_service(self):
|
||||
return self._service
|
||||
|
@ -14,7 +14,7 @@ class ActivityItem(IconItem):
|
||||
info = registry.get_activity(activity.get_type())
|
||||
icon_name = info.get_icon()
|
||||
|
||||
IconItem.__init__(self, icon_name, IconColor(), 48)
|
||||
IconItem.__init__(self, icon_name, activity.get_color(), 48)
|
||||
|
||||
self._activity = activity
|
||||
|
||||
@ -57,7 +57,7 @@ class Model(goocanvas.CanvasModelSimple):
|
||||
def add_activity(self, activity):
|
||||
root = self.get_root_item()
|
||||
|
||||
item = ActivityItem(activity, self._registry)
|
||||
item = ActivityItem(activity)
|
||||
item.set_property('x', random.random() * 1100)
|
||||
item.set_property('y', random.random() * 800)
|
||||
root.add_child(item)
|
||||
|
Loading…
Reference in New Issue
Block a user