Use FriendIcon in the frame

This commit is contained in:
Marco Pesenti Gritti 2006-09-14 20:52:21 +02:00
parent 3a4f8da5ce
commit 8265e29cdf
3 changed files with 9 additions and 8 deletions

View File

@ -75,7 +75,8 @@ class FriendPopup(gtk.Window):
print 'Friend not online' print 'Friend not online'
def _make_friend_clicked_cb(self, icon): def _make_friend_clicked_cb(self, icon):
pass friends = self._shell.get_owner().get_friends()
friends.add_buddy(buddy)
def _enter_notify_event_cb(self, widget, event): def _enter_notify_event_cb(self, widget, event):
self._hover = True self._hover = True

View File

@ -84,6 +84,9 @@ class Shell(gobject.GObject):
self._frame = Frame(self, self._owner) self._frame = Frame(self, self._owner)
self._frame.show_and_hide(10) self._frame.show_and_hide(10)
def get_owner(self):
return self._owner
def __global_key_pressed_cb(self, grabber, key): def __global_key_pressed_cb(self, grabber, key):
if key == 'F1': if key == 'F1':
self.set_zoom_level(sugar.ZOOM_ACTIVITY) self.set_zoom_level(sugar.ZOOM_ACTIVITY)

View File

@ -4,6 +4,8 @@ from sugar.canvas.IconItem import IconItem
from sugar.canvas.IconColor import IconColor from sugar.canvas.IconColor import IconColor
from sugar.canvas.CanvasBox import CanvasBox from sugar.canvas.CanvasBox import CanvasBox
from sugar.presence import PresenceService from sugar.presence import PresenceService
from FriendIcon import FriendIcon
from Friends import Friend
class RightPanel(CanvasBox): class RightPanel(CanvasBox):
def __init__(self, grid, shell, friends): def __init__(self, grid, shell, friends):
@ -22,11 +24,9 @@ class RightPanel(CanvasBox):
shell.connect('activity-changed', self.__activity_changed_cb) shell.connect('activity-changed', self.__activity_changed_cb)
def add(self, buddy): def add(self, buddy):
icon = IconItem(icon_name='stock-buddy', friend = Friend(buddy.get_name(), buddy.get_color())
color=IconColor(buddy.get_color())) icon = FriendIcon(self._shell, friend)
self.set_constraints(icon, 3, 3) self.set_constraints(icon, 3, 3)
icon.connect('clicked', self.__buddy_clicked_cb, buddy)
self.add_child(icon) self.add_child(icon)
self._buddies[buddy.get_name()] = icon self._buddies[buddy.get_name()] = icon
@ -78,6 +78,3 @@ class RightPanel(CanvasBox):
def __buddy_left_cb(self, activity, buddy): def __buddy_left_cb(self, activity, buddy):
self.remove(buddy) self.remove(buddy)
def __buddy_clicked_cb(self, icon, buddy):
self._friends.add_buddy(buddy)