diff options
author | gauravp94 <gparida94@gmail.com> | 2014-08-03 16:52:31 (GMT) |
---|---|---|
committer | gauravp94 <gparida94@gmail.com> | 2014-08-03 16:52:31 (GMT) |
commit | ebd58fe02e00534c80afbf8378323543311398d1 (patch) | |
tree | 10e60640a10d69515fd989ff8845010142df5023 | |
parent | 367f35435834018c282370366c1c7ceda96394aa (diff) |
Handle a URI when the activity startstry1
Needed by the tests.
-rw-r--r-- | ImageViewerActivity.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/ImageViewerActivity.py b/ImageViewerActivity.py index bf73163..83940b8 100644 --- a/ImageViewerActivity.py +++ b/ImageViewerActivity.py @@ -26,7 +26,6 @@ from gettext import gettext as _ import time import os -import math from gi.repository import Gtk from gi.repository import Gdk from gi.repository import GObject @@ -174,7 +173,7 @@ class ImageViewerActivity(activity.Activity): self.set_toolbar_box(toolbar_box) toolbar_box.show() - if self._object_id is None: + if self._object_id is None and handle.uri is None: empty_widgets = Gtk.EventBox() empty_widgets.modify_bg(Gtk.StateType.NORMAL, style.COLOR_WHITE.get_gdk_color()) @@ -210,6 +209,10 @@ class ImageViewerActivity(activity.Activity): empty_widgets.add(vbox) empty_widgets.show_all() self.set_canvas(empty_widgets) + elif handle.uri: + self.read_file(handle.uri) + self.set_canvas(self.scrolled_window) + self.scrolled_window.show() else: self.set_canvas(self.scrolled_window) self.scrolled_window.show() @@ -391,7 +394,7 @@ class ImageViewerActivity(activity.Activity): del chooser def read_file(self, file_path): - if self._object_id is None or self.shared_activity: + if os.stat(file_path).st_size == 0: # read_file is call because the canvas is visible # but we need check if is not the case of empty file return |