I've noticed that in order to use collaboration in an activity you need to access the _shared_activity member of your activity class to check if the activity is shared, and then there's further obscure stuff like:
self.text_chan = self._shared_activity.telepathy_text_chan self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].connect_to_signal( 'NewTube', self._new_tube_cb) The patch adds a get_shared_activity method which just returns the _shared_activity member so documentation about what _shared_activity really is shows up on the API docs, instead of having to go through half sugar-toolbox's code to find out. There are plenty more members of classes being accesed directly (like tubes_chan[telepathy.CHANNEL_TYPE_TUBES] above) which makes it difficult for novice programmers like me to find out what the heck they're doing when they write an activity. The pylint warning: W:195:ActivityToolbar.__update_title_cb: Access to a protected member _shared_activity of a client class is also fixed. If I've just started learning python last week, so if I'm speaking pure nonsense, I apologize :). -Andrés --- diff --git a/src/sugar/activity/activity.py b/src/sugar/activity/activity.py index 3b5d529..70f21c4 100644 --- a/src/sugar/activity/activity.py +++ b/src/sugar/activity/activity.py @@ -192,7 +192,7 @@ class ActivityToolbar(gtk.Toolbar): self._activity.metadata['title_set_by_user'] = '1' self._activity.save() - shared_activity = self._activity._shared_activity + shared_activity = self._activity.get_shared_activity() if shared_activity: shared_activity.props.name = title @@ -790,6 +790,13 @@ class Activity(Window, gtk.Container): self.emit('joined') self.__privacy_changed_cb(self._shared_activity, None) + def get_shared_activity(self): + """Returns an instance of the shared Activity or None + + The shared activity is of type sugar.presence.activity.Activity + """ + return self._shared_activity + def get_shared(self): """Returns TRUE if the activity is shared on the mesh.""" if not self._shared_activity:
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Sugar mailing list Sugar@lists.laptop.org http://lists.laptop.org/listinfo/sugar