| |
- 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 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
|
|