aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Tools/KeyBindings.py
blob: cc0a2d14d81dfa1a76be79702b02e958082e5481 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

keyBindings = { }

from keyids import KEYIDS

keyDescriptions = {
		KEYIDS["KEY_RED"]: "red",
		KEYIDS["KEY_BLUE"]: "blue",
		KEYIDS["KEY_MENU"]: "menu",
		KEYIDS["KEY_VIDEO"]: "video"
	}

def addKeyBinding(key, context, action):
	if (context, action) in keyBindings:
		keyBindings[(context, action)].append(key)
	else:
		keyBindings[(context, action)] = [key]

def queryKeyBinding(context, action):
	if (context, action) in keyBindings:
		return keyBindings[(context, action)]
	else:
		return [ ]

def getKeyDescription(key):
	if key in keyDescriptions:
		return keyDescriptions[key]
	return "key_%0x" % key