from xml.sax import make_parser
from xml.sax.handler import ContentHandler
+from Tools.BoundFunction import boundFunction
+
def tryOpen(filename):
try:
procFile = open(filename)
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
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')
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] + "."
nim = config.Nims[x]
if slot.nimType == nimmgr.nimType["DVB-S"]:
- nim.configMode = configElement(cname + "configMode", configSelection, 0, (_("Simple"), _("Advanced")));
+ 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.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))
nim.diseqcMode.addNotifier(boundFunction(nimDiseqcModeChanged,x))