From 3940d00df13672c59c34d5bf177c6c536313762a Mon Sep 17 00:00:00 2001 From: flavio Date: Sun, 09 Sep 2012 23:25:00 +0000 Subject: Change _shared_activity by shared_activity --- diff --git a/activity/activity.info b/activity/activity.info index bc3fc42..cf5f0bf 100644 --- a/activity/activity.info +++ b/activity/activity.info @@ -3,7 +3,7 @@ name = Pippy bundle_id = org.laptop.Pippy exec = sugar-activity pippy_app.PippyActivity icon = activity-icon -activity_version = 47 +activity_version = 50 mime_types = text/x-python, pickle/groupthink-pippy show_launcher = yes license = GPLv2+ diff --git a/groupthink/sugar_tools.py b/groupthink/sugar_tools.py index 1b2bee8..049974a 100644 --- a/groupthink/sugar_tools.py +++ b/groupthink/sugar_tools.py @@ -61,16 +61,13 @@ class GroupActivity(Activity): self.logger = logging.getLogger(self.dbus_name) self._handle = handle - - # HACK = self._shared_activity: attribute does not exist - self._shared_activity = None ##GObject.threads_init() - self._sharing_completed = not self._shared_activity + self._sharing_completed = not self.shared_activity self._readfile_completed = not handle.object_id - if self._shared_activity: + if self.shared_activity: self.message = self.message_joining elif handle.object_id: self.message = self.message_loading @@ -126,7 +123,7 @@ class GroupActivity(Activity): if not self._readfile_completed: self.read_file(self._jobject.file_path) - elif not self._shared_activity: + elif not self.shared_activity: GObject.idle_add(self._initialize_cleanstart) def _initialize_cleanstart(self): @@ -150,7 +147,7 @@ class GroupActivity(Activity): Window.set_canvas(self, main_widget) self.initialized = True - if self._shared_activity and not self._processed_share: + if self.shared_activity and not self._processed_share: # We are joining a shared activity, but when_shared has not yet # been called self.when_shared() @@ -188,13 +185,13 @@ class GroupActivity(Activity): self.dbus_name, {}) def _sharing_setup(self): - if self._shared_activity is None: + if self.shared_activity is None: self.logger.error('Failed to share or join activity') return - self.conn = self._shared_activity.telepathy_conn - self.tubes_chan = self._shared_activity.telepathy_tubes_chan - self.text_chan = self._shared_activity.telepathy_text_chan + self.conn = self.shared_activity.telepathy_conn + self.tubes_chan = self.shared_activity.telepathy_tubes_chan + self.text_chan = self.shared_activity.telepathy_text_chan self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].connect_to_signal('NewTube', self._new_tube_cb) @@ -208,7 +205,7 @@ class GroupActivity(Activity): self.logger.error('ListTubes() failed: %s', e) def _joined_cb(self, activity): - if not self._shared_activity: + if not self.shared_activity: return self.logger.debug('Joined an existing shared activity') diff --git a/pippy_app.py b/pippy_app.py index 5d20a0f..1f48d99 100644 --- a/pippy_app.py +++ b/pippy_app.py @@ -575,18 +575,16 @@ class PippyActivity(ViewSourceActivity, groupthink.sugar_tools.GroupActivity): def save_to_journal(self, file_path, cloudstring): - # FIXME When saving in the journal, it throws an error - #_file = open(file_path, 'w') - #if not self._shared_activity: - # self.metadata['mime_type'] = 'text/x-python' - # global text_buffer - # start, end = text_buffer.get_bounds() - # text = text_buffer.get_text(start, end, True) - # _file.write(text) - #else: - # self.metadata['mime_type'] = groupthink_mimetype - # _file.write(cloudstring) - pass + _file = open(file_path, 'w') + if not self.shared_activity: + self.metadata['mime_type'] = 'text/x-python' + global text_buffer + start, end = text_buffer.get_bounds() + text = text_buffer.get_text(start, end, True) + _file.write(text) + else: + self.metadata['mime_type'] = groupthink_mimetype + _file.write(cloudstring) def load_from_journal(self, file_path): if self.metadata['mime_type'] == 'text/x-python': -- cgit v0.9.1