about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authortoonn <toonn@toonn.io>2021-07-14 20:39:21 +0200
committertoonn <toonn@toonn.io>2021-07-14 20:39:21 +0200
commit5d6b5f62e5e7f8ffbd6a68c2d66d2fc2bf5ef268 (patch)
treed2a20f6e9cfbf74fd1a4fabe9763c482e579ce0d
parent3a9d64f6ba0d45915f0f2e0f6b1bb8bf88e7d2f3 (diff)
parentbab7676e27b433915b6782c37d5e44db08f9d053 (diff)
downloadranger-5d6b5f62e5e7f8ffbd6a68c2d66d2fc2bf5ef268.tar.gz
Merge branch 'clarify-imgdisplayunsupported'
-rw-r--r--ranger/ext/img_display.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/ranger/ext/img_display.py b/ranger/ext/img_display.py
index 6cb6a815..b7e6572f 100644
--- a/ranger/ext/img_display.py
+++ b/ranger/ext/img_display.py
@@ -31,7 +31,7 @@ import codecs
 from tempfile import NamedTemporaryFile
 
 from ranger import PY3
-from ranger.core.shared import FileManagerAware
+from ranger.core.shared import FileManagerAware, SettingsAware
 
 W3MIMGDISPLAY_ENV = "W3MIMGDISPLAY_PATH"
 W3MIMGDISPLAY_OPTIONS = []
@@ -70,8 +70,14 @@ class ImageDisplayError(Exception):
     pass
 
 
-class ImgDisplayUnsupportedException(Exception):
-    pass
+class ImgDisplayUnsupportedException(Exception, SettingsAware):
+    def __init__(self, message=None):
+        if message is None:
+            message = (
+                '"{0}" does not appear to be a valid setting for'
+                ' preview_images_method.'
+            ).format(self.settings.preview_images_method)
+        super(ImgDisplayUnsupportedException, self).__init__(message)
 
 
 def fallback_image_displayer():