From 3db19975a410c201032f7ca2da7db27746c32b48 Mon Sep 17 00:00:00 2001 From: hut Date: Fri, 5 Dec 2014 17:24:26 +0100 Subject: update doc/examples/plugin_filter_file.py The filter_by_filetype branch of Milan Svoboda changed the interface to the accept_file function, so this example plugin broke. --- doc/examples/plugin_file_filter.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'doc') diff --git a/doc/examples/plugin_file_filter.py b/doc/examples/plugin_file_filter.py index bad5a368..b9bea1f3 100644 --- a/doc/examples/plugin_file_filter.py +++ b/doc/examples/plugin_file_filter.py @@ -1,18 +1,20 @@ -# Compatible with ranger 1.6.* +# Compatible since ranger 1.6.1, git commit c82a8a76989c # -# This plugin hides the directories "boot", "sbin", "proc" and "sys" in the -# root directory. +# 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(fname, directory, hidden_filter, name_filter): - if hidden_filter and directory.path == '/' and fname in ('boot', 'sbin', 'proc', 'sys'): - return False - else: - return old_accept_file(fname, directory, hidden_filter, name_filter) +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 -- cgit 1.4.1-2-gfad0 &id=cab68a5cfce9857b650adc03364423204e27827b'>commit diff stats
path: root/linux/apps/ex14.subx
blob: 81520f9007eff497d2ed4c63205c9ab02a8aebb2 (plain) (tree)
1
2
3
4
5