raise exception when unknown setup id is searched for
[enigma2.git] / lib / python / Screens / Setup.py
index 59f0ff57733c94922f88f3d91f02b65e65dc9ee8..2452eef90bb3cfd53ad93893160a77103a561ac1 100644 (file)
@@ -1,13 +1,11 @@
 from Screen import Screen
-from MessageBox import MessageBox
 from Components.ActionMap import NumberActionMap
-from Components.config import config, KEY_LEFT, KEY_RIGHT, KEY_OK
-from Components.ConfigList import ConfigList, ConfigListScreen
+from Components.config import config
+from Components.ConfigList import ConfigListScreen
 from Components.Label import Label
 from Components.Pixmap import Pixmap
 
 import xml.dom.minidom
-from xml.dom import EMPTY_NAMESPACE
 from skin import elementsWithTag
 
 from Tools import XMLTools
@@ -115,6 +113,11 @@ class Setup(ConfigListScreen, Screen):
                        if x.nodeType != xml.dom.minidom.Element.nodeType:
                                continue
                        elif x.tagName == 'item':
+                               item_level = int(x.getAttribute("level") or "0")
+
+                               if item_level > config.usage.setup_level.index:
+                                       continue
+
                                item_text = _(x.getAttribute("text").encode("UTF-8") or "??")
                                b = eval(XMLTools.mergeText(x.childNodes));
                                if b == "":
@@ -125,34 +128,9 @@ class Setup(ConfigListScreen, Screen):
                                # the second one is converted to string.
                                list.append( (item_text, item) )
 
-       def keySave(self):
-               print "save requested"
-               for x in self["config"].list:
-                       x[1].save()
-               self.close()
-       
-       def cancelConfirm(self, result):
-               if not result:
-                       return
-
-               print "cancel requested"
-               
-               for x in self["config"].list:
-                       x[1].cancel()
-               self.close()
-
-       def keyCancel(self):
-               is_changed = False
-               for x in self["config"].list:
-                       is_changed |= x[1].isChanged()
-               
-               if is_changed:
-                       self.session.openWithCallback(self.cancelConfirm, MessageBox, _("Really close without saving settings?"))
-               else:
-                       self.close()
-
 def getSetupTitle(id):
        xmldata = setupdom.childNodes[0].childNodes
        for x in elementsWithTag(xmldata, "setup"):
                if x.getAttribute("key") == id:
                        return x.getAttribute("title").encode("UTF-8")
+       raise "unknown setup id '%s'!" % repr(id)