Change method of interpretation digits keys again. They should work on

portnov [2008-09-01 06:38:33]
Change method of interpretation digits keys again. They should work on
any keyboard layout.
Filename
qwerty.py
diff --git a/qwerty.py b/qwerty.py
index 6ee6e97..504dcae 100755
--- a/qwerty.py
+++ b/qwerty.py
@@ -42,18 +42,7 @@ KEYS = [ "QWERTYUIOP",
          "ZXCVBNM" ]
 ALPHABET = KEYS[0] + KEYS[1] + KEYS[2]

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

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

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

@@ -748,6 +737,9 @@ class GUI(object):
         gtk.main_quit()

     def get_key(self,hw_code):
+        if hw_code in range(10,20):
+            return str((hw_code-9)%10)
+
         km = gtk.gdk.keymap_get_default()
         kv = km.lookup_key(hw_code,0,0)
         return gtk.gdk.keyval_name(kv)
@@ -812,10 +804,8 @@ class GUI(object):
                 return

         k = self.get_key(event.hardware_keycode)
-        if k in DIGITS[0]:
+        if k in DIGITS:
             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