From e6f86f2a92c566f622fa1089d893b6dd6681a560 Mon Sep 17 00:00:00 2001
From: Gonzalo Odiard <godiard@gmail.com>
Date: Mon, 3 Jun 2013 12:02:22 -0300
Subject: [PATCH] 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>
---
ImageViewerActivity.py | 27 ++++++++++++++++++++++-----
1 file changed, 22 insertions(+), 5 deletions(-)
diff --git a/ImageViewerActivity.py b/ImageViewerActivity.py
index e611dff..45e6ba2 100644
a
|
b
|
class ImageViewerActivity(activity.Activity): |
202 | 202 | |
203 | 203 | self.is_received_document = False |
204 | 204 | |
205 | | if self.shared_activity and handle.object_id is None: |
| 205 | if self.shared_activity: |
206 | 206 | # We're joining, and we don't already have the document. |
207 | 207 | if self.get_shared(): |
208 | 208 | # Already joined for some reason, just get the document |
… |
… |
class ImageViewerActivity(activity.Activity): |
349 | 349 | del chooser |
350 | 350 | |
351 | 351 | def read_file(self, file_path): |
| 352 | if self._object_id is None or self.shared_activity: |
| 353 | # read_file is call because the canvas is visible |
| 354 | # but we need check if is not the case of empty file |
| 355 | return |
| 356 | |
352 | 357 | self._want_document = False |
353 | 358 | |
354 | 359 | tempfile = os.path.join(self.get_activity_root(), 'instance', |
… |
… |
class ImageViewerActivity(activity.Activity): |
399 | 404 | |
400 | 405 | self.progressdialog.destroy() |
401 | 406 | |
402 | | GObject.idle_add(self.__set_file_idle_cb, tempfile) |
403 | | self.save() |
| 407 | GObject.idle_add(self.__set_file_idle_cb, self._jobject.object_id) |
| 408 | |
| 409 | def __set_file_idle_cb(self, object_id): |
| 410 | dsobj = datastore.get(object_id) |
| 411 | self._tempfile = dsobj.file_path |
| 412 | """ This method is used when join a collaboration session """ |
| 413 | self.view.set_file_location(self._tempfile) |
| 414 | try: |
| 415 | zoom = int(self.metadata.get('zoom', '0')) |
| 416 | if zoom > 0: |
| 417 | self.view.set_zoom(zoom) |
| 418 | except Exception: |
| 419 | pass |
| 420 | self.set_canvas(self.scrolled_window) |
| 421 | self.scrolled_window.show_all() |
| 422 | return False |
404 | 423 | |
405 | 424 | def _download_progress_cb(self, getter, bytes_downloaded, tube_id): |
406 | 425 | if self._download_content_length > 0: |
… |
… |
class ImageViewerActivity(activity.Activity): |
490 | 509 | self.progressdialog = ProgressDialog.ProgressDialog(self) |
491 | 510 | self.progressdialog.show_all() |
492 | 511 | |
493 | | GObject.idle_add(self._get_document) |
494 | | |
495 | 512 | def _share_document(self): |
496 | 513 | """Share the document.""" |
497 | 514 | # FIXME: should ideally have the fileserver listen on a Unix socket |