fix
[openblackhole/openblackhole-enigma2.git] / lib / python / Tools / KeyBindings.py
1
2 keyBindings = { }
3
4 from keyids import KEYIDS
5
6 keyDescriptions = {
7                 KEYIDS["KEY_RED"]: "red",
8                 KEYIDS["KEY_BLUE"]: "blue",
9                 KEYIDS["KEY_MENU"]: "menu",
10                 KEYIDS["KEY_VIDEO"]: "video"
11         }
12
13 def addKeyBinding(key, context, action):
14         if (context, action) in keyBindings:
15                 keyBindings[(context, action)].append(key)
16         else:
17                 keyBindings[(context, action)] = [key]
18
19 def queryKeyBinding(context, action):
20         if (context, action) in keyBindings:
21                 return keyBindings[(context, action)]
22         else:
23                 return [ ]
24
25 def getKeyDescription(key):
26         if key in keyDescriptions:
27                 return keyDescriptions[key]
28         return "key_%0x" % key