From fbe99d189cdb7e0951e6afb7d55212eb096982a1 Mon Sep 17 00:00:00 2001 From: hut Date: Fri, 16 Apr 2010 17:00:32 +0200 Subject: ranger.container.keymap: added some documentation --- ranger/container/keybuffer.py | 2 +- ranger/container/keymap.py | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/ranger/container/keybuffer.py b/ranger/container/keybuffer.py index 50914f84..ce391de4 100644 --- a/ranger/container/keybuffer.py +++ b/ranger/container/keybuffer.py @@ -18,7 +18,7 @@ from collections import deque from string import digits from ranger.ext.keybinding_parser import parse_keybinding, \ DIRKEY, ANYKEY, PASSIVE_ACTION -from ranger.container.keymap import Binding, KeyMap +from ranger.container.keymap import Binding, KeyMap # mainly for assertions MAX_ALIAS_RECURSION = 20 diff --git a/ranger/container/keymap.py b/ranger/container/keymap.py index 167ba160..e44fcfd7 100644 --- a/ranger/container/keymap.py +++ b/ranger/container/keymap.py @@ -22,7 +22,24 @@ DIRARG = 'dir' ALIASARG = 'alias' class CommandArgs(object): - """The arguments which are passed to a keybinding function""" + """ + A CommandArgs object is passed to the keybinding function. + + This object simply aggregates information about the pressed keys + and the current environment. + + Attributes: + fm: the FM instance + wdg: the currently focused widget (or fm, if none is focused) + keybuffer: the keybuffer object + n: the prefixed number, eg 5 in the command "5yy" + directions: a list of directions which are entered for "" + direction: the first direction object from that list + keys: a string representation of the keybuffer + matches: all keys which are entered for "" + match: the first match + binding: the used Binding object + """ def __init__(self, fm, widget, keybuf): self.fm = fm self.wdg = widget @@ -40,6 +57,7 @@ class CommandArgs(object): return CommandArgs(widget.fm, \ widget, widget.env.keybuffer) + class KeyMap(Tree): """Contains a tree with all the keybindings""" def map(self, *args, **keywords): -- cgit 1.4.1-2-gfad0