summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorDelisa Mason <iskanamagus@gmail.com>2015-03-09 14:41:58 -0700
committerDelisa Mason <iskanamagus@gmail.com>2015-03-09 14:41:58 -0700
commit7e85001052e4398f71e50e731899800106d2eefd (patch)
tree0b404754fd324a5e5911194ae171a84798f13d90 /ranger
parent84417076a58ec3be7ad08ca959b5bacab8955e72 (diff)
downloadranger-7e85001052e4398f71e50e731899800106d2eefd.tar.gz
Consolidate image preview method preferences
* Remove use_w3m_image_preview and use_iterm2_image_preview in favor of
preview_images_method, easing the development of other image preview
methods as needed
Diffstat (limited to 'ranger')
-rw-r--r--ranger/config/rc.conf21
-rw-r--r--ranger/container/settings.py3
-rw-r--r--ranger/core/fm.py4
3 files changed, 15 insertions, 13 deletions
diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf
index e569d602..e55ab2be 100644
--- a/ranger/config/rc.conf
+++ b/ranger/config/rc.conf
@@ -61,15 +61,18 @@ set vcs_backend_bzr disabled
 # Use one of the supported image preview protocols
 set preview_images false
 
-# Preview images in full color with the external command "w3mimgpreview"?
-# This requires the console web browser "w3m" and a supported terminal.
-# It has been successfully tested with "xterm" and "urxvt" without tmux.
-set use_w3m_image_preview false
-
-# Preview images in full color using iTerm2 image previews
-# (http://iterm2.com/images.html). This requires using iTerm2 compiled
-# with image preview support.
-set use_iterm2_image_preview false
+# Set the preview image method. Supported methods:
+#
+# * w3m (default):
+#   Preview images in full color with the external command "w3mimgpreview"?
+#   This requires the console web browser "w3m" and a supported terminal.
+#   It has been successfully tested with "xterm" and "urxvt" without tmux.
+#
+# * iterm2:
+#   Preview images in full color using iTerm2 image previews
+#   (http://iterm2.com/images.html). This requires using iTerm2 compiled
+#   with image preview support.
+set preview_images_method w3m
 
 # Use a unicode "..." character to mark cut-off filenames?
 set unicode_ellipsis false
diff --git a/ranger/container/settings.py b/ranger/container/settings.py
index 6adc62ea..27737eb1 100644
--- a/ranger/container/settings.py
+++ b/ranger/container/settings.py
@@ -35,6 +35,7 @@ ALLOWED_SETTINGS = {
     'preview_directories': bool,
     'preview_files': bool,
     'preview_images': bool,
+    'preview_images_method': str,
     'preview_max_size': int,
     'preview_script': (str, type(None)),
     'save_console_history': bool,
@@ -55,8 +56,6 @@ ALLOWED_SETTINGS = {
     'update_title': bool,
     'update_tmux_title': bool,
     'use_preview_script': bool,
-    'use_iterm2_image_preview': bool,
-    'use_w3m_image_preview' : bool,
     'vcs_aware': bool,
     'vcs_backend_bzr': str,
     'vcs_backend_git': str,
diff --git a/ranger/core/fm.py b/ranger/core/fm.py
index 2d5d3c1e..b32a2c33 100644
--- a/ranger/core/fm.py
+++ b/ranger/core/fm.py
@@ -185,9 +185,9 @@ class FM(Actions, SignalDispatcher):
                     raise
 
     def _get_image_displayer(self):
-        if self.settings.use_w3m_image_preview:
+        if self.settings.preview_images_method == "w3m":
             return W3MImageDisplayer()
-        elif self.settings.use_iterm2_image_preview:
+        elif self.settings.preview_images_method == "iterm2":
             return ITerm2ImageDisplayer()
         else:
             return ImageDisplayer()