ranger.gui.widgets.console
index
/home/hut/ranger/ranger/gui/widgets/console.py

The Console widget implements a vim-like console for entering
commands, searching and executing files.

 
Modules
       
ranger.defaults.commands
curses
string

 
Classes
       
ranger.gui.widgets.Widget(ranger.gui.displayable.Displayable)
Console
ConsoleWithTab
CommandConsole
QuickCommandConsole
OpenConsole
QuickOpenConsole
SearchConsole

 
class CommandConsole(ConsoleWithTab)
    
Method resolution order:
CommandConsole
ConsoleWithTab
Console
ranger.gui.widgets.Widget
ranger.gui.displayable.Displayable
ranger.shared.EnvironmentAware
ranger.shared.FileManagerAware
ranger.shared.Awareness
ranger.gui.curses_shortcuts.CursesShortcuts
ranger.shared.settings.SettingsAware
__builtin__.object

Methods defined here:
execute(self, cmd=None)

Data and other attributes defined here:
prompt = ':'

Methods inherited from ConsoleWithTab:
tab(self, n=1)

Methods inherited from Console:
__init__(self, win)
add_to_history(self)
clear(self)
close(self)
delete(self, mod)
delete_rest(self, direction)
delete_word(self)
draw(self)
finalize(self)
history_move(self, n)
init(self)
override this. Called directly after class change
move(self, relative=0, absolute=None)
on_line_change(self)
open(self, mode, string='')
paste(self)
press(self, key)
type_key(self, key)

Data and other attributes inherited from Console:
allow_close = False
commandlist = None
copy = ''
histories = None
history = None
last_cursor_mode = None
mode = None
original_line = None
override = None
tab_deque = None
visible = False

Methods inherited from ranger.gui.displayable.Displayable:
__bool__ = __nonzero__(self)
Always True
__contains__(self, item)
Is item inside the boundaries?
item can be an iterable like [y, x] or an object with x and y methods.
__nonzero__(self)
Always True
__str__(self)
click(self, event)
Called when a mouse key is pressed and self.focused is True.
Override this!
contains_point(self, y, x)
Test whether the point (with absolute coordinates) lies
within the boundaries of this object.
destroy(self)
Called when the object is destroyed.
Override this!
poke(self)
Called before drawing, even if invisible
resize(self, y, x, hei=None, wid=None)
Resize the widget

Data and other attributes inherited from ranger.shared.EnvironmentAware:
env = None

Data and other attributes inherited from ranger.shared.FileManagerAware:
fm = None

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

Methods inherited from ranger.gui.curses_shortcuts.CursesShortcuts:
addnstr(self, *args)
addstr(self, *args)
color(self, *keys)
Change the colors from now on.
color_at(self, y, x, wid, *keys)
Change the colors at the specified position
color_reset(self)
Change the colors to the default colors

Data and other attributes inherited from ranger.shared.settings.SettingsAware:
settings = {}

 
class Console(ranger.gui.widgets.Widget)
    
Method resolution order:
Console
ranger.gui.widgets.Widget
ranger.gui.displayable.Displayable
ranger.shared.EnvironmentAware
ranger.shared.FileManagerAware
ranger.shared.Awareness
ranger.gui.curses_shortcuts.CursesShortcuts
ranger.shared.settings.SettingsAware
__builtin__.object

Methods defined here:
__init__(self, win)
add_to_history(self)
clear(self)
close(self)
delete(self, mod)
delete_rest(self, direction)
delete_word(self)
draw(self)
execute(self)
finalize(self)
history_move(self, n)
init(self)
override this. Called directly after class change
move(self, relative=0, absolute=None)
on_line_change(self)
open(self, mode, string='')
paste(self)
press(self, key)
tab(self)
type_key(self, key)

Data and other attributes defined here:
allow_close = False
commandlist = None
copy = ''
histories = None
history = None
last_cursor_mode = None
mode = None
original_line = None
override = None
prompt = ':'
tab_deque = None
visible = False

Methods inherited from ranger.gui.displayable.Displayable:
__bool__ = __nonzero__(self)
Always True
__contains__(self, item)
Is item inside the boundaries?
item can be an iterable like [y, x] or an object with x and y methods.
__nonzero__(self)
Always True
__str__(self)
click(self, event)
Called when a mouse key is pressed and self.focused is True.
Override this!
contains_point(self, y, x)
Test whether the point (with absolute coordinates) lies
within the boundaries of this object.
destroy(self)
Called when the object is destroyed.
Override this!
poke(self)
Called before drawing, even if invisible
resize(self, y, x, hei=None, wid=None)
Resize the widget

Data and other attributes inherited from ranger.shared.EnvironmentAware:
env = None

Data and other attributes inherited from ranger.shared.FileManagerAware:
fm = None

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

Methods inherited from ranger.gui.curses_shortcuts.CursesShortcuts:
addnstr(self, *args)
addstr(self, *args)
color(self, *keys)
Change the colors from now on.
color_at(self, y, x, wid, *keys)
Change the colors at the specified position
color_reset(self)
Change the colors to the default colors

Data and other attributes inherited from ranger.shared.settings.SettingsAware:
settings = {}

 
class ConsoleWithTab(Console)
    
Method resolution order:
ConsoleWithTab
Console
ranger.gui.widgets.Widget
ranger.gui.displayable.Displayable
ranger.shared.EnvironmentAware
ranger.shared.FileManagerAware
ranger.shared.Awareness
ranger.gui.curses_shortcuts.CursesShortcuts
ranger.shared.settings.SettingsAware
__builtin__.object

Methods defined here:
tab(self, n=1)

Methods inherited from Console:
__init__(self, win)
add_to_history(self)
clear(self)
close(self)
delete(self, mod)
delete_rest(self, direction)
delete_word(self)
draw(self)
execute(self)
finalize(self)
history_move(self, n)
init(self)
override this. Called directly after class change
move(self, relative=0, absolute=None)
on_line_change(self)
open(self, mode, string='')
paste(self)
press(self, key)
type_key(self, key)

Data and other attributes inherited from Console:
allow_close = False
commandlist = None
copy = ''
histories = None
history = None
last_cursor_mode = None
mode = None
original_line = None
override = None
prompt = ':'
tab_deque = None
visible = False

Methods inherited from ranger.gui.displayable.Displayable:
__bool__ = __nonzero__(self)
Always True
__contains__(self, item)
Is item inside the boundaries?
item can be an iterable like [y, x] or an object with x and y methods.
__nonzero__(self)
Always True
__str__(self)
click(self, event)
Called when a mouse key is pressed and self.focused is True.
Override this!
contains_point(self, y, x)
Test whether the point (with absolute coordinates) lies
within the boundaries of this object.
destroy(self)
Called when the object is destroyed.
Override this!
poke(self)
Called before drawing, even if invisible
resize(self, y, x, hei=None, wid=None)
Resize the widget

Data and other attributes inherited from ranger.shared.EnvironmentAware:
env = None

Data and other attributes inherited from ranger.shared.FileManagerAware:
fm = None

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

Methods inherited from ranger.gui.curses_shortcuts.CursesShortcuts:
addnstr(self, *args)
addstr(self, *args)
color(self, *keys)
Change the colors from now on.
color_at(self, y, x, wid, *keys)
Change the colors at the specified position
color_reset(self)
Change the colors to the default colors

Data and other attributes inherited from ranger.shared.settings.SettingsAware:
settings = {}

 
class OpenConsole(ConsoleWithTab)
    The Open Console allows you to execute shell commands:
!vim *         will run vim and open all files in the directory.
 
%f will be replaced with the basename of the highlighted file
%s will be selected with all files in the selection
 
There is a special syntax for more control:
 
!d! mplayer    will run mplayer with flags (d means detached)
!@ mplayer     will open the selected files with mplayer
                   (equivalent to !mplayer %s)
 
Those two can be combinated:
 
!d!@mplayer    will open the selection with a detached mplayer
                           (again, this is equivalent to !d!mplayer %s)
 
For a list of other flags than "d", check chapter 2.5 of the documentation
 
 
Method resolution order:
OpenConsole
ConsoleWithTab
Console
ranger.gui.widgets.Widget
ranger.gui.displayable.Displayable
ranger.shared.EnvironmentAware
ranger.shared.FileManagerAware
ranger.shared.Awareness
ranger.gui.curses_shortcuts.CursesShortcuts
ranger.shared.settings.SettingsAware
__builtin__.object

Methods defined here:
execute(self)
init(self)

Data and other attributes defined here:
prompt = '!'

Methods inherited from ConsoleWithTab:
tab(self, n=1)

Methods inherited from Console:
__init__(self, win)
add_to_history(self)
clear(self)
close(self)
delete(self, mod)
delete_rest(self, direction)
delete_word(self)
draw(self)
finalize(self)
history_move(self, n)
move(self, relative=0, absolute=None)
on_line_change(self)
open(self, mode, string='')
paste(self)
press(self, key)
type_key(self, key)

Data and other attributes inherited from Console:
allow_close = False
commandlist = None
copy = ''
histories = None
history = None
last_cursor_mode = None
mode = None
original_line = None
override = None
tab_deque = None
visible = False

Methods inherited from ranger.gui.displayable.Displayable:
__bool__ = __nonzero__(self)
Always True
__contains__(self, item)
Is item inside the boundaries?
item can be an iterable like [y, x] or an object with x and y methods.
__nonzero__(self)
Always True
__str__(self)
click(self, event)
Called when a mouse key is pressed and self.focused is True.
Override this!
contains_point(self, y, x)
Test whether the point (with absolute coordinates) lies
within the boundaries of this object.
destroy(self)
Called when the object is destroyed.
Override this!
poke(self)
Called before drawing, even if invisible
resize(self, y, x, hei=None, wid=None)
Resize the widget

Data and other attributes inherited from ranger.shared.EnvironmentAware:
env = None

Data and other attributes inherited from ranger.shared.FileManagerAware:
fm = None

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

Methods inherited from ranger.gui.curses_shortcuts.CursesShortcuts:
addnstr(self, *args)
addstr(self, *args)
color(self, *keys)
Change the colors from now on.
color_at(self, y, x, wid, *keys)
Change the colors at the specified position
color_reset(self)
Change the colors to the default colors

Data and other attributes inherited from ranger.shared.settings.SettingsAware:
settings = {}

 
class QuickCommandConsole(CommandConsole)
    The QuickCommandConsole is essentially the same as the
CommandConsole, and includes one additional feature:
After each letter you type, it checks whether the command as it
stands there could be executed in a meaningful way, and if it does,
run it right away.
 
Example:
>cd ..
As you type the last dot, The console will recognize what you mean
and enter the parent directory saving you the time of pressing enter.
 
 
Method resolution order:
QuickCommandConsole
CommandConsole
ConsoleWithTab
Console
ranger.gui.widgets.Widget
ranger.gui.displayable.Displayable
ranger.shared.EnvironmentAware
ranger.shared.FileManagerAware
ranger.shared.Awareness
ranger.gui.curses_shortcuts.CursesShortcuts
ranger.shared.settings.SettingsAware
__builtin__.object

Methods defined here:
on_line_change(self)

Data and other attributes defined here:
prompt = '>'

Methods inherited from CommandConsole:
execute(self, cmd=None)

Methods inherited from ConsoleWithTab:
tab(self, n=1)

Methods inherited from Console:
__init__(self, win)
add_to_history(self)
clear(self)
close(self)
delete(self, mod)
delete_rest(self, direction)
delete_word(self)
draw(self)
finalize(self)
history_move(self, n)
init(self)
override this. Called directly after class change
move(self, relative=0, absolute=None)
open(self, mode, string='')
paste(self)
press(self, key)
type_key(self, key)

Data and other attributes inherited from Console:
allow_close = False
commandlist = None
copy = ''
histories = None
history = None
last_cursor_mode = None
mode = None
original_line = None
override = None
tab_deque = None
visible = False

Methods inherited from ranger.gui.displayable.Displayable:
__bool__ = __nonzero__(self)
Always True
__contains__(self, item)
Is item inside the boundaries?
item can be an iterable like [y, x] or an object with x and y methods.
__nonzero__(self)
Always True
__str__(self)
click(self, event)
Called when a mouse key is pressed and self.focused is True.
Override this!
contains_point(self, y, x)
Test whether the point (with absolute coordinates) lies
within the boundaries of this object.
destroy(self)
Called when the object is destroyed.
Override this!
poke(self)
Called before drawing, even if invisible
resize(self, y, x, hei=None, wid=None)
Resize the widget

Data and other attributes inherited from ranger.shared.EnvironmentAware:
env = None

Data and other attributes inherited from ranger.shared.FileManagerAware:
fm = None

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

Methods inherited from ranger.gui.curses_shortcuts.CursesShortcuts:
addnstr(self, *args)
addstr(self, *args)
color(self, *keys)
Change the colors from now on.
color_at(self, y, x, wid, *keys)
Change the colors at the specified position
color_reset(self)
Change the colors to the default colors

Data and other attributes inherited from ranger.shared.settings.SettingsAware:
settings = {}

 
class QuickOpenConsole(ConsoleWithTab)
    The Quick Open Console allows you to open files with predefined programs
and modes very quickly.  By adding flags to the command, you can specify
precisely how the program is run, e.g. the d-flag will run it detached
from the file manager.
 
For a list of other flags than "d", check chapter 2.5 of the documentation
 
The syntax is "open with: <application> <mode> <flags>".
The parsing of the arguments is very flexible.  You can leave out one or
more arguments (or even all of them) and it will fall back to default
values.  You can switch the order as well.
There is just one rule:
 
If you supply the <application>, it has to be the first argument.
 
Examples:
 
open with: mplayer D     open the selection in mplayer, but not detached
open with: 1             open it with the default handler in mode 1
open with: d             open it detached with the default handler
open with: p             open it as usual, but pipe the output to "less"
open with: totem 1 Ds    open in totem in mode 1, will not detach the
                                                 process (flag D) but discard the output (flag s)
 
 
Method resolution order:
QuickOpenConsole
ConsoleWithTab
Console
ranger.gui.widgets.Widget
ranger.gui.displayable.Displayable
ranger.shared.EnvironmentAware
ranger.shared.FileManagerAware
ranger.shared.Awareness
ranger.gui.curses_shortcuts.CursesShortcuts
ranger.shared.settings.SettingsAware
__builtin__.object

Methods defined here:
execute(self)
init(self)

Data and other attributes defined here:
prompt = 'open with: '

Methods inherited from ConsoleWithTab:
tab(self, n=1)

Methods inherited from Console:
__init__(self, win)
add_to_history(self)
clear(self)
close(self)
delete(self, mod)
delete_rest(self, direction)
delete_word(self)
draw(self)
finalize(self)
history_move(self, n)
move(self, relative=0, absolute=None)
on_line_change(self)
open(self, mode, string='')
paste(self)
press(self, key)
type_key(self, key)

Data and other attributes inherited from Console:
allow_close = False
commandlist = None
copy = ''
histories = None
history = None
last_cursor_mode = None
mode = None
original_line = None
override = None
tab_deque = None
visible = False

Methods inherited from ranger.gui.displayable.Displayable:
__bool__ = __nonzero__(self)
Always True
__contains__(self, item)
Is item inside the boundaries?
item can be an iterable like [y, x] or an object with x and y methods.
__nonzero__(self)
Always True
__str__(self)
click(self, event)
Called when a mouse key is pressed and self.focused is True.
Override this!
contains_point(self, y, x)
Test whether the point (with absolute coordinates) lies
within the boundaries of this object.
destroy(self)
Called when the object is destroyed.
Override this!
poke(self)
Called before drawing, even if invisible
resize(self, y, x, hei=None, wid=None)
Resize the widget

Data and other attributes inherited from ranger.shared.EnvironmentAware:
env = None

Data and other attributes inherited from ranger.shared.FileManagerAware:
fm = None

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

Methods inherited from ranger.gui.curses_shortcuts.CursesShortcuts:
addnstr(self, *args)
addstr(self, *args)
color(self, *keys)
Change the colors from now on.
color_at(self, y, x, wid, *keys)
Change the colors at the specified position
color_reset(self)
Change the colors to the default colors

Data and other attributes inherited from ranger.shared.settings.SettingsAware:
settings = {}

 
class SearchConsole(Console)
    
Method resolution order:
SearchConsole
Console
ranger.gui.widgets.Widget
ranger.gui.displayable.Displayable
ranger.shared.EnvironmentAware
ranger.shared.FileManagerAware
ranger.shared.Awareness
ranger.gui.curses_shortcuts.CursesShortcuts
ranger.shared.settings.SettingsAware
__builtin__.object

Methods defined here:
execute(self)
init(self)

Data and other attributes defined here:
prompt = '/'

Methods inherited from Console:
__init__(self, win)
add_to_history(self)
clear(self)
close(self)
delete(self, mod)
delete_rest(self, direction)
delete_word(self)
draw(self)
finalize(self)
history_move(self, n)
move(self, relative=0, absolute=None)
tab(self)
type_key(self, key)

Data and other attributes inherited from Console:
allow_close = False
commandlist = None
copy = ''
histories = None
history = None
last_cursor_mode = None
mode = None
original_line = None
override = None
tab_deque = None
visible = False

Methods inherited from ranger.gui.displayable.Displayable:
__bool__ = __nonzero__(self)
Always True
__contains__(self, item)
Is item inside the boundaries?
item can be an iterable like [y, x] or an object with x and y methods.
__nonzero__(self)
Always True
__str__(self)
click(self, event)
Called when a mouse key is pressed and self.focused is True.
Override this!
contains_point(self, y, x)
Test whether the point (with absolute coordinates) lies
within the boundaries of this object.
destroy(self)
Called when the object is destroyed.
Override this!
poke(self)
Called before drawing, even if invisible
resize(self, y, x, hei=None, wid=None)
Resize the widget

Data and other attributes inherited from ranger.shared.EnvironmentAware:
env = None

Data and other attributes inherited from ranger.shared.FileManagerAware:
fm = None

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

Methods inherited from ranger.gui.curses_shortcuts.CursesShortcuts:
addnstr(self, *args)
addstr(self, *args)
color(self, *keys)
Change the colors from now on.
color_at(self, y, x, wid, *keys)
Change the colors at the specified position
color_reset(self)
Change the colors to the default colors

Data and other attributes inherited from ranger.shared.settings.SettingsAware:
settings = {}

 
Data
        DEFAULT_HISTORY = 0
OPEN_HISTORY = 3
QUICKOPEN_HISTORY = 2
SEARCH_HISTORY = 1