summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-10-14 17:52:21 +0200
committerhut <hut@lavabit.com>2010-10-14 17:52:21 +0200
commit02fd8621d2252f49920d0365b317db4c90c97c81 (patch)
tree1b51374d2de75cadc77506b23630e809185dd1d6
parentc1d6967ddd4c3565895717418234ceb5543b9dea (diff)
downloadranger-02fd8621d2252f49920d0365b317db4c90c97c81.tar.gz
core.main: import stuff only when needed
-rw-r--r--ranger/core/main.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/ranger/core/main.py b/ranger/core/main.py
index 36067a5d..c11be241 100644
--- a/ranger/core/main.py
+++ b/ranger/core/main.py
@@ -24,14 +24,9 @@ def main():
 	import locale
 	import os.path
 	import ranger
-	from ranger.ext import curses_interrupt_handler
-	from ranger.core.runner import Runner
-	from ranger.core.fm import FM
-	from ranger.core.environment import Environment
-	from ranger.gui.defaultui import DefaultUI as UI
-	from ranger.fsobject import File
 	from ranger.core.shared import (EnvironmentAware, FileManagerAware,
 			SettingsAware)
+	from ranger.core.fm import FM
 
 	try:
 		locale.setlocale(locale.LC_ALL, '')
@@ -60,6 +55,8 @@ def main():
 		elif os.path.isfile(target):
 			def print_function(string):
 				print(string)
+			from ranger.core.runner import Runner
+			from ranger.fsobject import File
 			runner = Runner(logfunc=print_function)
 			load_apps(runner, arg.clean)
 			runner(files=[File(target)], mode=arg.mode, flags=arg.flags)
@@ -68,6 +65,7 @@ def main():
 	crash_traceback = None
 	try:
 		# Initialize objects
+		from ranger.core.environment import Environment
 		fm = FM()
 		FileManagerAware.fm = fm
 		EnvironmentAware.env = Environment(target)
@@ -76,8 +74,8 @@ def main():
 		load_settings(fm, arg.clean)
 		if fm.env.username == 'root':
 			fm.settings.preview_files = False
-		fm.ui = UI()
 		if not arg.debug:
+			from ranger.ext import curses_interrupt_handler
 			curses_interrupt_handler.install_interrupt_handler()
 
 		# Run the file manager