# HG changeset patch # User Björn Ricks # Date 1365529433 -7200 # Node ID 01c75612253f94a9642a5b106028c48bdd1951c1 # Parent 2c944fd2cd0c008d1075fc371e65fb8b7e50216a Remove own handling of keys for editing entry text The TextEdit widged already handles the keys by itself. Therefore the code is obsolete. diff -r 2c944fd2cd0c -r 01c75612253f getan/states.py --- a/getan/states.py Mon Apr 08 15:44:27 2013 +0200 +++ b/getan/states.py Tue Apr 09 19:43:53 2013 +0200 @@ -338,26 +338,6 @@ return self.exit() elif keys.get_enter() in key: return self.enter() - elif 'left' in key: - self.footer.set_edit_pos(pos-1) - return True - elif 'right' in key: - self.footer.set_edit_pos(pos+1) - return True - elif 'backspace' in key: - text = self.footer.edit_text - self.footer.set_edit_text( - '%s%s' % (text[0:pos-1], text[pos:len(text)])) - self.footer.set_edit_pos(pos-1) - return True - elif 'delete' in key: - text = self.footer.edit_text - self.footer.set_edit_text( - '%s%s' % (text[0:pos], text[pos+1:len(text)])) - self.footer.set_edit_pos(pos) - return True - elif len(key) >= 1 and len(key[0]) == 1: - return self.insert(key) return False def enter(self): @@ -367,17 +347,6 @@ self.set_next_state(self.state) return True - def insert(self, key): - logger.debug("Enter key: %r" % key) - text = "".join(key) - # check for unicode here - # urwid (at least up to version 1.0.2) will crash if a non-unicode - # string with a char > 128 is passed here - if not isinstance(text, unicode): - text = unicode(text, locale.getpreferredencoding()) - self.footer.insert_text(text) - return True - class BaseTimeState(HandleUserInputState):