when plugins have a keymap.xml in their directory, read that.
[enigma2.git] / lib / python / Tools / KeyBindings.py
index f0a70d5ced5ad6850b9021838ba39a9139b015bc..5bd702547947ddc1aa37fe803a03dc2868ddf02e 100644 (file)
@@ -6,9 +6,9 @@ from keyids import KEYIDS
 keyDescriptions = {
                KEYIDS["BTN_0"]: ("fp_up", 630, 320),
                KEYIDS["BTN_1"]: ("fp_down", 565, 320),
-               KEYIDS["KEY_OK"]: ("ok", 585, 320),
-               KEYIDS["KEY_UP"]: ("up", 585, 290),
-               KEYIDS["KEY_DOWN"]: ("down", 585, 355),
+               KEYIDS["KEY_OK"]: ("ok", 598, 320),
+               KEYIDS["KEY_UP"]: ("up", 598, 290),
+               KEYIDS["KEY_DOWN"]: ("down", 598, 345),
                KEYIDS["KEY_POWER"]: ("power", 615, 80),
                KEYIDS["KEY_RED"]: ("red", 555, 390),
                KEYIDS["KEY_BLUE"]: ("blue", 640, 390),
@@ -27,18 +27,20 @@ keyDescriptions = {
                KEYIDS["KEY_PREVIOUS"]: ("prev", 559, 203)
        }
 
-def addKeyBinding(key, context, action):
-       if (context, action) in keyBindings:
-               keyBindings[(context, action)].append(key)
-       else:
-               keyBindings[(context, action)] = [key]
+def addKeyBinding(domain, key, context, action):
+       keyBindings.setdefault((context, action), []).append((key, domain))
 
 def queryKeyBinding(context, action):
        if (context, action) in keyBindings:
-               return keyBindings[(context, action)]
+               return [x[0] for x in keyBindings[(context, action)]]
        else:
                return [ ]
 
 def getKeyDescription(key):
        if key in keyDescriptions:
                return keyDescriptions.get(key, [ ])
+
+def removeKeyBindings(domain):
+       # remove all entries of domain 'domain'
+       for x in keyBindings:
+               keyBindings[x] = filter(lambda e: e[1] != domain, keyBindings[x])