From 2d5efba042d2b8953f654907167b496450e1fe71 Mon Sep 17 00:00:00 2001 From: hut Date: Mon, 10 Oct 2011 17:17:14 +0200 Subject: fsobject.fsobject: Added fsobject._mark back in This way you can do :eval fm.env.cf.mark(True) and other cool things. --- ranger/fsobject/directory.py | 10 +++++----- ranger/fsobject/fsobject.py | 4 ++++ 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) -- cgit 1.4.1-2-gfad0