remove unneeded code
[enigma2.git] / lib / python / Tools / KeyBindings.py
index 40c184f6ea6ec44ecda437db084edc824ad3d36a..6d26b433c277d94aec3a9de8f6ede74b96373c07 100644 (file)
@@ -24,21 +24,37 @@ keyDescriptions = {
                KEYIDS["KEY_RADIO"]: ("radio", 585, 425),
                KEYIDS["KEY_TEXT"]: ("text", 610, 425),
                KEYIDS["KEY_NEXT"]: ("next", 635, 203),
                KEYIDS["KEY_RADIO"]: ("radio", 585, 425),
                KEYIDS["KEY_TEXT"]: ("text", 610, 425),
                KEYIDS["KEY_NEXT"]: ("next", 635, 203),
-               KEYIDS["KEY_PREVIOUS"]: ("prev", 559, 203)
+               KEYIDS["KEY_PREVIOUS"]: ("prev", 559, 203),
+               KEYIDS["KEY_PREVIOUSSONG"]: ("sh_blue", 640, 390),
+               KEYIDS["KEY_PLAYPAUSE"]: ("sh_yellow", 610, 390),
+               KEYIDS["KEY_PLAY"]: ("sh_green", 585, 390),
+               KEYIDS["KEY_NEXTSONG"]: ("sh_red", 555, 390),
+               KEYIDS["KEY_CHANNELUP"]: ("ch_up", 645, 245),
+               KEYIDS["KEY_CHANNELDOWN"]: ("ch_down", 630, 270),
+               KEYIDS["KEY_0"]: ("0", 598, 203),
+               KEYIDS["KEY_1"]: ("1", 559, 134),
+               KEYIDS["KEY_3"]: ("3", 635, 134),
+               KEYIDS["KEY_8"]: ("8", 598, 180),
+               KEYIDS["KEY_EXIT"]: ("exit", 598, 255),
+               KEYIDS["KEY_STOP"]: ("sh_tv", 560, 425),
+               KEYIDS["KEY_RECORD"]: ("sh_radio", 585, 425)
        }
 
        }
 
-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, flags):
+       keyBindings.setdefault((context, action), []).append((key, domain, flags))
 
 
+# returns a list of (key, flags) for a specified action
 def queryKeyBinding(context, action):
        if (context, action) in keyBindings:
 def queryKeyBinding(context, action):
        if (context, action) in keyBindings:
-               return keyBindings[(context, action)]
+               return [(x[0], x[2]) for x in keyBindings[(context, action)]]
        else:
                return [ ]
 
 def getKeyDescription(key):
        if key in keyDescriptions:
                return keyDescriptions.get(key, [ ])
        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])