Change method we recognize digit keys, to work with non-standart

portnov [2008-09-01 05:35:50]
Change method we recognize digit keys, to work with non-standart
keyboard layaouts, such as ru(typewriter).
Filename
qwerty.py
diff --git a/qwerty.py b/qwerty.py
index a102923..6ee6e97 100755
--- a/qwerty.py
+++ b/qwerty.py
@@ -42,7 +42,18 @@ KEYS = [ "QWERTYUIOP",
          "ZXCVBNM" ]
 ALPHABET = KEYS[0] + KEYS[1] + KEYS[2]

-DIGITS = "1234567890"
+DIGITS = "1234567890", ['exclam',
+          'at',
+          'numbersign',
+          'dollar',
+          'percent',
+          'asciicircum',
+          'ampersand',
+          'asterisk',
+          'parenleft',
+          'parenright']
+
+# DIGITS = '1234567890'

 BUTTON_BORDER = (0.7,0.7,0.7)
 BUTTON_BORDER_ACTIVE = (0,0,0)
@@ -585,7 +596,7 @@ class GUI(object):
         for c in ALPHABET:
             self.buttons[c] = SuperButton(c)

-        for c in DIGITS:
+        for c in DIGITS[0]:
             btn = SectionButton(c)
             self.sbuttons.append(btn)

@@ -801,8 +812,10 @@ class GUI(object):
                 return

         k = self.get_key(event.hardware_keycode)
-        if k in DIGITS:
+        if k in DIGITS[0]:
             self.show_section(k, mods)
+        elif k in DIGITS[1]:
+            self.show_section(DIGITS[0][DIGITS[1].index(k)], mods)
         elif k == 'space':
             self.switch_taskbar()
         elif k in ALPHABET.lower():
ViewGit