remove onSelectionChanged callbacks before deleting the configInstance["config"]...
[enigma2.git] / lib / python / Screens / Setup.py
index 1f262e32139ae207f1c380e102df2cce84f523a5..3ff0b76e3ed0f9d6f0361765aba8572ffefddca2 100644 (file)
@@ -1,13 +1,12 @@
 from Screen import Screen
 from Components.ActionMap import NumberActionMap
-from Components.config import config
+from Components.config import config, ConfigNothing
+from Components.SystemInfo import SystemInfo
 from Components.ConfigList import ConfigListScreen
 from Components.Label import Label
 from Components.Pixmap import Pixmap
 
 import xml.dom.minidom
-from skin import elementsWithTag
-
 from Tools import XMLTools
 
 # FIXME: use resolveFile!
@@ -78,6 +77,9 @@ class Setup(ConfigListScreen, Screen):
        def __init__(self, session, setup):
                Screen.__init__(self, session)
 
+               # for the skin: first try a setup_<setupID>, then Setup
+               self.skinName = ["setup_" + setup, "Setup" ]
+
                self.onChangedEntry = [ ]
 
                self.setup = setup
@@ -130,6 +132,10 @@ class Setup(ConfigListScreen, Screen):
                                if item_level > config.usage.setup_level.index:
                                        continue
 
+                               requires = x.getAttribute("requires")
+                               if requires and not SystemInfo.get(requires, False):
+                                       continue;
+
                                item_text = _(x.getAttribute("text").encode("UTF-8") or "??")
                                b = eval(XMLTools.mergeText(x.childNodes));
                                if b == "":
@@ -138,11 +144,12 @@ class Setup(ConfigListScreen, Screen):
                                item = b
                                # the first b is the item itself, ignored by the configList.
                                # the second one is converted to string.
-                               list.append( (item_text, item) )
+                               if not isinstance(item, ConfigNothing):
+                                       list.append( (item_text, item) )
 
 def getSetupTitle(id):
        xmldata = setupdom.childNodes[0].childNodes
-       for x in elementsWithTag(xmldata, "setup"):
+       for x in XMLTools.elementsWithTag(xmldata, "setup"):
                if x.getAttribute("key") == id:
                        return x.getAttribute("title").encode("UTF-8")
        raise "unknown setup id '%s'!" % repr(id)