Use gproperties in IconItem, make the color optional

This commit is contained in:
Marco Pesenti Gritti
2006-08-28 12:44:46 +02:00
parent 22e290332e
commit 766f9d6e68
5 changed files with 40 additions and 13 deletions
+4 -5
View File
@@ -7,13 +7,12 @@ import Theme
class FriendIcon(IconItem):
def __init__(self, friend):
IconItem.__init__(self, 'stock-buddy', friend.get_color(), 48)
IconItem.__init__(self, icon_name='stock-buddy',
color=friend.get_color(), size=48,
x=random.random() * 1100,
y=random.random() * 800)
self._friend = friend
self.set_property('x', random.random() * 1100)
self.set_property('y', random.random() * 800)
def get_friend(self):
return self._friend
+2 -1
View File
@@ -84,7 +84,8 @@ class Model(goocanvas.CanvasModelSimple):
root.add_child(tasks)
profile = sugar.conf.get_profile()
me = IconItem('stock-buddy', profile.get_color(), 150)
me = IconItem(icon_name = 'stock-buddy',
color = profile.get_color(), size = 150)
me.translate(600 - (me.get_property('width') / 2),
450 - (me.get_property('height') / 2))
root.add_child(me)
+2 -1
View File
@@ -14,7 +14,8 @@ class ActivityItem(IconItem):
info = registry.get_activity(activity.get_type())
icon_name = info.get_icon()
IconItem.__init__(self, icon_name, activity.get_color(), 48)
IconItem.__init__(self, icon_name=icon_name,
color=activity.get_color(), size=48)
self._activity = activity
+2 -2
View File
@@ -13,8 +13,8 @@ class ActivityItem(IconItem):
if not icon_name:
act_type = activity.get_default_type()
raise RuntimeError("Actvity %s did not have an icon!" % act_type)
IconItem.__init__(self, icon_name,
IconColor('white'), size)
IconItem.__init__(self, icon_name=icon_name,
color=IconColor('white'), size=size)
self._activity = activity
def get_activity_id(self):