Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2013-06-03 15:02:22 (GMT)
committer Agustin Zubiaga <aguz@sugarlabs.org>2013-06-03 19:15:02 (GMT)
commit15c4c79562dae3301672dba6152bcb6557b1b439 (patch)
tree5207114be11e6bb034107229ae10f076033249f1
parent818e9213d888872c3bbb014ec81df7ae11c5a351 (diff)
Fix collaboration - SL #4520
Collaboration was broken partially by the remove of __set_file_idle_cb in 17acb8ec0e72ead145c3d2648707af87b8ff5cf5 and posterior changes. Now restored the method, but use as a parameter the object_id instead of the tempfile path, because this change after the file is saved in the journal. We also needed add a control in read_file due to the use of the emptypanel. Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
-rw-r--r--ImageViewerActivity.py27
1 files changed, 22 insertions, 5 deletions
diff --git a/ImageViewerActivity.py b/ImageViewerActivity.py
index e611dff..45e6ba2 100644
--- a/ImageViewerActivity.py
+++ b/ImageViewerActivity.py
@@ -202,7 +202,7 @@ class ImageViewerActivity(activity.Activity):
self.is_received_document = False
- if self.shared_activity and handle.object_id is None:
+ if self.shared_activity:
# We're joining, and we don't already have the document.
if self.get_shared():
# Already joined for some reason, just get the document
@@ -349,6 +349,11 @@ class ImageViewerActivity(activity.Activity):
del chooser
def read_file(self, file_path):
+ if self._object_id is None or self.shared_activity:
+ # read_file is call because the canvas is visible
+ # but we need check if is not the case of empty file
+ return
+
self._want_document = False
tempfile = os.path.join(self.get_activity_root(), 'instance',
@@ -399,8 +404,22 @@ class ImageViewerActivity(activity.Activity):
self.progressdialog.destroy()
- GObject.idle_add(self.__set_file_idle_cb, tempfile)
- self.save()
+ GObject.idle_add(self.__set_file_idle_cb, self._jobject.object_id)
+
+ def __set_file_idle_cb(self, object_id):
+ dsobj = datastore.get(object_id)
+ self._tempfile = dsobj.file_path
+ """ This method is used when join a collaboration session """
+ self.view.set_file_location(self._tempfile)
+ try:
+ zoom = int(self.metadata.get('zoom', '0'))
+ if zoom > 0:
+ self.view.set_zoom(zoom)
+ except Exception:
+ pass
+ self.set_canvas(self.scrolled_window)
+ self.scrolled_window.show_all()
+ return False
def _download_progress_cb(self, getter, bytes_downloaded, tube_id):
if self._download_content_length > 0:
@@ -490,8 +509,6 @@ class ImageViewerActivity(activity.Activity):
self.progressdialog = ProgressDialog.ProgressDialog(self)
self.progressdialog.show_all()
- GObject.idle_add(self._get_document)
-
def _share_document(self):
"""Share the document."""
# FIXME: should ideally have the fileserver listen on a Unix socket