Mercurial > urwid-satext
changeset 92:fdd0543677d4
use of new keys module in files_management
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 08 Sep 2014 15:42:25 +0200 |
parents | b447a9c6f1d3 |
children | 900014ae36b8 |
files | urwid_satext/files_management.py urwid_satext/keys.py |
diffstat | 2 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/urwid_satext/files_management.py Mon Sep 08 15:42:25 2014 +0200 +++ b/urwid_satext/files_management.py Mon Sep 08 15:42:25 2014 +0200 @@ -23,6 +23,7 @@ from xml.dom import minidom from logging import debug, info, error from time import time +from .keys import action_key_map as a_key import gettext gettext.install('urwid_satext', unicode=True) @@ -35,7 +36,7 @@ expanded = os.path.expanduser('~') self.set_edit_text(os.path.normpath(expanded+'/'+self.edit_text)) self.set_edit_pos(len(expanded)+1) - elif key == 'ctrl w': + elif key == a_key['EDIT_DELETE_LAST_WORD']: if self.edit_pos<2: return before = self.edit_text[:self.edit_pos] @@ -62,15 +63,15 @@ urwid.WidgetWrap.__init__(self, listbox) def keypress(self, size, key): - if key=='meta h': + if key==a_key['FILES_HIDDEN_HIDE']: #(un)hide hidden files self.show_hidden = not self.show_hidden self.showDirectory(self.path) - if key=='meta d': + elif key==a_key['FILES_JUMP_DIRECTORIES']: #jump to directories if self.files_list: self._w.set_focus(0) - elif key=='meta f': + elif key==a_key['FILES_JUMP_FILES']: for idx in range(len(self.files_list)): if isinstance(self.files_list[idx].base_widget,urwid.Divider): if idx<len(self.files_list)-1:
--- a/urwid_satext/keys.py Mon Sep 08 15:42:25 2014 +0200 +++ b/urwid_satext/keys.py Mon Sep 08 15:42:25 2014 +0200 @@ -176,6 +176,9 @@ ('focus', "FOCUS_DOWN"): 'ctrl down', ('focus', "FOCUS_LEFT"): 'ctrl left', ('focus', "FOCUS_RIGHT"): 'ctrl right', + ('files_management', "FILES_HIDDEN_HIDE"): 'meta h', + ('files_management', "FILES_JUMP_DIRECTORIES"): 'meta d', + ('files_management', "FILES_JUMP_FILES"): 'meta f', } action_key_map = ActionMap(keys)