From: Matthijs Kooijman Date: Tue, 3 Nov 2009 14:11:47 +0000 (+0100) Subject: Add key_shortname function. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=3f1310771fb7c333ebef7a2f0beac4120a0d8b65;p=matthijs%2Fupstream%2Fmobilegtd.git Add key_shortname function. This function contains code previously in another class. --- diff --git a/src/gui/gui.py b/src/gui/gui.py index cf9536b..a07091b 100644 --- a/src/gui/gui.py +++ b/src/gui/gui.py @@ -68,6 +68,15 @@ def get_key(key_name): key=eval('EKey%s'%key_name) return key +def key_shortname(key_name): + """ Find the one-character name for a key """ + if not key_name: + return None + elif key_name == 'Backspace': + return 'C' + else: + return key_name + def all_key_names(): return filter(lambda entry:entry[0:4]=='EKey',dir(key_codes)) def all_key_values():