ranger.core.environment
index
../../ranger/core/environment.py

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

 
Modules
       
os

 
Classes
       
ranger.core.shared.FileManagerAware(builtins.object)
Environment(ranger.core.shared.SettingsAware, ranger.core.shared.FileManagerAware, ranger.ext.signals.SignalDispatcher)
ranger.core.shared.SettingsAware(builtins.object)
Environment(ranger.core.shared.SettingsAware, ranger.core.shared.FileManagerAware, ranger.ext.signals.SignalDispatcher)
ranger.ext.signals.SignalDispatcher(builtins.object)
Environment(ranger.core.shared.SettingsAware, ranger.core.shared.FileManagerAware, ranger.ext.signals.SignalDispatcher)

 
class Environment(ranger.core.shared.SettingsAware, ranger.core.shared.FileManagerAware, ranger.ext.signals.SignalDispatcher)
    # COMPAT
 
 
Method resolution order:
Environment
ranger.core.shared.SettingsAware
ranger.core.shared.FileManagerAware
ranger.ext.signals.SignalDispatcher
builtins.object

Methods defined here:
__init__(self, path)
get_free_space(self, path)

Data descriptors defined here:
assign_cursor_positions_for_subdirs
at_level
cf
copy
cut
cwd
ensure_correct_pointer
enter_dir
garbage_collect
get_directory
get_selection
history
history_go
home_path
hostname
keybuffer
keymaps
last_search
path
pathway
username

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

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().