| |
- ranger.shared.FileManagerAware(ranger.shared.Awareness)
-
- Applications
class Applications(ranger.shared.FileManagerAware) |
|
This class contains definitions on how to run programs and should
be extended in ranger.defaults.apps
The user can decide what program to run, and if he uses eg. 'vim', the
function app_vim() will be called. However, usually the user
simply wants to "start" the file without specific instructions.
In such a case, app_default() is called, where you should examine
the context and decide which program to use.
All app functions have a name starting with app_ and return a string
containing the whole command or a tuple containing a list of the
arguments. They are supplied with one argument, which is the
AppContext instance.
You should define at least app_default, app_pager and app_editor since
internal functions depend on those. Here are sample implementations:
def app_default(self, context):
if context.file.media:
if context.file.video:
# detach videos from the filemanager
context.flags += 'd'
return app_mplayer(context)
else:
return app_editor(context)
def app_pager(self, context):
return ('less', ) + tuple(context)
def app_editor(self, context):
return ('vim', ) + tuple(context) |
|
- Method resolution order:
- Applications
- ranger.shared.FileManagerAware
- ranger.shared.Awareness
- __builtin__.object
Methods defined here:
- all(self)
- Returns a list with all application functions
- app_self(self, context)
- Run the file itself
- apply(self, app, context)
- either(self, context, *args)
- get(self, app)
- Looks for an application, returns app_default if it doesn't exist
- has(self, app)
- Returns whether an application is defined
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)
| |