From e07d8797bf8b1029205f48e65241a4819768f310 Mon Sep 17 00:00:00 2001 From: hut Date: Wed, 14 Apr 2010 00:15:50 +0200 Subject: console: move imports to top level --- ranger/gui/widgets/console.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ranger/gui/widgets/console.py b/ranger/gui/widgets/console.py index 0da5cba3..8480ea42 100644 --- a/ranger/gui/widgets/console.py +++ b/ranger/gui/widgets/console.py @@ -20,14 +20,18 @@ commands, searching and executing files. import string import curses +import re from collections import deque from . import Widget from ranger.defaults import commands from ranger.gui.widgets.console_mode import is_valid_mode, mode_to_class from ranger import log, relpath_conf +from ranger.core.runner import ALLOWED_FLAGS from ranger.ext.shell_escape import shell_quote from ranger.ext.get_executables import get_executables +from ranger.container import CommandList, History +from ranger.container.history import HistoryEmptyException import ranger DEFAULT_HISTORY = 0 @@ -57,7 +61,6 @@ class Console(Widget): historypaths = [] def __init__(self, win): - from ranger.container import CommandList, History Widget.__init__(self, win) self.commandlist = CommandList() self.settings.keys.initialize_console_commands(self.commandlist) @@ -155,7 +158,6 @@ class Console(Widget): self.line = '' def press(self, key): - from curses.ascii import ctrl, ESC keytuple = self.env.keybuffer.tuple_with_numbers() try: @@ -197,7 +199,6 @@ class Console(Widget): self.on_line_change() def history_move(self, n): - from ranger.container.history import HistoryEmptyException try: current = self.history.current() except HistoryEmptyException: @@ -385,7 +386,6 @@ class SearchConsole(Console): self.history = self.histories[SEARCH_HISTORY] def execute(self): - import re if self.fm.env.cwd: regexp = re.compile(self.line, re.L | re.U | re.I) self.fm.env.last_search = regexp @@ -612,13 +612,11 @@ class QuickOpenConsole(ConsoleWithTab): return None - def _is_app(self, arg): return self.fm.apps.has(arg) or \ (not self._is_flags(arg) and arg in get_executables()) def _is_flags(self, arg): - from ranger.core.runner import ALLOWED_FLAGS return all(x in ALLOWED_FLAGS for x in arg) def _is_mode(self, arg): -- cgit 1.4.1-2-gfad0