add config options for linked NIMs
[enigma2.git] / lib / python / Components / NimManager.py
index 52c943a44577a9965fec44def704b0df086aee82..5a2e16fa74a8068a4cf464c1fef241762d549cf2 100644 (file)
@@ -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')
@@ -364,14 +359,15 @@ 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)]));
+                       nim.linkedTo = configElement(cname + "linkedTo", configSelection, 1 - slot.slotid, (_("Slot A"), _("Slot B")));
                        
                        #perhaps the instance of the slot is more useful?
                        nim.configMode.addNotifier(boundFunction(nimConfigModeChanged,x))
@@ -381,9 +377,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!"