diff options
author | hut <hut@lavabit.com> | 2010-04-20 16:26:41 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-04-20 18:58:30 +0200 |
commit | af2c87a88b5fb34cd5d5a385bc79e71643f582e1 (patch) | |
tree | 4f4135c0d33e77487555157c6d25424daa419693 /ranger | |
parent | 996d96d15f58fc796b60bd4be701973f757ca164 (diff) | |
download | ranger-af2c87a88b5fb34cd5d5a385bc79e71643f582e1.tar.gz |
core.loader: fixed
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/core/actions.py | 4 | ||||
-rw-r--r-- | 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 <http://www.gnu.org/licenses/>. 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) |