allow better and smarter configuration for > 2 nims
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Thu, 26 Jun 2008 11:02:55 +0000 (11:02 +0000)
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Thu, 26 Jun 2008 11:02:55 +0000 (11:02 +0000)
lib/python/Screens/Satconfig.py

index 398a13e..b175780 100644 (file)
@@ -5,7 +5,7 @@ from Components.ActionMap import ActionMap
 from Components.ConfigList import ConfigListScreen
 from Components.MenuList import MenuList
 from Components.NimManager import nimmanager
-from Components.config import getConfigListEntry, config, ConfigNothing
+from Components.config import getConfigListEntry, config, ConfigNothing, ConfigSelection
 from Screens.MessageBox import MessageBox
 
 from time import mktime, localtime
@@ -46,7 +46,7 @@ class NimSetup(Screen, ConfigListScreen):
                        if nim.powerMeasurement.value:
                                nim.powerMeasurement.value = False
                                nim.powerMeasurement.save()
-
+                               
        def createSetup(self):
                print "Creating setup"
                self.list = [ ]
@@ -77,7 +77,23 @@ class NimSetup(Screen, ConfigListScreen):
                                        self.createSimpleSetup(self.list, self.nimConfig.diseqcMode.value)
                                if self.nimConfig.diseqcMode.value == "positioner":
                                        self.createPositionerSetup(self.list)
-                       elif self.nimConfig.configMode.value in ["loopthrough", "satposdepends", "nothing", "equal"]:
+                       elif self.nimConfig.configMode.value in ["satposdepends", "equal"]:
+                               choices = []
+                               nimlist = nimmanager.getNimListOfType(self.nim.type, exception = self.nim.slot)
+                               for id in nimlist:
+                                       #choices.append((str(id), str(chr(65 + id))))
+                                       choices.append((str(id), nimmanager.getNimDescription(id)))
+                               self.nimConfig.connectedTo = ConfigSelection(choices = choices)
+                               self.list.append(getConfigListEntry(_("Tuner"), self.nimConfig.connectedTo))
+                       elif self.nimConfig.configMode.value == "loopthrough":
+                               choices = []
+                               print "connectable to:", nimmanager.connectableTo(self.slotid)
+                               connectable = nimmanager.connectableTo(self.slotid) 
+                               for id in connectable:
+                                       choices.append((str(id), nimmanager.getNimDescription(id)))
+                               self.nimConfig.connectedTo = ConfigSelection(choices = choices)
+                               self.list.append(getConfigListEntry(_("Connected to"), self.nimConfig.connectedTo))
+                       elif self.nimConfig.configMode.value == "nothing":
                                pass
                        elif self.nimConfig.configMode.value == "advanced": # advanced
                                # SATs
@@ -288,6 +304,7 @@ class NimSetup(Screen, ConfigListScreen):
                        "cancel": self.keyCancel,
                }, -2)
 
+               self.slotid = slotid
                self.nim = nimmanager.nim_slots[slotid]
                self.nimConfig = self.nim.config
                self.createSetup()