ranger.core.fm (version 1.6.1)
index
../../ranger/core/fm.py

The File Manager, putting the pieces together

 
Modules
       
mimetypes
os
pwd
ranger
socket
stat
sys

 
Classes
       
ranger.core.actions.Actions(ranger.core.shared.FileManagerAware, ranger.core.shared.EnvironmentAware, ranger.core.shared.SettingsAware)
FM(ranger.core.actions.Actions, ranger.ext.signals.SignalDispatcher)
ranger.ext.signals.SignalDispatcher(builtins.object)
FM(ranger.core.actions.Actions, ranger.ext.signals.SignalDispatcher)

 
class FM(ranger.core.actions.Actions, ranger.ext.signals.SignalDispatcher)
    
Method resolution order:
FM
ranger.core.actions.Actions
ranger.core.shared.FileManagerAware
ranger.core.shared.EnvironmentAware
ranger.core.shared.SettingsAware
ranger.ext.signals.SignalDispatcher
builtins.object

Methods defined here:
__init__(self, ui=None, bookmarks=None, tags=None, paths=['.'])
Initialize FM.
block_input(self, sec=0)
confpath(self, *paths)
returns the path relative to rangers configuration directory
copy_config_files(self, which)
destroy(self)
garbage_collect(self, age, tabs=None)
Delete unused directory objects
get_directory(self, path)
Get the directory object at the given path
initialize(self)
If ui/bookmarks are None, they will be initialized here.
input_is_blocked(self)
loop(self)
The main loop of ranger.
 
It consists of:
1. reloading bookmarks if outdated
2. letting the loader work
3. drawing and finalizing ui
4. reading and handling user input
5. after X loops: collecting unused directory objects
relpath(self, *paths)
returns the path relative to rangers library directory

Data descriptors defined here:
thisdir
thisfile

Data and other attributes defined here:
input_blocked = False
input_blocked_until = 0
mode = 'normal'
search_method = 'ctime'

Methods inherited from ranger.core.actions.Actions:
abort(self)
cd(self, path, remember=True)
enter the directory at the given path, remember=True
change_mode(self, mode)
copy(self, mode='set', narg=None, dirarg=None)
Copy the selected items.  Modes are: 'set', 'add', 'remove'.
cut(self, mode='set', narg=None, dirarg=None)
delete(self)
display_command_help(self, console_widget)
display_file(self)
display_help(self)
display_log(self)
draw_bookmarks(self)
draw_possible_programs(self)
dump_commands(self)
dump_keybindings(self, *contexts)
dump_settings(self)
edit_file(self, file=None)
Calls execute_file with the current file and label='editor'
enter_bookmark(self, key)
Enter the bookmark with the name <key>
enter_dir(self, path, remember=False, history=True)
Enter the directory at the given path
execute_command(self, cmd, **kw)
execute_console(self, string='', wildcards=[], quantifier=None)
Execute a command for the console
execute_file(self, files, **kw)
Execute a file.
 
app is the name of a method in Applications, without the "app_"
flags is a string consisting of runner.ALLOWED_FLAGS
mode is a positive integer.
Both flags and mode specify how the program is run.
exit(self)
Exit the program
get_cumulative_size(self)
get_preview(self, file, width, height)
hide_bookmarks(self)
hide_console_info(self)
history_go(self, relative)
Move back and forth in the history
mark_files(self, all=False, toggle=False, val=None, movedown=None, narg=1)
A wrapper for the directory.mark_xyz functions.
 
Arguments:
all - change all files of the current directory at once?
toggle - toggle the marked-status?
val - mark or unmark?
mark_in_direction(self, val=True, dirarg=None)
mkdir(self, name)
move(self, narg=None, **kw)
A universal movement method.
 
Accepts these parameters:
(int) down, (int) up, (int) left, (int) right, (int) to,
(bool) absolute, (bool) relative, (bool) pages,
(bool) percentage
 
to=X is translated to down=X, absolute=True
 
Example:
move(down=4, pages=True)  # moves down by 4 pages.
move(to=2, pages=True)  # moves to page 2.
move(to=1, percentage=True)  # moves to 80%
move_parent(self, n, narg=None)
notify(self, text, duration=4, bad=False)
open_console(self, string='', prompt=None, position=None)
Open the console
pager_close(self)
pager_move(self, narg=None, **kw)
paste(self, overwrite=False)
Paste the selected items into the current directory
paste_hardlink(self)
paste_hardlinked_subtree(self)
paste_symlink(self, relative=False)
pause_tasks(self)
redraw_window(self)
Redraw the window
reload_cwd(self)
rename(self, src, dest)
reset(self)
Reset the filemanager, clearing the directory buffer
scroll(self, relative)
Scroll down by <relative> lines
search_file(self, text, offset=1, regexp=True)
search_next(self, order=None, offset=1, forward=True)
select_file(self, path)
set_bookmark(self, key)
Set the bookmark with the name <key> to the current directory
set_filter(self, fltr)
set_option(self, optname, value)
Set the value of an option named <optname>
set_option_from_string(self, option_name, value, localpath=None, tags=None)
set_search_method(self, order, forward=True)
sort(self, func=None, reverse=None)
source(self, filename)
substitute_macros(self, string, additional={}, escape=False)
tab_close(self, name=None)
tab_move(self, offset)
tab_new(self, path=None)
tab_open(self, name, path=None)
# --------------------------
# -- Tabs
# --------------------------
tab_restore(self)
tag_add(self, paths=None, movedown=None)
tag_remove(self, paths=None, movedown=None)
tag_toggle(self, paths=None, value=None, movedown=None, tag=None)
taskview_close(self)
taskview_move(self, narg=None, **kw)
taskview_open(self)
toggle_option(self, string)
Toggle a boolean option named <string>
toggle_visual_mode(self, reverse=False)
traverse(self)
uncut(self)
unset_bookmark(self, key)
Delete the bookmark with the name <key>
update_preview(self, path)
# --------------------------
# -- Previews
# --------------------------

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)

Methods inherited from ranger.core.shared.EnvironmentAware:
env = None
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().

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