Use the actual buddy color
This commit is contained in:
parent
9e970b5b0f
commit
05061c5e3d
@ -5,6 +5,7 @@ import base64
|
|||||||
from sugar import env
|
from sugar import env
|
||||||
from sugar.p2p import Stream
|
from sugar.p2p import Stream
|
||||||
from sugar.presence import PresenceService
|
from sugar.presence import PresenceService
|
||||||
|
from sugar import conf
|
||||||
|
|
||||||
PRESENCE_SERVICE_TYPE = "_presence_olpc._tcp"
|
PRESENCE_SERVICE_TYPE = "_presence_olpc._tcp"
|
||||||
|
|
||||||
@ -29,7 +30,8 @@ class ShellOwner(object):
|
|||||||
|
|
||||||
def announce(self):
|
def announce(self):
|
||||||
# Create and announce our presence
|
# 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,
|
self._service = self._pservice.register_service(self._nick,
|
||||||
PRESENCE_SERVICE_TYPE, properties=props)
|
PRESENCE_SERVICE_TYPE, properties=props)
|
||||||
print "Owner '%s' using port %d" % (self._nick, self._service.get_port())
|
print "Owner '%s' using port %d" % (self._nick, self._service.get_port())
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import gobject
|
import gobject
|
||||||
|
|
||||||
from sugar.presence import PresenceService
|
from sugar.presence import PresenceService
|
||||||
|
from sugar.canvas.IconColor import IconColor
|
||||||
|
|
||||||
class Friend:
|
class Friend:
|
||||||
def __init__(self, buddy):
|
def __init__(self, buddy):
|
||||||
@ -9,6 +10,10 @@ class Friend:
|
|||||||
def get_name(self):
|
def get_name(self):
|
||||||
return self._buddy.get_name()
|
return self._buddy.get_name()
|
||||||
|
|
||||||
|
def get_color(self):
|
||||||
|
color = self._buddy.get_color()
|
||||||
|
return IconColor(color)
|
||||||
|
|
||||||
class FriendsModel(gobject.GObject):
|
class FriendsModel(gobject.GObject):
|
||||||
__gsignals__ = {
|
__gsignals__ = {
|
||||||
'friend-added': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
|
'friend-added': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
|
||||||
|
@ -3,7 +3,6 @@ import random
|
|||||||
import goocanvas
|
import goocanvas
|
||||||
|
|
||||||
from sugar.canvas.IconItem import IconItem
|
from sugar.canvas.IconItem import IconItem
|
||||||
from sugar.canvas.IconColor import IconColor
|
|
||||||
|
|
||||||
import Theme
|
import Theme
|
||||||
|
|
||||||
@ -48,7 +47,7 @@ class Model(goocanvas.CanvasModelSimple):
|
|||||||
def add_friend(self, friend):
|
def add_friend(self, friend):
|
||||||
root = self.get_root_item()
|
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('x', random.random() * 1100)
|
||||||
icon.set_property('y', random.random() * 800)
|
icon.set_property('y', random.random() * 800)
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ from sugar.canvas.IconColor import IconColor
|
|||||||
from sugar.canvas.DonutItem import DonutItem
|
from sugar.canvas.DonutItem import DonutItem
|
||||||
from sugar.canvas.DonutItem import PieceItem
|
from sugar.canvas.DonutItem import PieceItem
|
||||||
from sugar.canvas.DonutItem import PieceIcon
|
from sugar.canvas.DonutItem import PieceIcon
|
||||||
|
import sugar.conf
|
||||||
|
|
||||||
import Theme
|
import Theme
|
||||||
|
|
||||||
@ -81,7 +82,8 @@ class Model(goocanvas.CanvasModelSimple):
|
|||||||
tasks.translate(600, 450)
|
tasks.translate(600, 450)
|
||||||
root.add_child(tasks)
|
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),
|
me.translate(600 - (me.get_property('width') / 2),
|
||||||
450 - (me.get_property('height') / 2))
|
450 - (me.get_property('height') / 2))
|
||||||
root.add_child(me)
|
root.add_child(me)
|
||||||
|
Loading…
Reference in New Issue
Block a user