summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2011-10-10 17:17:14 +0200
committerhut <hut@lavabit.com>2011-10-10 17:19:04 +0200
commit2d5efba042d2b8953f654907167b496450e1fe71 (patch)
treeba492390bbf7914cc784935f8ccb83474ae3db71
parent177a6d04e0ae9f31195fd31ccb649abda2e9b420 (diff)
downloadranger-2d5efba042d2b8953f654907167b496450e1fe71.tar.gz
fsobject.fsobject: Added fsobject._mark back in
This way you can do :eval fm.env.cf.mark(True) and other cool things.
-rw-r--r--ranger/fsobject/directory.py10
-rw-r--r--ranger/fsobject/fsobject.py4
2 files changed, 9 insertions, 5 deletions
diff --git a/ranger/fsobject/directory.py b/ranger/fsobject/directory.py
index 0130cc7b..bd652655 100644
--- a/ranger/fsobject/directory.py
+++ b/ranger/fsobject/directory.py
@@ -43,7 +43,7 @@ def sort_naturally(path):
 def sort_naturally_icase(path):
 	return path.basename_natural_lower
 
-def accept_file(fname, directory, hidden_filter, name_filter):
+def accept_file(fname, dirname, hidden_filter, name_filter):
 	if hidden_filter:
 		try:
 			if hidden_filter.search(fname):
@@ -116,7 +116,7 @@ class Directory(FileSystemObject, Accumulator, Loadable, SettingsAware):
 		return self.files
 
 	def mark_item(self, item, val):
-		item.mark(val)
+		item._mark(val)
 		if val:
 			if item in self.files and not item in self.marked_items:
 				self.marked_items.append(item)
@@ -151,7 +151,7 @@ class Directory(FileSystemObject, Accumulator, Loadable, SettingsAware):
 
 	def _clear_marked_items(self):
 		for item in self.marked_items:
-			item.mark(False)
+			item._mark(False)
 		del self.marked_items[:]
 
 	def get_selection(self):
@@ -231,10 +231,10 @@ class Directory(FileSystemObject, Accumulator, Loadable, SettingsAware):
 				self._clear_marked_items()
 				for item in self.files:
 					if item.path in marked_paths:
-						item.mark(True)
+						item._mark(True)
 						self.marked_items.append(item)
 					else:
-						item.mark(False)
+						item._mark(False)
 
 				self.sort()
 
diff --git a/ranger/fsobject/fsobject.py b/ranger/fsobject/fsobject.py
index d112904e..84b07e61 100644
--- a/ranger/fsobject/fsobject.py
+++ b/ranger/fsobject/fsobject.py
@@ -156,6 +156,10 @@ class FileSystemObject(FileManagerAware):
 			return self._mimetype_tuple
 
 	def mark(self, boolean):
+		directory = self.env.get_directory(self.dirname)
+		directory.mark_item(self)
+
+	def _mark(self, boolean):
 		"""Called by directory.mark_item() and similar functions"""
 		self.marked = bool(boolean)