More cleanups, show my icon at the center of the screen
This commit is contained in:
parent
665f83d7ef
commit
dd9e09ab1c
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -4,6 +4,7 @@ sugar_PYTHON = \
|
||||
DonutItem.py \
|
||||
FriendsGroup.py \
|
||||
IconLayout.py \
|
||||
MeshGroup.py \
|
||||
HomeGroup.py \
|
||||
HomeWindow.py
|
||||
HomeWindow.py \
|
||||
MeshGroup.py \
|
||||
MyIcon.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()
|
||||
|
10
shell/home/MyIcon.py
Normal file
10
shell/home/MyIcon.py
Normal file
@ -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)
|
Loading…
Reference in New Issue
Block a user