4 from keyids import KEYIDS
5 from Components.config import config
8 KEYIDS["BTN_0"]: ("UP", "fp"),
9 KEYIDS["BTN_1"]: ("DOWN", "fp"),
10 KEYIDS["KEY_OK"]: ("OK", ""),
11 KEYIDS["KEY_UP"]: ("UP",),
12 KEYIDS["KEY_DOWN"]: ("DOWN",),
13 KEYIDS["KEY_POWER"]: ("POWER",),
14 KEYIDS["KEY_RED"]: ("RED",),
15 KEYIDS["KEY_BLUE"]: ("BLUE",),
16 KEYIDS["KEY_GREEN"]: ("GREEN",),
17 KEYIDS["KEY_YELLOW"]: ("YELLOW",),
18 KEYIDS["KEY_MENU"]: ("MENU",),
19 KEYIDS["KEY_LEFT"]: ("LEFT",),
20 KEYIDS["KEY_RIGHT"]: ("RIGHT",),
21 KEYIDS["KEY_VIDEO"]: ("PVR",),
22 KEYIDS["KEY_INFO"]: ("INFO",),
23 KEYIDS["KEY_AUDIO"]: ("YELLOW",),
24 KEYIDS["KEY_TV"]: ("TV",),
25 KEYIDS["KEY_RADIO"]: ("RADIO",),
26 KEYIDS["KEY_TEXT"]: ("TEXT",),
27 KEYIDS["KEY_NEXT"]: ("ARROWRIGHT",),
28 KEYIDS["KEY_PREVIOUS"]: ("ARROWLEFT",),
29 KEYIDS["KEY_PREVIOUSSONG"]: ("BLUE", "SHIFT"),
30 KEYIDS["KEY_PLAYPAUSE"]: ("PLAYPAUSE",),
31 KEYIDS["KEY_PLAY"]: ("PLAYPAUSE",),
32 KEYIDS["KEY_NEXTSONG"]: ("RED", "SHIFT"),
33 KEYIDS["KEY_CHANNELUP"]: ("BOUQUET+",),
34 KEYIDS["KEY_CHANNELDOWN"]: ("BOUQUET-",),
35 KEYIDS["KEY_0"]: ("0",),
36 KEYIDS["KEY_1"]: ("1",),
37 KEYIDS["KEY_2"]: ("2",),
38 KEYIDS["KEY_3"]: ("3",),
39 KEYIDS["KEY_4"]: ("4",),
40 KEYIDS["KEY_5"]: ("5",),
41 KEYIDS["KEY_6"]: ("6",),
42 KEYIDS["KEY_7"]: ("7",),
43 KEYIDS["KEY_8"]: ("8",),
44 KEYIDS["KEY_9"]: ("9",),
45 KEYIDS["KEY_EXIT"]: ("EXIT",),
46 KEYIDS["KEY_STOP"]: ("TV", "SHIFT"),
47 KEYIDS["KEY_RECORD"]: ("RECORD",)
50 KEYIDS["BTN_0"]: ("UP", "fp"),
51 KEYIDS["BTN_1"]: ("DOWN", "fp"),
52 KEYIDS["KEY_OK"]: ("OK", ""),
53 KEYIDS["KEY_UP"]: ("UP",),
54 KEYIDS["KEY_DOWN"]: ("DOWN",),
55 KEYIDS["KEY_POWER"]: ("POWER",),
56 KEYIDS["KEY_RED"]: ("RED",),
57 KEYIDS["KEY_BLUE"]: ("BLUE",),
58 KEYIDS["KEY_GREEN"]: ("GREEN",),
59 KEYIDS["KEY_YELLOW"]: ("YELLOW",),
60 KEYIDS["KEY_MENU"]: ("MENU",),
61 KEYIDS["KEY_LEFT"]: ("LEFT",),
62 KEYIDS["KEY_RIGHT"]: ("RIGHT",),
63 KEYIDS["KEY_VIDEO"]: ("VIDEO",),
64 KEYIDS["KEY_INFO"]: ("INFO",),
65 KEYIDS["KEY_AUDIO"]: ("AUDIO",),
66 KEYIDS["KEY_TV"]: ("TV",),
67 KEYIDS["KEY_RADIO"]: ("RADIO",),
68 KEYIDS["KEY_TEXT"]: ("TEXT",),
69 KEYIDS["KEY_NEXT"]: ("ARROWRIGHT",),
70 KEYIDS["KEY_PREVIOUS"]: ("ARROWLEFT",),
71 KEYIDS["KEY_PREVIOUSSONG"]: ("BLUE", "SHIFT"),
72 KEYIDS["KEY_PLAYPAUSE"]: ("YELLOW", "SHIFT"),
73 KEYIDS["KEY_PLAY"]: ("GREEN", "SHIFT"),
74 KEYIDS["KEY_NEXTSONG"]: ("RED", "SHIFT"),
75 KEYIDS["KEY_CHANNELUP"]: ("BOUQUET+",),
76 KEYIDS["KEY_CHANNELDOWN"]: ("BOUQUET-",),
77 KEYIDS["KEY_0"]: ("0",),
78 KEYIDS["KEY_1"]: ("1",),
79 KEYIDS["KEY_2"]: ("2",),
80 KEYIDS["KEY_3"]: ("3",),
81 KEYIDS["KEY_4"]: ("4",),
82 KEYIDS["KEY_5"]: ("5",),
83 KEYIDS["KEY_6"]: ("6",),
84 KEYIDS["KEY_7"]: ("7",),
85 KEYIDS["KEY_8"]: ("8",),
86 KEYIDS["KEY_9"]: ("9",),
87 KEYIDS["KEY_EXIT"]: ("EXIT",),
88 KEYIDS["KEY_STOP"]: ("TV", "SHIFT"),
89 KEYIDS["KEY_RECORD"]: ("RADIO", "SHIFT")
93 def addKeyBinding(domain, key, context, action, flags):
94 keyBindings.setdefault((context, action), []).append((key, domain, flags))
96 # returns a list of (key, flags) for a specified action
97 def queryKeyBinding(context, action):
98 if (context, action) in keyBindings:
99 return [(x[0], x[2]) for x in keyBindings[(context, action)]]
103 def getKeyDescription(key):
104 if key in keyDescriptions[config.misc.rcused.value]:
105 return keyDescriptions[config.misc.rcused.value].get(key, [ ])
107 def removeKeyBindings(domain):
108 # remove all entries of domain 'domain'
109 for x in keyBindings:
110 keyBindings[x] = filter(lambda e: e[1] != domain, keyBindings[x])