fix no more working infobar show when a service is selected in the
[enigma2.git] / keymapparser.py
index 23cd5a8..f8aa07f 100644 (file)
@@ -1,5 +1,6 @@
 import xml.dom.minidom
 import enigma
+from Tools.XMLTools import elementsWithTag
 
 from keyids import KEYIDS;
 
@@ -8,8 +9,7 @@ from Tools.KeyBindings import addKeyBinding
 
 def readKeymap():
 
-       p = enigma.eActionMapPtr()
-       enigma.eActionMap.getInstance(p)
+       p = enigma.eActionMap.getInstance()
        assert p
        
        filename1 = "data/keymap.xml"
@@ -28,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")
@@ -78,6 +75,6 @@ def readKeymap():
                
                parseKeys("generic", cmap)
                
-               for device in cmap.getElementsByTagName("device"):
+               for device in elementsWithTag(cmap.childNodes, "device"):
                        parseKeys(str(device.getAttribute("name")), device)