import enigma
import xml.etree.cElementTree
-from keyids import KEYIDS;
+from keyids import KEYIDS
# these are only informational (for help)...
from Tools.KeyBindings import addKeyBinding
+class KeymapError(Exception):
+ def __init__(self, message):
+ self.message = message
+
+ def __str__(self):
+ return self.message
+
def parseKeys(context, filename, actionmap, device, keys):
for x in keys.findall("key"):
get_attr = x.attrib.get
elif id[1] == 'd':
keyid = int(id[2:]) | 0x8000
else:
- raise "key id '" + str(id) + "' is neither hex nor dec"
+ raise KeymapError("key id '" + str(id) + "' is neither hex nor dec")
else:
try:
keyid = KEYIDS[id]
except:
- raise "key id '" + str(id) + "' is illegal"
+ raise KeymapError("key id '" + str(id) + "' is illegal")
# print context + "::" + mapto + " -> " + device + "." + hex(keyid)
actionmap.bindKey(filename, device, keyid, flags, context, mapto)
addKeyBinding(filename, keyid, context, mapto, flags)
try:
dom = xml.etree.cElementTree.parse(source)
except:
- raise "keymap %s not well-formed." % filename
+ raise KeymapError("keymap %s not well-formed." % filename)
keymap = dom.getroot()