From 708498b97ba9b576cba304e0d07de63e48b833e3 Mon Sep 17 00:00:00 2001 From: hut Date: Sun, 5 Aug 2012 01:10:28 +0200 Subject: core.environment: s/fm.env.directories/fm.directories --- ranger/core/environment.py | 18 ++++++++---------- ranger/core/fm.py | 1 + 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/ranger/core/environment.py b/ranger/core/environment.py index 153e4f55..affef49b 100644 --- a/ranger/core/environment.py +++ b/ranger/core/environment.py @@ -10,9 +10,9 @@ from ranger.fsobject import Directory from ranger.ext.keybinding_parser import KeyBuffer, KeyMaps from ranger.container.history import History from ranger.ext.signals import SignalDispatcher -from ranger.core.shared import SettingsAware +from ranger.core.shared import SettingsAware, FileManagerAware -class Environment(SettingsAware, SignalDispatcher): +class Environment(SettingsAware, FileManagerAware, SignalDispatcher): """ A collection of data which is relevant for more than one class. """ @@ -22,7 +22,6 @@ class Environment(SettingsAware, SignalDispatcher): cmd = None cut = None history = None - directories = None last_search = None pathway = None path = None @@ -32,7 +31,6 @@ class Environment(SettingsAware, SignalDispatcher): self.path = abspath(expanduser(path)) self._cf = None self.pathway = () - self.directories = {} self.keybuffer = KeyBuffer() self.keymaps = KeyMaps(self.keybuffer) self.copy = set() @@ -83,7 +81,7 @@ class Environment(SettingsAware, SignalDispatcher): else: return None try: - return self.directories[directory.path] + return self.fm.directories[directory.path] except AttributeError: return None except KeyError: @@ -91,14 +89,14 @@ class Environment(SettingsAware, SignalDispatcher): def garbage_collect(self, age, tabs): """Delete unused directory objects""" - for key in tuple(self.directories): - value = self.directories[key] + for key in tuple(self.fm.directories): + value = self.fm.directories[key] if age != -1: if not value.is_older_than(age) or value in self.pathway: continue if value in tabs.values(): continue - del self.directories[key] + del self.fm.directories[key] if value.is_directory: value.files = None self.settings.signal_garbage_collect() @@ -113,10 +111,10 @@ class Environment(SettingsAware, SignalDispatcher): """Get the directory object at the given path""" path = abspath(path) try: - return self.directories[path] + return self.fm.directories[path] except KeyError: obj = Directory(path) - self.directories[path] = obj + self.fm.directories[path] = obj return obj def get_free_space(self, path): diff --git a/ranger/core/fm.py b/ranger/core/fm.py index 3264196f..161818b9 100644 --- a/ranger/core/fm.py +++ b/ranger/core/fm.py @@ -41,6 +41,7 @@ class FM(Actions, SignalDispatcher): Actions.__init__(self) SignalDispatcher.__init__(self) self.ui = ui + self.directories = dict() self.log = deque(maxlen=20) self.bookmarks = bookmarks self.tags = tags -- cgit 1.4.1-2-gfad0