From af2c87a88b5fb34cd5d5a385bc79e71643f582e1 Mon Sep 17 00:00:00 2001 From: hut Date: Tue, 20 Apr 2010 16:26:41 +0200 Subject: core.loader: fixed --- ranger/core/actions.py | 4 ---- ranger/core/loader.py | 13 +++++++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ranger/core/actions.py b/ranger/core/actions.py index 083f0c80..408bbf3a 100644 --- a/ranger/core/actions.py +++ b/ranger/core/actions.py @@ -15,13 +15,10 @@ import os import re -import select import shutil -import time from os.path import join, isdir from os import symlink, getcwd from inspect import cleandoc -from subprocess import Popen, PIPE import ranger from ranger.ext.direction import Direction @@ -29,7 +26,6 @@ from ranger import fsobject from ranger.shared import FileManagerAware, EnvironmentAware, SettingsAware from ranger.gui.widgets import console_mode as cmode from ranger.fsobject import File -from ranger.ext import shutil_generatorized as shutil_g from ranger.core.loader import CommandLoader class Actions(FileManagerAware, EnvironmentAware, SettingsAware): diff --git a/ranger/core/loader.py b/ranger/core/loader.py index e4bc2d95..24dac464 100644 --- a/ranger/core/loader.py +++ b/ranger/core/loader.py @@ -14,9 +14,13 @@ # along with this program. If not, see . from collections import deque -from time import time -from ranger.shared import FileManagerAware +from time import time, sleep +from subprocess import Popen, PIPE import math +import os +import select + +from ranger.shared import FileManagerAware def status_generator(): """Generate a rotating line which can be used as a throbber""" @@ -37,12 +41,12 @@ class LoadableObject(object): class CommandLoader(LoadableObject): def __init__(self, args, descr, begin_hook=None, end_hook=None): - self.description = descr + LoadableObject.__init__(self, self.generate(), descr) self.args = args self.begin_hook = begin_hook self.end_hook = end_hook - def load_generator(self): + def generate(self): process = Popen(self.args, stdout=open(os.devnull, 'w'), stderr=PIPE) if self.begin_hook: self.begin_hook(process) @@ -51,6 +55,7 @@ class CommandLoader(LoadableObject): [process.stderr], [], [], 0.05) if rd: self.notify(process.stderr.readline(), bad=True) + sleep(0.02) yield if self.end_hook(process): self.end_hook(process) -- cgit 1.4.1-2-gfad0