diff --git a/shell/home/FriendsGroup.py b/shell/home/FriendsGroup.py index 6fd479ee..170f1442 100644 --- a/shell/home/FriendsGroup.py +++ b/shell/home/FriendsGroup.py @@ -3,6 +3,8 @@ import random import goocanvas from sugar.canvas.IconItem import IconItem +from home.IconLayout import IconLayout +from home.MyIcon import MyIcon class FriendIcon(IconItem): def __init__(self, friend): @@ -14,13 +16,18 @@ class FriendIcon(IconItem): return self._friend class FriendsGroup(goocanvas.Group): - def __init__(self, shell, friends, icon_layout): + def __init__(self, shell, friends): goocanvas.Group.__init__(self) self._shell = shell - self._icon_layout = icon_layout + self._icon_layout = IconLayout(1200, 900) self._friends = friends + me = MyIcon(100) + me.translate(600 - (me.get_property('size') / 2), + 450 - (me.get_property('size') / 2)) + self.add_child(me) + for friend in self._friends: self.add_friend(friend) diff --git a/shell/home/HomeGroup.py b/shell/home/HomeGroup.py index 881147b5..0f088132 100644 --- a/shell/home/HomeGroup.py +++ b/shell/home/HomeGroup.py @@ -1,11 +1,7 @@ -import gtk import goocanvas -import wnck -import conf -from sugar.canvas.IconItem import IconItem -from sugar.canvas.IconColor import IconColor from home.DonutItem import DonutItem +from home.MyIcon import MyIcon class TasksItem(DonutItem): def __init__(self, shell): @@ -50,9 +46,7 @@ class HomeGroup(goocanvas.Group): tasks.translate(600, 450) self.add_child(tasks) - profile = conf.get_profile() - me = IconItem(icon_name = 'stock-buddy', - color = profile.get_color(), size = 150) + me = MyIcon(150) me.translate(600 - (me.get_property('size') / 2), 450 - (me.get_property('size') / 2)) self.add_child(me) diff --git a/shell/home/HomeWindow.py b/shell/home/HomeWindow.py index 767e472c..d7068d8d 100644 --- a/shell/home/HomeWindow.py +++ b/shell/home/HomeWindow.py @@ -6,7 +6,6 @@ from sugar.canvas.CanvasView import CanvasView from home.MeshGroup import MeshGroup from home.HomeGroup import HomeGroup from home.FriendsGroup import FriendsGroup -from home.IconLayout import IconLayout import sugar class HomeWindow(gtk.Window): @@ -34,12 +33,10 @@ class HomeWindow(gtk.Window): self._current_group = self._home_group def set_owner(self, owner): - layout = IconLayout(1200, 900) friends = owner.get_friends() - self._friends_group = FriendsGroup(self._shell, friends, layout) + self._friends_group = FriendsGroup(self._shell, friends) - layout = IconLayout(1200, 900) - self._mesh_group = MeshGroup(self._shell, layout) + self._mesh_group = MeshGroup(self._shell) def _set_group(self, group): self._root.remove_child(self._current_group) diff --git a/shell/home/Makefile.am b/shell/home/Makefile.am index daa51704..5d5436e3 100644 --- a/shell/home/Makefile.am +++ b/shell/home/Makefile.am @@ -4,6 +4,7 @@ sugar_PYTHON = \ DonutItem.py \ FriendsGroup.py \ IconLayout.py \ - MeshGroup.py \ HomeGroup.py \ - HomeWindow.py + HomeWindow.py \ + MeshGroup.py \ + MyIcon.py diff --git a/shell/home/MeshGroup.py b/shell/home/MeshGroup.py index b48420a6..e0a61441 100644 --- a/shell/home/MeshGroup.py +++ b/shell/home/MeshGroup.py @@ -6,6 +6,7 @@ import conf from sugar.canvas.IconItem import IconItem from sugar.canvas.IconItem import IconColor from sugar.presence import PresenceService +from home.IconLayout import IconLayout class ActivityItem(IconItem): def __init__(self, service): @@ -32,10 +33,10 @@ class ActivityItem(IconItem): return self._service class MeshGroup(goocanvas.Group): - def __init__(self, shell, icon_layout): + def __init__(self, shell): goocanvas.Group.__init__(self) self._shell = shell - self._icon_layout = icon_layout + self._icon_layout = IconLayout(1200, 900) self._activities = {} pservice = PresenceService.get_instance() diff --git a/shell/home/MyIcon.py b/shell/home/MyIcon.py new file mode 100644 index 00000000..226520d2 --- /dev/null +++ b/shell/home/MyIcon.py @@ -0,0 +1,10 @@ +import conf +from sugar.canvas.IconItem import IconItem +from sugar.canvas.IconColor import IconColor + +class MyIcon(IconItem): + def __init__(self, size): + profile = conf.get_profile() + + IconItem.__init__(self, icon_name='stock-buddy', + color=profile.get_color(), size=size)