From 7b37c4d38b0ae6fe6f5a346b3685414185237a09 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Fri, 15 Sep 2006 15:30:46 +0200 Subject: [PATCH] Fix opening new activities --- shell/model/BuddyInfo.py | 24 ++++++++++++++++++++++++ shell/view/frame/BottomPanel.py | 10 +++++----- 2 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 shell/model/BuddyInfo.py diff --git a/shell/model/BuddyInfo.py b/shell/model/BuddyInfo.py new file mode 100644 index 00000000..68f0a445 --- /dev/null +++ b/shell/model/BuddyInfo.py @@ -0,0 +1,24 @@ +from sugar.presence import PresenceService +from sugar.canvas.IconColor import IconColor + +class BuddyInfo: + def __init__(self, buddy=None): + if buddy: + self.set_name(buddy.get_name()) + self.set_color(buddy.get_color()) + + def set_name(self, name): + self._name = name + + def set_color(self, color_string): + self._color = IconColor(color_string) + + def get_name(self): + return self._name + + def get_color(self): + return self._color + + def get_buddy(self): + pservice = PresenceService.get_instance() + return pservice.get_buddy_by_name(self._name) diff --git a/shell/view/frame/BottomPanel.py b/shell/view/frame/BottomPanel.py index 31bd2b46..5f98f016 100644 --- a/shell/view/frame/BottomPanel.py +++ b/shell/view/frame/BottomPanel.py @@ -36,9 +36,9 @@ class BottomPanel(CanvasBox): def __init__(self, shell): CanvasBox.__init__(self, shell.get_grid(), CanvasBox.HORIZONTAL, 1) - self._shell_model = shell.get_model() + self._shell = shell self._invite_to_item = {} - self._invites = self._shell_model.get_invites() + self._invites = self._shell.get_model().get_invites() registry = conf.get_activity_registry() for activity in registry.list_activities(): @@ -51,12 +51,12 @@ class BottomPanel(CanvasBox): self._invites.connect('invite-removed', self.__invite_removed_cb) def __activity_clicked_cb(self, icon): - self._shell_model.start_activity(icon.get_bundle_id()) + self._shell.start_activity(icon.get_bundle_id()) def __invite_clicked_cb(self, icon): self._invites.remove_invite(icon.get_invite()) - self._shell_model.join_activity(icon.get_bundle_id(), - icon.get_activity_id()) + self._shell.join_activity(icon.get_bundle_id(), + icon.get_activity_id()) def __invite_added_cb(self, invites, invite): self.add_invite(invite)