From db3739424c9486cb9c8a6b94b5cd5bce07b8c2f6 Mon Sep 17 00:00:00 2001 From: rdagger Date: Fri, 24 Apr 2020 08:49:55 -0700 Subject: [PATCH] Refine keyboard screen selection --- touch_keyboard.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/touch_keyboard.py b/touch_keyboard.py index 5c38e5b..dcb8fcb 100644 --- a/touch_keyboard.py +++ b/touch_keyboard.py @@ -93,24 +93,21 @@ class TouchKeyboard(object): key = self.KEYS[self.kb_screen][row][column] - if key == '\t': - self.kb_screen ^= 1 # Toggle caps - self.load_keyboard() - elif key == '\f': - self.kb_screen = self.kb_screen - 2 ^ 1 + 2 # Toggle symbols + if key == '\t' or key == '\f': + self.kb_screen ^= 1 # Toggle caps or flip symbol sets self.load_keyboard() elif key == '\a': - self.kb_screen = 0 # Letters + self.kb_screen = 0 # Switch to alphabet screen self.load_keyboard() elif key == '\n': - self.kb_screen = 2 # Numbers & symbols + self.kb_screen = 2 # Switch to numeric / symbols screen self.load_keyboard() elif key == '\b': # Backspace self.kb_text = self.kb_text[:-1] margin = self.font.measure_text(self.kb_text) self.display.fill_vrect(margin, 11, 12, 24, 0) elif key == '\r': - # Keyboard return pressed + # Keyboard return pressed (start search) if self.kb_text != '': return True else: