4 from keyids import KEYIDS
7 KEYIDS["BTN_0"]: ("fp_up", 630, 320),
8 KEYIDS["BTN_1"]: ("fp_down", 565, 320),
9 KEYIDS["KEY_OK"]: ("ok", 598, 320),
10 KEYIDS["KEY_UP"]: ("up", 598, 290),
11 KEYIDS["KEY_DOWN"]: ("down", 598, 345),
12 KEYIDS["KEY_POWER"]: ("power", 615, 80),
13 KEYIDS["KEY_RED"]: ("red", 555, 390),
14 KEYIDS["KEY_BLUE"]: ("blue", 640, 390),
15 KEYIDS["KEY_GREEN"]: ("green", 585, 390),
16 KEYIDS["KEY_YELLOW"]: ("yellow", 610, 390),
17 KEYIDS["KEY_MENU"]: ("menu", 645, 290),
18 KEYIDS["KEY_LEFT"]: ("left", 565, 320),
19 KEYIDS["KEY_RIGHT"]: ("right", 630, 320),
20 KEYIDS["KEY_VIDEO"]: ("video", 645, 355),
21 KEYIDS["KEY_INFO"]: ("info", 550, 290),
22 KEYIDS["KEY_AUDIO"]: ("audio", 555, 355),
23 KEYIDS["KEY_TV"]: ("tv", 560, 425),
24 KEYIDS["KEY_RADIO"]: ("radio", 585, 425),
25 KEYIDS["KEY_TEXT"]: ("text", 610, 425),
26 KEYIDS["KEY_NEXT"]: ("next", 635, 203),
27 KEYIDS["KEY_PREVIOUS"]: ("prev", 559, 203),
28 KEYIDS["KEY_PREVIOUSSONG"]: ("sh_blue", 640, 390),
29 KEYIDS["KEY_PLAYPAUSE"]: ("sh_yellow", 610, 390),
30 KEYIDS["KEY_PLAY"]: ("sh_green", 585, 390),
31 KEYIDS["KEY_NEXTSONG"]: ("sh_red", 555, 390),
32 KEYIDS["KEY_CHANNELUP"]: ("ch_up", 645, 245),
33 KEYIDS["KEY_CHANNELDOWN"]: ("ch_down", 630, 270),
34 KEYIDS["KEY_0"]: ("0", 598, 203),
35 KEYIDS["KEY_8"]: ("8", 598, 180),
36 KEYIDS["KEY_EXIT"]: ("exit", 598, 255),
37 KEYIDS["KEY_STOP"]: ("sh_tv", 560, 425),
38 KEYIDS["KEY_RECORD"]: ("sh_radio", 585, 425)
41 def addKeyBinding(domain, key, context, action, flags):
42 keyBindings.setdefault((context, action), []).append((key, domain, flags))
44 # returns a list of (key, flags) for a specified action
45 def queryKeyBinding(context, action):
46 if (context, action) in keyBindings:
47 return [(x[0], x[2]) for x in keyBindings[(context, action)]]
51 def getKeyDescription(key):
52 if key in keyDescriptions:
53 return keyDescriptions.get(key, [ ])
55 def removeKeyBindings(domain):
56 # remove all entries of domain 'domain'
58 keyBindings[x] = filter(lambda e: e[1] != domain, keyBindings[x])