From ab3ece2632fdd6fc3b5491ac7e9169d21f5f940d Mon Sep 17 00:00:00 2001 From: Raul Gutierrez Segales Date: Tue, 01 Feb 2011 10:36:22 +0000 Subject: A bunch of fixes/hacks to make collab work --- diff --git a/TurtleArt/tacollaboration.py b/TurtleArt/tacollaboration.py index 4ade7d1..3c35e66 100644 --- a/TurtleArt/tacollaboration.py +++ b/TurtleArt/tacollaboration.py @@ -3,6 +3,7 @@ from dbus.service import signal from dbus.gobject_service import ExportedGObject import logging import telepathy +from TurtleArt.tautils import data_to_string, data_from_string try: from sugar import profile diff --git a/collaboration/activity.py b/collaboration/activity.py index 06e36df..bd58e92 100644 --- a/collaboration/activity.py +++ b/collaboration/activity.py @@ -355,10 +355,11 @@ class Activity(gobject.GObject): del self._buddies[contact_id] def _get_buddy(self, contact_id): - if contact_id in self._buddies: - return self._buddies[contact_id] - else: - return Buddy(self._account_path, contact_id) + return None + #if contact_id in self._buddies: + # return self._buddies[contact_id] + #else: + # return Buddy(self._account_path, contact_id) def join(self): """Join this activity. diff --git a/collaboration/neighborhood.py b/collaboration/neighborhood.py index ad7ce21..b587bc8 100755 --- a/collaboration/neighborhood.py +++ b/collaboration/neighborhood.py @@ -896,13 +896,6 @@ class Neighborhood(gobject.GObject): print('__activity_updated_cb Unknown activity with activity_id %r', activity_id) return - ### - # FIXME: this should be configurable, we only care about the activity thats using this lib - # i.e.: Turtle Art - - if properties['type']: - print properties['type'] - # we should somehow emulate this and say we only have TurtleArtActivity #registry = bundleregistry.get_registry() #bundle = registry.get_bundle(properties['type']) @@ -922,6 +915,10 @@ class Neighborhood(gobject.GObject): activity.props.name = properties['name'] if 'private' in properties: activity.props.private = properties['private'] + # FIXME: this should be configurable, we only care about the activity thats using this lib + # i.e.: Turtle Art + if properties['type']: + activity.props.bundle = properties['type'] if is_new: print "The activity is new" diff --git a/extra/collaborationplugin.py b/extra/collaborationplugin.py index 145e3de..56fcae5 100644 --- a/extra/collaborationplugin.py +++ b/extra/collaborationplugin.py @@ -16,8 +16,11 @@ from collaboration.connectionmanager import get_connection_manager from collaboration.activity import Activity from collaboration import telepathyclient from collaboration.tubeconn import TubeConnection +import traceback from TurtleArt.tacollaboration import Collaboration +CONNECTION_INTERFACE_ACTIVITY_PROPERTIES = \ + 'org.laptop.Telepathy.ActivityProperties' class CollaborationPlugin(Plugin): @@ -62,6 +65,7 @@ class CollaborationPlugin(Plugin): def set_tw(self, turtleart_window): self.tw = turtleart_window + self.tw.nick = self._get_nick() def get_menu(self): menu = gtk.Menu() @@ -208,6 +212,8 @@ class CollaborationPlugin(Plugin): print("room_handle = %s" % str(room_handle)) self._joined_activity = Activity(account_path, connection, room_handle, properties=properties) + # FIXME: this should be unified, no need to keep 2 references + self._shared_activity = self._joined_activity except: traceback.print_exc(file=sys.stdout) @@ -219,6 +225,7 @@ class CollaborationPlugin(Plugin): self._joined_activity.join() def __joined_cb(self,activity, success, err): + print "We've joined an activity" self.emit('joined') def _config_neighborhood_cb(self, widget): @@ -239,10 +246,10 @@ class CollaborationPlugin(Plugin): def _share_cb(self, button): properties = {} - properties['id'] = self._activity._get_activity_id() - properties['type'] = self._activity._get_bundle_id() - properties['name'] = self._activity._get_title() - properties['color'] = self._activity._get_turtle_color() + properties['id'] = self._get_activity_id() + properties['type'] = self._get_bundle_id() + properties['name'] = self._get_title() + properties['color'] = self._get_turtle_color() properties['private'] = False connection_manager = get_connection_manager() @@ -256,6 +263,8 @@ class CollaborationPlugin(Plugin): try: self._activity._shared_activity = Activity(account_path, connection, properties=properties) + # FIXME: this should be unified, no need to keep 2 references + self._shared_activity = self._activity._shared_activity except: traceback.print_exc(file=sys.stdout) -- cgit v0.9.1