Fix opening new activities

This commit is contained in:
Marco Pesenti Gritti 2006-09-15 15:30:46 +02:00
parent f2f25f874d
commit 7b37c4d38b
2 changed files with 29 additions and 5 deletions

24
shell/model/BuddyInfo.py Normal file
View File

@ -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)

View File

@ -36,9 +36,9 @@ class BottomPanel(CanvasBox):
def __init__(self, shell): def __init__(self, shell):
CanvasBox.__init__(self, shell.get_grid(), CanvasBox.HORIZONTAL, 1) CanvasBox.__init__(self, shell.get_grid(), CanvasBox.HORIZONTAL, 1)
self._shell_model = shell.get_model() self._shell = shell
self._invite_to_item = {} self._invite_to_item = {}
self._invites = self._shell_model.get_invites() self._invites = self._shell.get_model().get_invites()
registry = conf.get_activity_registry() registry = conf.get_activity_registry()
for activity in registry.list_activities(): for activity in registry.list_activities():
@ -51,12 +51,12 @@ class BottomPanel(CanvasBox):
self._invites.connect('invite-removed', self.__invite_removed_cb) self._invites.connect('invite-removed', self.__invite_removed_cb)
def __activity_clicked_cb(self, icon): 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): def __invite_clicked_cb(self, icon):
self._invites.remove_invite(icon.get_invite()) self._invites.remove_invite(icon.get_invite())
self._shell_model.join_activity(icon.get_bundle_id(), self._shell.join_activity(icon.get_bundle_id(),
icon.get_activity_id()) icon.get_activity_id())
def __invite_added_cb(self, invites, invite): def __invite_added_cb(self, invites, invite):
self.add_invite(invite) self.add_invite(invite)