X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fpython%2FScreens%2FSetup.py;h=2e833278c473575ee7797ff22021c663277ae02f;hp=7226562fd5a5431865ac58d874513526b0beb756;hb=79a3f3c8d0dbd5f99359a283cd33451c41f8c288;hpb=574f425cc1ebece0aa5f09fb77a8cb7ad0310a1f
diff --git a/lib/python/Screens/Setup.py b/lib/python/Screens/Setup.py
old mode 100644
new mode 100755
index 7226562..2e83327
--- a/lib/python/Screens/Setup.py
+++ b/lib/python/Screens/Setup.py
@@ -3,8 +3,8 @@ from Components.ActionMap import NumberActionMap
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
+from Components.Sources.StaticText import StaticText
+from enigma import eEnv
import xml.etree.cElementTree
@@ -15,7 +15,7 @@ try:
setupfile = file('data/setup.xml', 'r')
except:
# if not found in the current path, we use the global datadir-path
- setupfile = file('/usr/share/enigma2/setup.xml', 'r')
+ setupfile = file(eEnv.resolve('${datadir}/enigma2/setup.xml'), 'r')
setupdom = xml.etree.cElementTree.parse(setupfile)
setupfile.close()
@@ -27,26 +27,21 @@ class SetupError(Exception):
return self.msg
class SetupSummary(Screen):
- skin = """
-
-
-
-
- """
def __init__(self, session, parent):
+
Screen.__init__(self, session, parent = parent)
- self["SetupTitle"] = Label(_(parent.setup_title))
- self["SetupEntry"] = Label("")
- self["SetupValue"] = Label("")
+ 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)
@@ -67,6 +62,17 @@ class Setup(ConfigListScreen, Screen):
self.refill(list)
self["config"].setList(list)
+ def removeEntryNotifier(self):
+ if self.needEntryChange:
+ for item in self.needEntryChange:
+ if self.entryChanged in item.notifiers:
+ item.notifiers.remove(self.entryChanged)
+
+ def entryChanged(self, configElement):
+ list = []
+ self.refill(list)
+ self["config"].setList(list)
+
def refill(self, list):
xmldata = setupdom.getroot()
for x in xmldata.findall("setup"):
@@ -77,24 +83,21 @@ class Setup(ConfigListScreen, Screen):
def __init__(self, session, setup):
Screen.__init__(self, session)
-
# for the skin: first try a setup_, then Setup
self.skinName = ["setup_" + setup, "Setup" ]
self.onChangedEntry = [ ]
+ self.needEntryChange = [ ]
+
self.setup = setup
list = []
self.refill(list)
#check for list.entries > 0 else self.close
- self["title"] = Label(_(self.setup_title))
+ self["key_red"] = StaticText(_("Cancel"))
+ self["key_green"] = StaticText(_("OK"))
- self["oktext"] = Label(_("OK"))
- self["canceltext"] = Label(_("Cancel"))
- self["ok"] = Pixmap()
- self["cancel"] = Pixmap()
-
self["actions"] = NumberActionMap(["SetupActions"],
{
"cancel": self.keyCancel,
@@ -104,6 +107,10 @@ class Setup(ConfigListScreen, Screen):
ConfigListScreen.__init__(self, list, session = session, on_change = self.changedEntry)
self.changedEntry()
+ self.onLayoutFinish.append(self.layoutFinished)
+
+ def layoutFinished(self):
+ self.setTitle(_(self.setup_title))
# for summary:
def changedEntry(self):
@@ -120,6 +127,7 @@ class Setup(ConfigListScreen, Screen):
return SetupSummary
def addItems(self, list, parentNode):
+ self.needEntryChange = [ ]
for x in parentNode:
if x.tag == 'item':
item_level = int(x.get("level", 0))
@@ -146,6 +154,14 @@ class Setup(ConfigListScreen, Screen):
if not isinstance(item, ConfigNothing):
list.append( (item_text, item) )
+ needentrychange = x.get("entrychange")
+ if needentrychange == "yes":
+ self.needEntryChange.append(item)
+ if not self.entryChanged in item.notifiers:
+ item.notifiers.append(self.entryChanged)
+ if not self.removeEntryNotifier in self.onClose:
+ self.onClose.append(self.removeEntryNotifier)
+
def getSetupTitle(id):
xmldata = setupdom.getroot()
for x in xmldata.findall("setup"):