revert local change (just for testing)
[enigma2.git] / lib / python / Screens / ScanSetup.py
index 7aaca3829d349da21b4ac779c068c1f9c14790de..1e164d432dfb9ad944824fdf80a348aec118943a 100644 (file)
@@ -3,7 +3,7 @@ from ServiceScan import *
 from Components.config import config, ConfigSubsection, ConfigSelection, ConfigYesNo, ConfigInteger, getConfigListEntry, ConfigSlider, ConfigSatlist, ConfigEnableDisable
 from Components.ActionMap import NumberActionMap
 from Components.ConfigList import ConfigList, ConfigListScreen
-from Components.NimManager import nimmanager
+from Components.NimManager import nimmanager, getConfigSatlist
 from Components.Label import Label
 from Screens.MessageBox import MessageBox
 from enigma import eTimer, eDVBFrontendParametersSatellite, eComponentScan, eDVBSatelliteEquipmentControl, eDVBFrontendParametersTerrestrial, eDVBFrontendParametersCable
@@ -91,15 +91,25 @@ def getInitialTransponderList(tlist, pos):
 def getInitialCableTransponderList(tlist, cable):
        list = nimmanager.getTranspondersCable(cable)
 
+       symbolrates = [6900000, 6875000]
+       modulations = [3, 5, 1, 2, 4] # QAM 64, 256, 16, 32, 128
+
        for x in list:
                if x[0] == 1: #CABLE
-                       parm = eDVBFrontendParametersCable()
-                       parm.frequency = x[1]
-                       parm.symbol_rate = x[2]
-                       parm.modulation = x[3]
-                       parm.fec_inner = x[4]
-                       parm.inversion = 2 # AUTO
-                       tlist.append(parm)
+                       for symbolrate in symbolrates:
+                               for modulation in modulations:
+                                       parm = eDVBFrontendParametersCable()
+                                       parm.frequency = x[1]
+                                       parm.symbol_rate = symbolrate
+                                       parm.modulation = modulation
+                                       parm.fec_inner = 0
+                                       parm.inversion = 2 # AUTO
+                                       #print "frequency:", x[1]
+                                       #print "symbol_rate:", x[2]
+                                       #print "modulation:", x[3]
+                                       #print "fec_inner:", x[4]
+                                       #print "inversion:", 2
+                                       tlist.append(parm)
 
 def getInitialTerrestrialTransponderList(tlist, region):
        list = nimmanager.getTranspondersTerrestrial(region)
@@ -130,12 +140,11 @@ class ScanSetup(ConfigListScreen, Screen):
                del self.feinfo
                del self.service
 
-
                self["actions"] = NumberActionMap(["SetupActions"],
                {
                        "ok": self.keyGo,
                        "cancel": self.keyCancel,
-               }, -1)
+               }, -2)
 
                self.statusTimer = eTimer()
                self.statusTimer.timeout.get().append(self.updateStatus)
@@ -318,9 +327,9 @@ class ScanSetup(ConfigListScreen, Screen):
                                elif frontendData["tuner_type"] == "DVB-C":
                                        defaultCab["frequency"] = int(frontendData["frequency"] / 1000)
                                        defaultCab["symbolrate"] = int(frontendData["symbol_rate"] / 1000)
-                                       defaultSat["inversion"] = {"INVERSION_OFF": "off", "INVERSION_ON": "on", "INVERSION_AUTO": "auto"}[frontendData["inversion"]]
-                                       defaultSat["fec"] = {"FEC_AUTO": "auto", "FEC_1_2": "1_2", "FEC_2_3": "2_3", "FEC_3_4": "3_4", "FEC_5_6": "5_6", "FEC_7_8": "7_8", "FEC_8_9": "8_9", "FEC_NONE": "none"}[frontendData["fec_inner"]]
-                                       defaultSat["modulation"] = {"QAM_AUTO": "auto", "QAM_16": "16qam", "QAM_32": "32qam", "QAM_64": "64qam", "QAM_128": "128qam", "QAM_256": "256qam"}[frontendData["modulation"]]
+                                       defaultCab["inversion"] = {"INVERSION_OFF": "off", "INVERSION_ON": "on", "INVERSION_AUTO": "auto"}[frontendData["inversion"]]
+                                       defaultCab["fec"] = {"FEC_AUTO": "auto", "FEC_1_2": "1_2", "FEC_2_3": "2_3", "FEC_3_4": "3_4", "FEC_5_6": "5_6", "FEC_7_8": "7_8", "FEC_8_9": "8_9", "FEC_NONE": "none"}[frontendData["fec_inner"]]
+                                       defaultCab["modulation"] = {"QAM_AUTO": "auto", "QAM_16": "16qam", "QAM_32": "32qam", "QAM_64": "64qam", "QAM_128": "128qam", "QAM_256": "256qam"}[frontendData["modulation"]]
 
                        self.scan_sat = ConfigSubsection()
                        self.scan_cab = ConfigSubsection()
@@ -387,7 +396,7 @@ class ScanSetup(ConfigListScreen, Screen):
                        for slot in nimmanager.nimslots:
                                if (nimmanager.getNimType(slot.slotid) == nimmanager.nimType["DVB-S"]):
                                        print str(slot.slotid) + " : " + str(self.satList)
-                                       self.scan_satselection.append(ConfigSatlist(default = defaultSat["orbpos"], list = self.satList[slot.slotid]))
+                                       self.scan_satselection.append(getConfigSatlist(defaultSat["orbpos"],self.satList[slot.slotid]))
                                else:
                                        self.scan_satselection.append(None)
 
@@ -565,7 +574,7 @@ class ScanSimple(ConfigListScreen, Screen):
                {
                        "ok": self.keyGo,
                        "cancel": self.keyCancel,
-               }, -1)
+               }, -2)
 
                self.list = []
                tlist = []
@@ -580,6 +589,8 @@ class ScanSimple(ConfigListScreen, Screen):
                        nim.nim_index = 0
                        if nimtype == nimmanager.nimType["DVB-S"] and not len(nimmanager.getSatListForNim(0)):
                                scan_possible=False
+                       if nimtype == nimmanager.nimType["empty/unknown"]:
+                               scan_possible = False
                        if scan_possible:
                                self.list.append(getConfigListEntry(_("Scan NIM") + " 0 (" + nimmanager.getNimTypeName(0) + ")", nim))
 
@@ -613,6 +624,7 @@ class ScanSimple(ConfigListScreen, Screen):
                        print "Scan Tuner", slotid, "-", c.value
                        if c.value:
                                scanPossible = False
+                               trustNit = False
                                tlist = [ ]
                                if nimmanager.getNimType(slotid) == nimmanager.nimType["DVB-S"]:
                                        print "is sat"
@@ -632,6 +644,8 @@ class ScanSimple(ConfigListScreen, Screen):
                                elif nimmanager.getNimType(slotid) == nimmanager.nimType["DVB-C"]:
                                        scanPossible = True
                                        getInitialCableTransponderList(tlist, nimmanager.getCableDescription(slotid))
+                                       if nimmanager.getCableTrustNit(slotid):
+                                               trustNit = True
                                elif nimmanager.getNimType(slotid) == nimmanager.nimType["DVB-T"]:
                                        scanPossible = True
                                        getInitialTerrestrialTransponderList(tlist, nimmanager.getTerrestrialDescription(slotid))
@@ -640,6 +654,8 @@ class ScanSimple(ConfigListScreen, Screen):
 
                                if scanPossible:
                                        flags=eComponentScan.scanNetworkSearch
+                                       if trustNit:
+                                               flags |= eComponentScan.clearToScanOnFirstNIT
                                        tmp = self.scan_clearallservices.value
                                        if tmp == "yes":
                                                flags |= eComponentScan.scanRemoveServices
@@ -665,6 +681,8 @@ class ScanSimple(ConfigListScreen, Screen):
                return 0
 
        def ScanNimTwoNeeded(self):
+               if nimmanager.getNimType(1) == nimmanager.nimType["empty/unknown"]:
+                       return False
                if nimmanager.getNimType(0) != nimmanager.getNimType(1):
                        return True
                if nimmanager.getNimType(0) == nimmanager.nimType["DVB-S"]: #two dvb-s nims