From 05061c5e3de5e1da5193c6e6af4b018bca0fcfb0 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Fri, 25 Aug 2006 00:49:39 +0200 Subject: [PATCH] Use the actual buddy color --- shell/Owner.py | 4 +++- shell/home/FriendsModel.py | 5 +++++ shell/home/FriendsView.py | 3 +-- shell/home/HomeView.py | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/shell/Owner.py b/shell/Owner.py index 14cd6361..81b390ea 100644 --- a/shell/Owner.py +++ b/shell/Owner.py @@ -5,6 +5,7 @@ import base64 from sugar import env from sugar.p2p import Stream from sugar.presence import PresenceService +from sugar import conf PRESENCE_SERVICE_TYPE = "_presence_olpc._tcp" @@ -29,7 +30,8 @@ class ShellOwner(object): def announce(self): # Create and announce our presence - props = { 'color': "#deadbe" } + color = conf.get_profile().get_color() + props = { 'color': color.get_fill_color() } self._service = self._pservice.register_service(self._nick, PRESENCE_SERVICE_TYPE, properties=props) print "Owner '%s' using port %d" % (self._nick, self._service.get_port()) diff --git a/shell/home/FriendsModel.py b/shell/home/FriendsModel.py index 0988b8af..0df084c5 100644 --- a/shell/home/FriendsModel.py +++ b/shell/home/FriendsModel.py @@ -1,6 +1,7 @@ import gobject from sugar.presence import PresenceService +from sugar.canvas.IconColor import IconColor class Friend: def __init__(self, buddy): @@ -9,6 +10,10 @@ class Friend: def get_name(self): return self._buddy.get_name() + def get_color(self): + color = self._buddy.get_color() + return IconColor(color) + class FriendsModel(gobject.GObject): __gsignals__ = { 'friend-added': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, diff --git a/shell/home/FriendsView.py b/shell/home/FriendsView.py index 5faf0d65..c1d3e627 100644 --- a/shell/home/FriendsView.py +++ b/shell/home/FriendsView.py @@ -3,7 +3,6 @@ import random import goocanvas from sugar.canvas.IconItem import IconItem -from sugar.canvas.IconColor import IconColor import Theme @@ -48,7 +47,7 @@ class Model(goocanvas.CanvasModelSimple): def add_friend(self, friend): root = self.get_root_item() - icon = IconItem('stock-buddy', IconColor(), 48) + icon = IconItem('stock-buddy', friend.get_color(), 48) icon.set_property('x', random.random() * 1100) icon.set_property('y', random.random() * 800) diff --git a/shell/home/HomeView.py b/shell/home/HomeView.py index fb75f5df..67a9a41a 100644 --- a/shell/home/HomeView.py +++ b/shell/home/HomeView.py @@ -7,6 +7,7 @@ from sugar.canvas.IconColor import IconColor from sugar.canvas.DonutItem import DonutItem from sugar.canvas.DonutItem import PieceItem from sugar.canvas.DonutItem import PieceIcon +import sugar.conf import Theme @@ -81,7 +82,8 @@ class Model(goocanvas.CanvasModelSimple): tasks.translate(600, 450) root.add_child(tasks) - me = IconItem('stock-buddy', IconColor(), 150) + profile = sugar.conf.get_profile() + me = IconItem('stock-buddy', profile.get_color(), 150) me.translate(600 - (me.get_property('width') / 2), 450 - (me.get_property('height') / 2)) root.add_child(me)