summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2011-02-18 21:06:33 +0000
committerhut <hut@lavabit.com>2011-02-18 21:06:33 +0000
commited3d9f274605b1034c6920e9298043ccf28f775d (patch)
tree8f602263c408a105ca62b2baa5b43f7b09208dfb
parentf51fc9f68bba0e0b2be754919fe30404573dbb43 (diff)
downloadranger-ed3d9f274605b1034c6920e9298043ccf28f775d.tar.gz
fsobject.directory: added dirname argument to accept_file
this is to enable customized file hiding functions. eg:

import ranger.fsobject.directory
def accept_file(fname, dirname, hidden_filter, name_filter):
    if <file should be hidden>:
      return False
    return True
ranger.fsobject.directory.accept_file = accept_file

this in options.py or something
-rw-r--r--ranger/fsobject/directory.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/ranger/fsobject/directory.py b/ranger/fsobject/directory.py
index c5c1e6a9..3c0f680d 100644
--- a/ranger/fsobject/directory.py
+++ b/ranger/fsobject/directory.py
@@ -46,7 +46,7 @@ def sort_naturally(path):
 def sort_naturally_icase(path):
 	return path.basename_natural_lower
 
-def accept_file(fname, hidden_filter, name_filter):
+def accept_file(fname, dirname, hidden_filter, name_filter):
 	if hidden_filter:
 		try:
 			if hidden_filter.search(fname):
@@ -182,8 +182,8 @@ class Directory(FileSystemObject, Accumulator, Loadable, SettingsAware):
 				hidden_filter = not self.settings.show_hidden \
 						and self.settings.hidden_filter
 				filenames = [mypath + (mypath == '/' and fname or '/' + fname)\
-						for fname in os.listdir(mypath) \
-						if accept_file(fname, hidden_filter, self.filter)]
+						for fname in os.listdir(mypath) if accept_file(
+							fname, mypath, hidden_filter, self.filter)]
 				yield
 
 				self.load_content_mtime = os.stat(mypath).st_mtime