Clicking on the friend icon in the frame add it to friends.

This commit is contained in:
Marco Pesenti Gritti
2006-08-30 12:22:01 +02:00
parent 6865148c90
commit 030ba2b56d
8 changed files with 47 additions and 27 deletions
+10 -3
View File
@@ -8,9 +8,10 @@ from sugar.presence import PresenceService
class FriendsGroup(goocanvas.Group):
N_BUDDIES = 10
def __init__(self, shell, width):
def __init__(self, shell, friends, width):
goocanvas.Group.__init__(self)
self._shell = shell
self._friends = friends
self._width = width
self._activity_ps = None
self._joined_hid = -1
@@ -60,6 +61,7 @@ class FriendsGroup(goocanvas.Group):
icon = IconItem(icon_name='stock-buddy',
color=IconColor(buddy.get_color()),
size=self._width, y=self._get_y(i))
icon.connect('clicked', self.__buddy_clicked_cb, buddy)
self.add_child(icon, i)
self._buddies[i] = buddy.get_name()
@@ -112,6 +114,9 @@ class FriendsGroup(goocanvas.Group):
def __buddy_left_cb(self, activity, buddy):
self.remove(buddy)
def __buddy_clicked_cb(self, icon, buddy):
self._friends.add_buddy(buddy)
class ActionsBar(goocanvas.Group):
def __init__(self, shell, width):
goocanvas.Group.__init__(self)
@@ -149,9 +154,10 @@ class ActionsBar(goocanvas.Group):
pass
class FriendsPanel(Panel):
def __init__(self, shell):
def __init__(self, shell, friends):
Panel.__init__(self)
self._shell = shell
self._friends = friends
def construct(self):
Panel.construct(self)
@@ -161,6 +167,7 @@ class FriendsPanel(Panel):
actions_bar = ActionsBar(self._shell, self.get_width())
root.add_child(actions_bar)
friends_group = FriendsGroup(self._shell, self.get_width())
friends_group = FriendsGroup(self._shell, self._friends,
self.get_width())
friends_group.translate(0, 150)
root.add_child(friends_group)
+2 -2
View File
@@ -7,7 +7,7 @@ from panel.TopPanel import TopPanel
from panel.Panel import Panel
class PanelManager:
def __init__(self, shell):
def __init__(self, shell, owner):
size = 30
self._verbs_panel = VerbsPanel(shell)
@@ -15,7 +15,7 @@ class PanelManager:
self._verbs_panel.move(0, gtk.gdk.screen_height() - size)
self._verbs_panel.resize(gtk.gdk.screen_width(), size)
self._friends_panel = FriendsPanel(shell)
self._friends_panel = FriendsPanel(shell, owner.get_friends())
self._friends_panel.move(gtk.gdk.screen_width() - size, size)
self._friends_panel.resize(size, gtk.gdk.screen_height() - size * 2)