summary refs log tree commit diff stats
path: root/ranger/fm.py
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-12-10 01:37:14 +0100
committerhut <hut@lavabit.com>2009-12-10 01:37:14 +0100
commit871c502d58055c7611f0763eaa71a7fafad7efdc (patch)
tree0f0080aac9f8bdbee5a7d6ca9bf6bb0d4866ffb7 /ranger/fm.py
parentaea67778ad2366b4e4171008af7b0dcd5d91f93b (diff)
downloadranger-871c502d58055c7611f0763eaa71a7fafad7efdc.tar.gz
Restructuration
Diffstat (limited to 'ranger/fm.py')
-rw-r--r--ranger/fm.py31
1 files changed, 18 insertions, 13 deletions
diff --git a/ranger/fm.py b/ranger/fm.py
index 3fcfb92f..2bfecffb 100644
--- a/ranger/fm.py
+++ b/ranger/fm.py
@@ -1,29 +1,34 @@
-from os import devnull
-#from ranger.conf.apps import CustomApplications as Applications
-from ranger.conf import apps
-null = open(devnull, 'a')
-
-class FM(object):
-	def __init__(self, environment, ui, bookmarks):
-		self.env = environment
+from ranger.shared import EnvironmentAware
+
+class FM(EnvironmentAware):
+	def __init__(self, ui, bookmarks):
 		self.ui = ui
-		self.apps = apps.CustomApplications()
+		self.apps = self.env.settings.apps.CustomApplications()
 		self.bookmarks = bookmarks
 		self.bookmarks.enter_dir_function = self.enter_dir
 
-	def run(self):
+		from ranger.shared import FileManagerAware
+		FileManagerAware.fm = self
+
+	def loop(self):
 		self.env.enter_dir(self.env.path)
 
+		gc_tick = 0
+
 		while True:
 			try:
 				self.bookmarks.reload_if_outdated()
 				self.ui.draw()
 				key = self.ui.get_next_key()
 				self.ui.press(key, self)
+
+				gc_tick += 1
+				if gc_tick > 10:
+					gc_tick = 0
+					self.env.garbage_collect()
+
 			except KeyboardInterrupt:
 				self.ui.press(3, self)
-			except:
-				raise
 	
 	def interrupt(self):
 		import time
@@ -53,7 +58,7 @@ class FM(object):
 		self.env.enter_dir(path)
 
 	def enter_bookmark(self, key):
-		from ranger.bookmark import NonexistantBookmark
+		from ranger.container.bookmarks import NonexistantBookmark
 		try:
 			destination = self.bookmarks[key]
 			current_path = self.env.pwd.path