Просмотр исходного кода

fix handling of non-decimal chars in FloatEdit fields

Daniel Sheffield 3 лет назад
Родитель
Сommit
b346e7dc44
1 измененных файлов с 4 добавлено и 1 удалено
  1. 4 1
      grocery_transactions.py

+ 4 - 1
grocery_transactions.py

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