use default service types for filtering in bouquets
[enigma2.git] / lib / python / Screens / Satconfig.py
index 969d4d0c9b0028d7ea87306c9e9cdcc7d3fb0575..8bd33a8a273ce8fcfce26d839c5fb6e44bdd6d5d 100644 (file)
@@ -22,22 +22,32 @@ class NimSetup(Screen):
        
        def createPositionerSetup(self, nim, list):
                list.append(getConfigListEntry(_("Positioner mode"), config.Nims[nim.slotid].positionerMode))
-               if (config.Nims[nim.slotid].positionerMode.value == 0): # USALS
+               if (currentConfigSelectionElement(config.Nims[nim.slotid].positionerMode) == "usals"): # USALS
                        list.append(getConfigListEntry(_("Longitude"), config.Nims[nim.slotid].longitude))
                        list.append(getConfigListEntry("", config.Nims[nim.slotid].longitudeOrientation))
                        list.append(getConfigListEntry(_("Latitude"), config.Nims[nim.slotid].latitude))
                        list.append(getConfigListEntry("", config.Nims[nim.slotid].latitudeOrientation))
-               elif (config.Nims[nim.slotid].positionerMode.value == 1): # manual
+               elif (currentConfigSelectionElement(config.Nims[nim.slotid].positionerMode) == "manual"): # manual
                        pass
        
        def createSetup(self):
+               print "Creating setup"
                self.list = [ ]
-               
+
+               self.configMode = None
+               self.diseqcModeEntry = None
+               self.advancedSatsEntry = None
+               self.advancedLnbsEntry = None
+               self.advancedDiseqcMode = None
+               self.advancedUsalsEntry = None
+               self.advancedLof = None
+               self.advancedPowerMeasurement = None
+
                if (nimmanager.getNimType(self.nim.slotid) == nimmanager.nimType["DVB-S"]):
                        self.configMode = getConfigListEntry(_("Configuration Mode"), config.Nims[self.nim.slotid].configMode)
                        self.list.append(self.configMode)
                        
-                       if config.Nims[self.nim.slotid].configMode.value == 0:                  #simple setup
+                       if currentConfigSelectionElement(config.Nims[self.nim.slotid].configMode) == "simple":                  #simple setup
                                self.diseqcModeEntry = getConfigListEntry(_("DiSEqC Mode"), config.Nims[self.nim.slotid].diseqcMode)
                                self.list.append(self.diseqcModeEntry)
                        
@@ -45,12 +55,60 @@ class NimSetup(Screen):
                                        self.createSimpleSetup(self.nim, self.list, config.Nims[self.nim.slotid].diseqcMode.value)
                                if (config.Nims[self.nim.slotid].diseqcMode.value == 4):
                                        self.createPositionerSetup(self.nim, self.list)
-                       elif config.Nims[self.nim.slotid].configMode.value == 1: # linked tuner
+                       elif currentConfigSelectionElement(config.Nims[self.nim.slotid].configMode) == "nothing": # nothing
                                #self.list.append(getConfigListEntry(_("Linked to"), config.Nims[self.nim.slotid].linkedTo))
                                pass
-                       elif config.Nims[self.nim.slotid].configMode.value == 2: # advanced mode
-                               print "FIXME: implement advanced mode"
-               
+                       elif currentConfigSelectionElement(config.Nims[self.nim.slotid].configMode) == "loopthrough": # linked
+                               pass
+                       elif currentConfigSelectionElement(config.Nims[self.nim.slotid].configMode) == "advanced": # advanced
+                               # SATs
+                               self.advancedSatsEntry = getConfigListEntry(_("Satellite"), config.Nims[self.nim.slotid].advanced.sats)
+                               self.list.append(self.advancedSatsEntry)
+                               currSat = config.Nims[self.nim.slotid].advanced.sat[nimmanager.satList[config.Nims[self.nim.slotid].advanced.sats.value][1]]
+                               currLnb = config.Nims[self.nim.slotid].advanced.lnb[currSat.lnb.value]
+                               
+                               self.list.append(getConfigListEntry(_("Voltage mode"), currSat.voltage))
+                               self.list.append(getConfigListEntry(_("Tone mode"), currSat.tonemode))
+                               if (currLnb != 0 and currentConfigSelectionElement(currLnb.diseqcMode) == "1_2"):
+                                       self.advancedUsalsEntry = getConfigListEntry(_("Use usals for this sat"), currSat.usals)
+                                       self.list.append(self.advancedUsalsEntry)
+                                       if (currentConfigSelectionElement(currSat.usals) == "no"):
+                                               self.list.append(getConfigListEntry(_("Stored position"), currSat.rotorposition))
+                               
+                               # LNBs
+                               self.advancedLnbsEntry = getConfigListEntry(_("LNB"), currSat.lnb)
+                               self.list.append(self.advancedLnbsEntry)
+                               if currLnb != 0:
+                                       self.advancedDiseqcMode = getConfigListEntry(_("DiSEqC mode"), currLnb.diseqcMode)
+                                       self.list.append(self.advancedDiseqcMode)
+                                       if currentConfigSelectionElement(currLnb.diseqcMode) != "none":
+                                               self.list.append(getConfigListEntry(_("Toneburst"), currLnb.toneburst))
+                                               self.list.append(getConfigListEntry(_("Committed DiSEqC command"), currLnb.commitedDiseqcCommand))
+                                               self.list.append(getConfigListEntry(_("Fast DiSEqC"), currLnb.fastDiseqc))
+                                               self.list.append(getConfigListEntry(_("Sequence repeat"), currLnb.sequenceRepeat))
+                                               if currentConfigSelectionElement(currLnb.diseqcMode) == "1_0":
+                                                       self.list.append(getConfigListEntry(_("Command order"), currLnb.commandOrder1_0))
+                                               else:
+                                                       self.list.append(getConfigListEntry(_("Command order"), currLnb.commandOrder))
+                                                       self.list.append(getConfigListEntry(_("Uncommitted DiSEqC command"), currLnb.uncommittedDiseqcCommand))
+                                                       self.list.append(getConfigListEntry(_("DiSEqC repeats"), currLnb.diseqcRepeats))
+                                               if currentConfigSelectionElement(currLnb.diseqcMode) == "1_2":
+                                                       self.list.append(getConfigListEntry(_("Longitude"), currLnb.longitude))
+                                                       self.list.append(getConfigListEntry("", currLnb.longitudeOrientation))
+                                                       self.list.append(getConfigListEntry(_("Latitude"), currLnb.latitude))
+                                                       self.list.append(getConfigListEntry("", currLnb.latitudeOrientation))
+                                                       self.advancedPowerMeasurement = getConfigListEntry("Use Power Measurement", currLnb.powerMeasurement)
+                                                       self.list.append(self.advancedPowerMeasurement)
+                                                       if currentConfigSelectionElement(currLnb.powerMeasurement) == "yes":
+                                                               self.list.append(getConfigListEntry("Power Threshold in mA", currLnb.powerThreshold))
+                                       self.advancedLof = getConfigListEntry(_("LOF"), currLnb.lof)
+                                       self.list.append(self.advancedLof)
+                                       if currentConfigSelectionElement(currLnb.lof) == "user_defined":
+                                               self.list.append(getConfigListEntry(_("LOF/L"), currLnb.lofl))
+                                               self.list.append(getConfigListEntry(_("LOF/H"), currLnb.lofh))
+                                               self.list.append(getConfigListEntry(_("Threshold"), currLnb.threshold))
+                                       self.list.append(getConfigListEntry(_("12V Output"), currLnb.output_12v))
+                                       self.list.append(getConfigListEntry(_("Increased voltage"), currLnb.increased_voltage))
                elif (nimmanager.getNimType(self.nim.slotid) == nimmanager.nimType["DVB-C"]):
                        self.list.append(getConfigListEntry(_("Cable provider"), config.Nims[self.nim.slotid].cable))
                elif (nimmanager.getNimType(self.nim.slotid) == nimmanager.nimType["DVB-T"]):
@@ -60,27 +118,16 @@ class NimSetup(Screen):
                self["config"].list = self.list
                self["config"].l.setList(self.list)
                
-       def newConfig(self):    
-               if self["config"].getCurrent() == self.diseqcModeEntry:
-                       self.createSetup()
-               if self["config"].getCurrent() == self.configMode:
-                       self.createSetup()
-               
+       def newConfig(self):
+               checkList = (self.configMode, self.diseqcModeEntry, self.advancedSatsEntry, self.advancedLnbsEntry, self.advancedDiseqcMode, self.advancedUsalsEntry, self.advancedLof, self.advancedPowerMeasurement)
+               for x in checkList:
+                       if self["config"].getCurrent() == x:
+                               self.createSetup()                      
        def keyLeft(self):
-               if self["config"].getCurrent() == self.configMode:
-                       if self.nim.slotid == 0:
-                               return
                self["config"].handleKey(config.key["prevElement"])
                self.newConfig()
 
        def keyRight(self):
-               #forbid to enable advanced mode until its ready
-               #perhaps its better to use an own element here
-               #this suckz .. how enable advanced config?
-               if self["config"].getCurrent() == self.configMode:
-                       if self.nim.slotid == 0:
-                               return
-
                self["config"].handleKey(config.key["nextElement"])
                self.newConfig()