ranger.core.loader
index
../../ranger/core/loader.py

# Copyright (C) 2009-2013  Roman Zimbelmann <hut@lavabit.com>
# This software is distributed under the terms of the GNU GPL version 3.

 
Modules
       
math
os
select
sys

 
Classes
       
builtins.object
Loadable
CommandLoader(Loadable, ranger.ext.signals.SignalDispatcher, ranger.core.shared.FileManagerAware)
CopyLoader(Loadable, ranger.core.shared.FileManagerAware)
ranger.core.shared.FileManagerAware(builtins.object)
Loader

 
class CommandLoader(Loadable, ranger.ext.signals.SignalDispatcher, ranger.core.shared.FileManagerAware)
    Run an external command with the loader.
 
Output from stderr will be reported.  Ensure that the process doesn't
ever ask for input, otherwise the loader will be blocked until this
object is removed from the queue (type ^C in ranger)
 
 
Method resolution order:
CommandLoader
Loadable
ranger.ext.signals.SignalDispatcher
ranger.core.shared.FileManagerAware
builtins.object

Methods defined here:
__init__(self, args, descr, silent=False, read=False, input=None, kill_on_pause=False)
destroy(self)
generate(self)
pause(self)
unpause(self)

Data and other attributes defined here:
finished = False
process = None

Methods inherited from Loadable:
get_description(self)

Data descriptors inherited from Loadable:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from Loadable:
paused = False
progressbar_supported = False

Methods inherited from ranger.ext.signals.SignalDispatcher:
signal_bind(self, signal_name, function, priority=0.5, weak=False, autosort=True)
Bind a function to the signal.
 
signal_name:  Any string to name the signal
function:  Any function with either one or zero arguments which will be
    called when the signal is emitted.  If it takes one argument, a
    Signal object will be passed to it.
priority:  Optional, any number.  When signals are emitted, handlers will
    be called in order of priority.  (highest priority first)
weak:  Use a weak reference of "function" so it can be garbage collected
    properly when it's deleted.
 
Returns a SignalHandler which can be used to remove this binding by
passing it to signal_unbind().
signal_clear(self)
Remove all signals.
signal_emit(self, signal_name, **kw)
Emits a signal and call every function that was bound to that signal.
 
You can call this method with any key words.  They will be turned into
attributes of the Signal object that is passed to the functions.
If a function calls signal.stop(), no further functions will be called.
If a function raises a ReferenceError, the handler will be deleted.
 
Returns False if signal.stop() was called and True otherwise.
signal_force_sort(self, signal_name=None)
Forces a sorting of signal handlers by priority.
 
This is only necessary if you used signal_bind with autosort=False
after finishing to bind many signals at once.
signal_garbage_collect(self)
Remove all handlers with deleted weak references.
 
Usually this is not needed; every time you emit a signal, its handlers
are automatically checked in this way.  However, if you can't be sure
that a signal is ever emitted AND you keep binding weakly referenced
functions to the signal, this method should be regularly called to
avoid memory leaks in self._signals.
 
>>> sig = SignalDispatcher()
 
>>> # lambda:None is an anonymous function which has no references
>>> # so it should get deleted immediately
>>> handler = sig.signal_bind('test', lambda: None, weak=True)
>>> len(sig._signals['test'])
1
>>> # need to call garbage collect so that it's removed from the list.
>>> sig.signal_garbage_collect()
>>> len(sig._signals['test'])
0
>>> # This demonstrates that garbage collecting is not necessary
>>> # when using signal_emit().
>>> handler = sig.signal_bind('test', lambda: None, weak=True)
>>> sig.signal_emit('another_signal')
True
>>> len(sig._signals['test'])
1
>>> sig.signal_emit('test')
True
>>> len(sig._signals['test'])
0
signal_unbind(self, signal_handler)
Removes a signal binding.
 
This requires the SignalHandler that has been originally returned by
signal_bind().

 
class CopyLoader(Loadable, ranger.core.shared.FileManagerAware)
    
Method resolution order:
CopyLoader
Loadable
ranger.core.shared.FileManagerAware
builtins.object

Methods defined here:
__init__(self, copy_buffer, do_cut=False, overwrite=False)
generate(self)

Data and other attributes defined here:
progressbar_supported = True

Methods inherited from Loadable:
destroy(self)
get_description(self)
pause(self)
unpause(self)

Data descriptors inherited from Loadable:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from Loadable:
paused = False

 
class Loadable(builtins.object)
     Methods defined here:
__init__(self, gen, descr)
destroy(self)
get_description(self)
pause(self)
unpause(self)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
paused = False
progressbar_supported = False

 
class Loader(ranger.core.shared.FileManagerAware)
    
Method resolution order:
Loader
ranger.core.shared.FileManagerAware
builtins.object

Methods defined here:
__init__(self)
add(self, obj)
Add an object to the queue.
 
It should have a load_generator method.
destroy(self)
has_work(self)
Is there anything to load?
move(self, _from, to)
pause(self, state)
Change the pause-state to 1 (pause), 0 (no pause) or -1 (toggle)
remove(self, item=None, index=None)
rotate(self)
Rotate the throbber
work(self)
Load items from the queue if there are any.
 
Stop after approximately self.seconds_of_work_time.

Data and other attributes defined here:
paused = False
seconds_of_work_time = 0.03
throbber_chars = r'/-\|'
throbber_paused = '#'

Data descriptors inherited from ranger.core.shared.FileManagerAware:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Functions
       
safeDecode(string)
sleep(...)
sleep(seconds)
 
Delay execution for a given number of seconds.  The argument may be
a floating point number for subsecond precision.
time(...)
time() -> floating point number
 
Return the current time in seconds since the Epoch.
Fractions of a second may be present if the system clock provides them.

 
Data
        HAVE_CHARDET = False
PIPE = -1