about summary refs log tree commit diff stats
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
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
-rw-r--r--doc/ranger.14
-rw-r--r--doc/ranger.pod4
-rw-r--r--ranger/config/rc.conf21
-rw-r--r--ranger/container/settings.py3
-rw-r--r--ranger/core/fm.py4
5 files changed, 19 insertions, 17 deletions
diff --git a/doc/ranger.1 b/doc/ranger.1
index 34b1d0d7..3ba4fe4e 100644
--- a/doc/ranger.1
+++ b/doc/ranger.1
@@ -273,7 +273,7 @@ This does not work over ssh, requires certain terminals (tested on \*(L"xterm\*(
 \&\*(L"urxvt\*(R") and is incompatible with tmux, although it works with screen.
 .PP
 To enable this feature, install the program \*(L"w3m\*(R" and set the option
-\&\f(CW\*(C`use_w3m_image_preview\*(C'\fR to true.
+\&\f(CW\*(C`preview_images_method\*(C'\fR to w3m.
 .PP
 \fIiTerm2\fR
 .IX Subsection "iTerm2"
@@ -281,7 +281,7 @@ To enable this feature, install the program \*(L"w3m\*(R" and set the option
 This only works in iTerm2 compiled with image preview support, but works over
 ssh.
 .PP
-To enable this feature, set the option \f(CW\*(C`use_iterm2_image_preview\*(C'\fR to true.
+To enable this feature, set the option \f(CW\*(C`preview_images_method\*(C'\fR to iterm2.
 .SS "\s-1SELECTION\s0"
 .IX Subsection "SELECTION"
 The \fIselection\fR is defined as \*(L"All marked files \s-1IF THERE ARE ANY,\s0 otherwise
diff --git a/doc/ranger.pod b/doc/ranger.pod
index 7575e5b6..97a324a8 100644
--- a/doc/ranger.pod
+++ b/doc/ranger.pod
@@ -172,14 +172,14 @@ This does not work over ssh, requires certain terminals (tested on "xterm" and
 "urxvt") and is incompatible with tmux, although it works with screen.
 
 To enable this feature, install the program "w3m" and set the option
-C<use_w3m_image_preview> to true.
+C<preview_images_method> to w3m.
 
 =head3 iTerm2
 
 This only works in iTerm2 compiled with image preview support, but works over
 ssh.
 
-To enable this feature, set the option C<use_iterm2_image_preview> to true.
+To enable this feature, set the option C<preview_images_method> to iterm2.
 
 =head2 SELECTION
 
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()