+from Components.ActionMap import NumberActionMap
+from Components.config import config, ConfigNothing
+from Components.SystemInfo import SystemInfo
+from Components.ConfigList import ConfigListScreen
+from Components.Sources.StaticText import StaticText
+from enigma import eEnv
+
+import xml.etree.cElementTree
+
+# FIXME: use resolveFile!
+# read the setupmenu
+try:
+ # first we search in the current path
+ setupfile = file('data/setup.xml', 'r')
+except:
+ # if not found in the current path, we use the global datadir-path
+ setupfile = file(eEnv.resolve('${datadir}/enigma2/setup.xml'), 'r')
+setupdom = xml.etree.cElementTree.parse(setupfile)
+setupfile.close()
+
+class SetupError(Exception):
+ def __init__(self, message):
+ self.msg = message
+
+ def __str__(self):
+ return self.msg
+
+class SetupSummary(Screen):
+
+ def __init__(self, session, parent):
+
+ Screen.__init__(self, session, parent = parent)
+ self["SetupTitle"] = StaticText(_(parent.setup_title))
+ self["SetupEntry"] = StaticText("")
+ self["SetupValue"] = StaticText("")
+ self.onShow.append(self.addWatcher)
+ self.onHide.append(self.removeWatcher)
+
+ def addWatcher(self):
+ self.parent.onChangedEntry.append(self.selectionChanged)
+ self.parent["config"].onSelectionChanged.append(self.selectionChanged)
+ self.selectionChanged()
+
+ def removeWatcher(self):
+ self.parent.onChangedEntry.remove(self.selectionChanged)
+ self.parent["config"].onSelectionChanged.remove(self.selectionChanged)
+
+ def selectionChanged(self):
+ self["SetupEntry"].text = self.parent.getCurrentEntry()
+ self["SetupValue"].text = self.parent.getCurrentValue()
+
+class Setup(ConfigListScreen, Screen):
+
+ ALLOW_SUSPEND = True
+
+ def removeNotifier(self):
+ config.usage.setup_level.notifiers.remove(self.levelChanged)
+
+ def levelChanged(self, configElement):
+ list = []
+ self.refill(list)
+ self["config"].setList(list)
+
+ def refill(self, list):
+ xmldata = setupdom.getroot()
+ for x in xmldata.findall("setup"):
+ if x.get("key") != self.setup:
+ continue
+ self.addItems(list, x);
+ self.setup_title = x.get("title", "").encode("UTF-8")
+