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)