From c0f2fc72eccb4127fba5f48ce4b422487d6ec752 Mon Sep 17 00:00:00 2001 From: hut Date: Mon, 13 Apr 2015 12:49:49 +0200 Subject: moved "doc/examples" to "examples" for more visibility --- examples/plugin_file_filter.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 examples/plugin_file_filter.py (limited to 'examples/plugin_file_filter.py') diff --git a/examples/plugin_file_filter.py b/examples/plugin_file_filter.py new file mode 100644 index 00000000..b9bea1f3 --- /dev/null +++ b/examples/plugin_file_filter.py @@ -0,0 +1,21 @@ +# Compatible since ranger 1.6.1, git commit c82a8a76989c +# +# This plugin hides the directories "/boot", "/sbin", "/proc" and "/sys" unless +# the "show_hidden" option is activated. + +# Save the original filter function +import ranger.container.directory +old_accept_file = ranger.container.directory.accept_file + +HIDE_FILES = ("/boot", "/sbin", "/proc", "/sys") + +# Define a new one +def custom_accept_file(file, filters): + if not file.fm.settings.show_hidden and file.path in HIDE_FILES: + return False + else: + return old_accept_file(file, filters) + +# Overwrite the old function +import ranger.container.directory +ranger.container.directory.accept_file = custom_accept_file -- cgit 1.4.1-2-gfad0 a href='/danisanti/profani-tty/log/themes/batman'>log tree commit diff stats
path: root/themes/batman
blob: fc8ce1be4bd83796db406b75b6f849f6024564bf (plain) (blame)
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
re>