diff --git a/shell/model/MeshModel.py b/shell/model/MeshModel.py index 908a5f96..2d48143f 100644 --- a/shell/model/MeshModel.py +++ b/shell/model/MeshModel.py @@ -134,7 +134,7 @@ class MeshModel(gobject.GObject): name = buddy.get_name() if cur_activity == activity and self._buddies.has_key(name): buddy_model = self._buddies[name] - self.emit('buddy-moved', buddy, model) + self.emit('buddy-moved', buddy_model, model) def _activity_disappeared_cb(self, pservice, activity): if self._activities.has_key(activity.get_id()): diff --git a/shell/view/home/FriendsBox.py b/shell/view/home/FriendsBox.py index c92be7d1..28a745e0 100644 --- a/shell/view/home/FriendsBox.py +++ b/shell/view/home/FriendsBox.py @@ -47,7 +47,7 @@ class FriendsBox(SpreadBox, hippo.CanvasItem): def add_friend(self, buddy_info): icon = FriendView(self._shell, self._menu_shell, buddy_info) - self.add(icon) + self.add_item(icon) self._friends[buddy_info.get_name()] = icon @@ -55,7 +55,7 @@ class FriendsBox(SpreadBox, hippo.CanvasItem): self.add_friend(buddy_info) def _friend_removed_cb(self, data_model, name): - self.remove(self._friends[name]) + self.remove_item(self._friends[name]) del self._friends[name] def do_allocate(self, width, height): diff --git a/shell/view/home/MeshBox.py b/shell/view/home/MeshBox.py index a4e9906a..c2682c04 100644 --- a/shell/view/home/MeshBox.py +++ b/shell/view/home/MeshBox.py @@ -99,13 +99,13 @@ class MeshBox(SpreadBox): def _add_alone_buddy(self, buddy_model): icon = BuddyIcon(self._shell, self._menu_shell, buddy_model) icon.props.size = 80 - self.add(icon) + self.add_item(icon) self._buddies[buddy_model.get_name()] = icon def _remove_alone_buddy(self, buddy_model): icon = self._buddies[buddy_model.get_name()] - self.remove(icon) + self.remove_item(icon) del self._buddies[buddy_model.get_name()] def _remove_buddy(self, buddy_model): @@ -133,11 +133,11 @@ class MeshBox(SpreadBox): def _add_activity(self, activity_model): icon = ActivityView(self._shell, self._menu_shell, activity_model) - self.add(icon) + self.add_item(icon) self._activities[activity_model.get_id()] = icon def _remove_activity(self, activity_model): icon = self._activities[activity_model.get_id()] - self.remove(icon) + self.remove_item(icon) del self._activities[activity_model.get_id()] diff --git a/sugar/graphics/spreadbox.py b/sugar/graphics/spreadbox.py index 43bf126c..13ee99d4 100644 --- a/sugar/graphics/spreadbox.py +++ b/sugar/graphics/spreadbox.py @@ -33,10 +33,15 @@ class SpreadBox(hippo.CanvasBox, hippo.CanvasItem): self._spread_on_add = False self._stable = False - def add(self, item): + def add_item(self, item): self._items_to_position.append(item) self.append(item, hippo.PACK_FIXED) + def remove_item(self, item): + if self._items_to_position.count(item) > 0: + self._items_to_position.remove(item) + self.remove(item) + def _get_distance(self, icon1, icon2): [icon1_x, icon1_y] = self.get_position(icon1) [icon2_x, icon2_y] = self.get_position(icon2)