diff options
author | hut <hut@lavabit.com> | 2010-04-13 13:34:42 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-04-13 13:34:42 +0200 |
commit | 62974cad55cc556009568c869d4abb8270260747 (patch) | |
tree | 086601f3083d202b9b934273e425cb85308bef84 /ranger/container | |
parent | bcbb7832e669ee5554cf2bbecc8c97f2d18cf27b (diff) | |
download | ranger-62974cad55cc556009568c869d4abb8270260747.tar.gz |
container.keymap: Extended KeyManager
Diffstat (limited to 'ranger/container')
-rw-r--r-- | ranger/container/keymap.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/ranger/container/keymap.py b/ranger/container/keymap.py index d39df381..f09d9cfb 100644 --- a/ranger/container/keymap.py +++ b/ranger/container/keymap.py @@ -113,9 +113,9 @@ class KeyManager(object): self.clear() def clear(self): - self._contexts = dict() + self.contexts = dict() for context in self._list_of_contexts: - self._contexts[context] = KeyMapWithDirections() + self.contexts[context] = KeyMapWithDirections() def map(self, context, *args, **keywords): self.get_context(context).map(*args, **keywords) @@ -123,10 +123,17 @@ class KeyManager(object): def dir(self, context, *args, **keywords): self.get_context(context).dir(*args, **keywords) + def unmap(self, context, *args, **keywords): + self.get_context(context).unmap(*args, **keywords) + + def merge_all(self, keymapwithdirection): + for context, keymap in self.contexts.items(): + keymap.merge(keymapwithdirection) + def get_context(self, context): assert isinstance(context, str) - assert context in self._contexts, "no such context!" - return self._contexts[context] + assert context in self.contexts, "no such context: " + context + return self.contexts[context] __getitem__ = get_context def use_context(self, context): |