X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/82cafa6d31a2023abf2afc300ba963080ad21806..012fff37311d068b932abbdaa517f2c2d7a2836a:/lib/python/Components/NimManager.py diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 52c943a4..2baf50b3 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -18,6 +18,8 @@ from Tools import XMLTools from xml.sax import make_parser from xml.sax.handler import ContentHandler +from Tools.BoundFunction import boundFunction + def tryOpen(filename): try: procFile = open(filename) @@ -84,13 +86,6 @@ class SecConfigure: self.NimManager = nimmgr self.update() -class boundFunction: - def __init__(self, fnc, *args): - self.fnc = fnc - self.args = args - def __call__(self, *args): - self.fnc(*self.args + args) - class nimSlot: def __init__(self, slotid, nimtype, name): self.slotid = slotid @@ -194,10 +189,10 @@ class NimManager: self.transponders = { } self.transponderscable = { } self.transpondersterrestrial = { } - + + parser = make_parser() if (self.hasNimType(self.nimType["DVB-S"])): print "Reading satellites.xml" - parser = make_parser() satHandler = self.parseSats(self.satList, self.satellites, self.transponders) parser.setContentHandler(satHandler) parser.parse('/etc/tuxbox/satellites.xml') @@ -258,6 +253,13 @@ class NimManager: if (chktype == self.nimType[str(type)]): return True return False + + def getNimListOfType(self, type, exception = -1): + list = [] + for x in self.nimslots: + if ((x.nimType == type) and (x.slotid != exception)): + list.append(x.slotid) + return list def getConfigPrefix(self, slotid): return "config.Nim" + ("A","B","C","D")[slotid] + "." @@ -364,14 +366,20 @@ def InitNimManager(nimmgr): nim = config.Nims[x] if slot.nimType == nimmgr.nimType["DVB-S"]: - nim.configMode = configElement(cname + "configMode",configSelection, 0, (_("Simple"), _("Advanced"))); - nim.diseqcMode = configElement(cname + "diseqcMode",configSelection, 2, (_("Single"), _("Toneburst A/B"), _("DiSEqC A/B"), _("DiSEqC A/B/C/D"), _("Positioner"))); - nim.diseqcA = configElement(cname + "diseqcA",configSatlist, 192, nimmgr.satList); - nim.diseqcB = configElement(cname + "diseqcB",configSatlist, 130, nimmgr.satList); - nim.diseqcC = configElement(cname + "diseqcC",configSatlist, 0, nimmgr.satList); - nim.diseqcD = configElement(cname + "diseqcD",configSatlist, 0, nimmgr.satList); - nim.longitude = configElement(cname + "longitude",configSequence, [0,0], configsequencearg.get("FLOAT", [(0,90),(0,999)])); - nim.latitude = configElement(cname + "latitude",configSequence, [0,0], configsequencearg.get("FLOAT", [(0,90),(0,999)])); + nim.configMode = configElement(cname + "configMode", configSelection, 0, (_("Simple"), _("Linked tuner"))) # _("Advanced"))); + nim.diseqcMode = configElement(cname + "diseqcMode", configSelection, 2, (_("Single"), _("Toneburst A/B"), _("DiSEqC A/B"), _("DiSEqC A/B/C/D"), _("Positioner"))); + nim.diseqcA = configElement(cname + "diseqcA", configSatlist, 192, nimmgr.satList); + nim.diseqcB = configElement(cname + "diseqcB", configSatlist, 130, nimmgr.satList); + nim.diseqcC = configElement(cname + "diseqcC", configSatlist, 0, nimmgr.satList); + nim.diseqcD = configElement(cname + "diseqcD", configSatlist, 0, nimmgr.satList); + nim.longitude = configElement(cname + "longitude", configSequence, [0,0], configsequencearg.get("FLOAT", [(0,90),(0,999)])); + nim.latitude = configElement(cname + "latitude", configSequence, [0,0], configsequencearg.get("FLOAT", [(0,90),(0,999)])); + + satNimList = nimmgr.getNimListOfType(nimmgr.nimType["DVB-S"], slot.slotid) + satNimListNames = [] + for x in satNimList: + satNimListNames.append(_("Slot ") + ("A", "B", "C", "D")[x] + ": " + nimmgr.getNimName(x)) + nim.linkedTo = configElement(cname + "linkedTo", configSelection, 0, satNimListNames); #perhaps the instance of the slot is more useful? nim.configMode.addNotifier(boundFunction(nimConfigModeChanged,x)) @@ -381,9 +389,9 @@ def InitNimManager(nimmgr): nim.diseqcC.addNotifier(boundFunction(nimPortCChanged,x)) nim.diseqcD.addNotifier(boundFunction(nimPortDChanged,x)) elif slot.nimType == nimmgr.nimType["DVB-C"]: - pass + nim.cable = configElement(cname + "cable", configSelection, 0, nimmgr.cablesList); elif slot.nimType == nimmgr.nimType["DVB-T"]: - pass + nim.cable = configElement(cname + "terrestrial", configSelection, 0, nimmgr.terrestrialsList); else: print "pls add support for this frontend type!"