summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/container/settingobject.py1
-rw-r--r--ranger/core/actions.py2
-rw-r--r--ranger/defaults/options.py6
-rw-r--r--ranger/fsobject/file.py3
-rw-r--r--ranger/gui/widgets/browserview.py4
5 files changed, 11 insertions, 5 deletions
diff --git a/ranger/container/settingobject.py b/ranger/container/settingobject.py
index c8bd8b49..51d6db1a 100644
--- a/ranger/container/settingobject.py
+++ b/ranger/container/settingobject.py
@@ -48,6 +48,7 @@ ALLOWED_SETTINGS = {
 	'sort': str,
 	'tilde_in_titlebar': bool,
 	'update_title': bool,
+	'use_preview_script': bool,
 	'xterm_alt_key': bool,
 }
 
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index a815b111..2f6d2719 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -576,7 +576,7 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
 	# -- Previews
 	# --------------------------
 	def get_preview(self, path, width, height):
-		if self.settings.preview_script:
+		if self.settings.preview_script and self.settings.use_preview_script:
 			# self.previews is a 2 dimensional dict:
 			# self.previews['/tmp/foo.jpg'][(80, 24)] = "the content..."
 			# self.previews['/tmp/foo.jpg']['loading'] = False
diff --git a/ranger/defaults/options.py b/ranger/defaults/options.py
index 3c20c6fb..845e451f 100644
--- a/ranger/defaults/options.py
+++ b/ranger/defaults/options.py
@@ -40,12 +40,14 @@ hidden_filter = regexp(
 show_hidden = False
 
 # Which script is used to generate file previews?
-#preview_script = None
-
 # Ranger ships with scope.sh, a script that calls external programs (see
 # README for dependencies) to preview images, archives, etc.
 preview_script = '~/.config/ranger/scope.sh'
 
+# Use that external preview script or display internal plain text previews?
+# Set to False by default for performance and stability reasons
+use_preview_script = False
+
 # Show dotfiles in the bookmark preview box?
 show_hidden_bookmarks = True
 
diff --git a/ranger/fsobject/file.py b/ranger/fsobject/file.py
index 5fd90b96..9fce3255 100644
--- a/ranger/fsobject/file.py
+++ b/ranger/fsobject/file.py
@@ -83,7 +83,8 @@ class File(FileSystemObject):
 			return False
 		if not self.accessible:
 			return False
-		if self.fm.settings.preview_script:
+		if self.fm.settings.preview_script and \
+				self.fm.settings.use_preview_script:
 			return True
 		if self.image or self.container:
 			return False
diff --git a/ranger/gui/widgets/browserview.py b/ranger/gui/widgets/browserview.py
index e222c582..8a8f6e14 100644
--- a/ranger/gui/widgets/browserview.py
+++ b/ranger/gui/widgets/browserview.py
@@ -202,7 +202,9 @@ class BrowserView(Widget, DisplayableContainer):
 			return False
 		result = not self.columns[-1].has_preview()
 		target = self.columns[-1].target
-		if not result and target and target.is_file:
+		if not result and target and target.is_file and \
+			self.fm.settings.preview_script and \
+			self.fm.settings.use_preview_script:
 			try:
 				result = not self.fm.previews[target.realpath]['foundpreview']
 			except:
='/akkartik/mu/commit/html/404stream.mu.html?h=main&id=68df24fa778f7f5a2651a4623681f38dc920c490'>68df24fa ^
828bc320 ^
68df24fa ^
828bc320 ^
d3a9db3a ^
828bc320 ^
d3a9db3a ^
828bc320 ^

68df24fa ^

828bc320 ^
68df24fa ^
828bc320 ^
d3a9db3a ^
828bc320 ^



d3a9db3a ^
828bc320 ^
68df24fa ^

828bc320 ^


68df24fa ^

828bc320 ^

91a5f3e1 ^



2c56af2d ^
91a5f3e1 ^









2c56af2d ^
91a5f3e1 ^






828bc320 ^



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131