fix startwizzard for nim changes
[enigma2.git] / keymapparser.py
index 6ce0aba..f8aa07f 100644 (file)
@@ -1,12 +1,15 @@
 import xml.dom.minidom
 import enigma
+from Tools.XMLTools import elementsWithTag
 
 from keyids import KEYIDS;
 
+# these are only informational (for help)...
+from Tools.KeyBindings import addKeyBinding
+
 def readKeymap():
 
-       p = enigma.eActionMapPtr()
-       enigma.eActionMap.getInstance(p)
+       p = enigma.eActionMap.getInstance()
        assert p
        
        filename1 = "data/keymap.xml"
@@ -25,19 +28,16 @@ def readKeymap():
        except:
                raise "keymap not well-formed."
        
-       try:    
-               keymap = dom.getElementsByTagName("keymap")[0]
-       except:
-               raise "no keymap defined."
+       keymap = dom.childNodes[0]
        
-       maps = keymap.getElementsByTagName("map")
+       maps = elementsWithTag(keymap.childNodes, "map")
        
        for cmap in maps:
                context = str(cmap.getAttribute("context"))
                assert context != "", "map must have context"
        
                def parseKeys(device, keys):
-                       for x in keys.getElementsByTagName("key"):
+                       for x in elementsWithTag(keys.childNodes, "key"):
                                mapto = str(x.getAttribute("mapto"))
                                id = x.getAttribute("id")
                                flags = x.getAttribute("flags")
@@ -71,9 +71,10 @@ def readKeymap():
 
 #                              print context + "::" + mapto + " -> " + device + "." + hex(keyid)
                                p.bindKey(device, keyid, flags, context, mapto)
+                               addKeyBinding(keyid, context, mapto)
                
                parseKeys("generic", cmap)
                
-               for device in cmap.getElementsByTagName("device"):
+               for device in elementsWithTag(cmap.childNodes, "device"):
                        parseKeys(str(device.getAttribute("name")), device)