changeset 232:01c75612253f

Remove own handling of keys for editing entry text The TextEdit widged already handles the keys by itself. Therefore the code is obsolete.
author Björn Ricks <bjoern.ricks@intevation.de>
date Tue, 09 Apr 2013 19:43:53 +0200
parents 2c944fd2cd0c
children 68fa56dacbcd
files getan/states.py
diffstat 1 files changed, 0 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- 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):
 
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)