From 225ec0de2ef31d248ae932963089fb31a874763a Mon Sep 17 00:00:00 2001 From: Lan Zagar Date: Thu, 15 Dec 2016 15:22:34 +0100 Subject: [PATCH] Merge pull request #1824 from ajdapretnar/fix-image-viewere OWImageViewer: Fix missing images on windows --- Orange/widgets/data/owimageviewer.py | 7 +++++-- Orange/widgets/data/tests/test_owimageviewer.py | 0 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 Orange/widgets/data/tests/test_owimageviewer.py diff --git a/Orange/widgets/data/owimageviewer.py b/Orange/widgets/data/owimageviewer.py index 46ce4429fc5..57f58fa8e8e 100644 --- a/Orange/widgets/data/owimageviewer.py +++ b/Orange/widgets/data/owimageviewer.py @@ -1069,8 +1069,11 @@ def urlFromValue(self, value): if base.strip() and not base.endswith("/"): origin.setPath(base + "/") - name = QUrl(str(value)) - url = origin.resolved(name) + if os.path.exists(str(value)): + url = QUrl.fromLocalFile(str(value)) + else: + name = QUrl(str(value)) + url = origin.resolved(name) if not url.scheme(): url.setScheme("file") return url diff --git a/Orange/widgets/data/tests/test_owimageviewer.py b/Orange/widgets/data/tests/test_owimageviewer.py new file mode 100644 index 00000000000..e69de29bb2d