Clicking on the friend icon in the frame add it to friends.
This commit is contained in:
@@ -34,11 +34,10 @@ class FriendsGroup(goocanvas.Group):
|
||||
radius_x=60, radius_y=60)
|
||||
self.add_child(self._friends_rect)
|
||||
|
||||
# for friend in data_model:
|
||||
# self.add_friend(friend)
|
||||
for friend in self._friends:
|
||||
self.add_friend(friend)
|
||||
|
||||
# data_model.connect('friend-added', self.__friend_added_cb)
|
||||
# data_model.connect('friend-removed', self.__friend_removed_cb)
|
||||
friends.connect('friend-added', self.__friend_added_cb)
|
||||
|
||||
def __theme_changed_cb(self, theme):
|
||||
color = self._theme.get_home_friends_color()
|
||||
@@ -47,17 +46,7 @@ class FriendsGroup(goocanvas.Group):
|
||||
def add_friend(self, friend):
|
||||
icon = FriendIcon(friend)
|
||||
self.add_child(icon)
|
||||
self._friend_to_child[friend] = icon
|
||||
self._icon_layout.add_icon(icon)
|
||||
|
||||
def remove_friend(self, friend):
|
||||
icon = self._friend_to_child[friend]
|
||||
self._icon_layout.remove_icon(icon)
|
||||
self.remove_child(self.find_child(icon))
|
||||
del self._friend_to_child[friend]
|
||||
|
||||
def __friend_added_cb(self, data_model, friend):
|
||||
self.add_friend(friend)
|
||||
|
||||
def __friend_removed_cb(self, data_model, friend):
|
||||
self.remove_friend(friend)
|
||||
|
||||
@@ -38,7 +38,7 @@ class HomeWindow(gtk.Window):
|
||||
y2 = y1 + FriendsGroup.HEIGHT
|
||||
icon_layout.set_bounds(x1, y1, x2, y2)
|
||||
|
||||
self._mesh_group = MeshGroup(self._shell, owner, icon_layout)
|
||||
self._mesh_group = MeshGroup(self._shell, icon_layout)
|
||||
root.add_child(self._mesh_group)
|
||||
|
||||
icon_layout = IconLayout(FriendsGroup.WIDTH, FriendsGroup.HEIGHT)
|
||||
@@ -48,7 +48,7 @@ class HomeWindow(gtk.Window):
|
||||
y2 = y1 + HomeGroup.HEIGHT
|
||||
icon_layout.set_bounds(x1, y1, x2, y2)
|
||||
|
||||
self._friends_group = FriendsGroup(owner, icon_layout)
|
||||
self._friends_group = FriendsGroup(owner.get_friends(), icon_layout)
|
||||
self._friends_group.translate((self._width - FriendsGroup.WIDTH) / 2,
|
||||
(self._height - FriendsGroup.HEIGHT) / 2)
|
||||
root.add_child(self._friends_group)
|
||||
|
||||
@@ -34,7 +34,7 @@ class MeshGroup(goocanvas.Group):
|
||||
WIDTH = 1200.0 * 3.5
|
||||
HEIGHT = 900.0 * 3.5
|
||||
|
||||
def __init__(self, shell, owner, icon_layout):
|
||||
def __init__(self, shell, icon_layout):
|
||||
goocanvas.Group.__init__(self)
|
||||
self._shell = shell
|
||||
self._icon_layout = icon_layout
|
||||
|
||||
Reference in New Issue
Block a user