Replace enough of the old PS so we can join an activity instance on the network.

* src/sugar/activity/activity.py: Get the shared activity wrapper from
  sugar.presence.
* src/sugar/activity/activityfactory.py: Disable checking in the PS for
  activity_id duplicates.
* src/sugar/presence/activity.py: Remove the PS dependency and query Telepathy
  directly. Implemented enough to join an activity.
* src/sugar/presence/buddy.py: Remove the PS dependency and query Telepathy
  directly. Implemented enough to join an activity. Added an Owner subclass of
  Buddy()
* src/sugar/presence/presenceservice.py: Remove the PS dependency and query Telepathy
  directly. Implemented enough to join an activity.
* src/sugar/presence/util.py: Add ConnectionManager for discovering and tracking
  connections.
This commit is contained in:
Tomeu Vizoso
2010-06-22 16:31:21 +02:00
parent d6da506dfd
commit 98cc77f1fb
5 changed files with 274 additions and 326 deletions
+4 -3
View File
@@ -70,6 +70,7 @@ from sugar.graphics.alert import Alert
from sugar.graphics.icon import Icon
from sugar.datastore import datastore
from sugar.session import XSMPClient
from sugar.presence import presenceservice
from sugar import wm
# support deprecated imports
@@ -266,7 +267,6 @@ class Activity(Window, gtk.Container):
self._active = False
self._activity_id = handle.activity_id
self._pservice = presenceservice.get_instance()
self.shared_activity = None
self._share_id = None
self._join_id = None
@@ -302,8 +302,9 @@ class Activity(Window, gtk.Container):
share_scope = self._jobject.metadata['share-scope']
# handle activity share/join
mesh_instance = self._pservice.get_activity(self._activity_id,
warn_if_none=False)
pservice = presenceservice.get_instance()
mesh_instance = pservice.get_activity(self._activity_id,
warn_if_none=False)
logging.debug("*** Act %s, mesh instance %r, scope %s",
self._activity_id, mesh_instance, share_scope)
if mesh_instance is not None:
+3
View File
@@ -75,11 +75,14 @@ def create_activity_id():
# check through network activities
found = False
logging.info('KILL_PS check the activity_id is not used in the network')
"""
activities = pservice.get_activities()
for act in activities:
if act_id == act.props.id:
found = True
break
"""
if not found:
return act_id
raise RuntimeError("Cannot generate unique activity id.")