Browse Source

fix handling of non-decimal chars in FloatEdit fields

Daniel Sheffield 3 years ago
parent
commit
b346e7dc44
1 changed files with 4 additions and 1 deletions
  1. 4 1
      grocery_transactions.py

+ 4 - 1
grocery_transactions.py

@@ -200,8 +200,11 @@ class AutoCompleteFloatEdit(numedit.FloatEdit):
         elif key in ('=', 'enter',):
         elif key in ('=', 'enter',):
             self.calc()
             self.calc()
             return
             return
-        else:
+        elif key in ('esc', 'left', 'right', 'up', 'down',) or \
+             key in '0123456789.':
             return super(AutoCompleteFloatEdit, self).keypress(size, key)
             return super(AutoCompleteFloatEdit, self).keypress(size, key)
+        else:
+            return
 
 
 
 
 class GroceryTransactionEditor(urwid.WidgetPlaceholder):
 class GroceryTransactionEditor(urwid.WidgetPlaceholder):