some work on the timer sanity check (overlapping timers solver)
[enigma2.git] / lib / python / Screens / ScanSetup.py
index f677f5c8dfb74cb122be51f2286ffedf07e78359..1ccbfd9938e2171bade9fdba53a33fbec18d356f 100644 (file)
@@ -19,8 +19,8 @@ def getInitialTransponderList(tlist, pos):
                        parm.frequency = x[1]
                        parm.symbol_rate = x[2]
                        parm.polarisation = x[3] # eDVBFrontendParametersSatellite.Polarisation.Vertical
                        parm.frequency = x[1]
                        parm.symbol_rate = x[2]
                        parm.polarisation = x[3] # eDVBFrontendParametersSatellite.Polarisation.Vertical
-                       #parm.fec = x[4]                        # eDVBFrontendParametersSatellite.FEC.f3_4;
-                       parm.fec = 6                                    # AUTO
+                       parm.fec = x[4]                 # eDVBFrontendParametersSatellite.FEC.f3_4;
+                       #parm.fec = 6                                   # AUTO
                        #parm.inversion = 1     #eDVBFrontendParametersSatellite.Inversion.Off;
                        parm.inversion = 2              #AUTO
                        parm.orbital_position = pos
                        #parm.inversion = 1     #eDVBFrontendParametersSatellite.Inversion.Off;
                        parm.inversion = 2              #AUTO
                        parm.orbital_position = pos
@@ -56,7 +56,7 @@ class ScanSetup(Screen):
                self["config"] = ConfigList(self.list)
                self.createSetup()
 
                self["config"] = ConfigList(self.list)
                self.createSetup()
 
-               self["introduction"] = Label("Press OK to start the scan")
+               self["introduction"] = Label(_("Press OK to start the scan"))
 
        def updateSatList(self):
                self.satList = []
 
        def updateSatList(self):
                self.satList = []
@@ -68,7 +68,7 @@ class ScanSetup(Screen):
                                
        def createSetup(self):
                self.list = []
                                
        def createSetup(self):
                self.list = []
-
+               self.multiscanlist = []
                print "ID: " + str(config.scan.nims.value)
 
                self.list.append(getConfigListEntry(_("Tuner"), config.scan.nims))
                print "ID: " + str(config.scan.nims.value)
 
                self.list.append(getConfigListEntry(_("Tuner"), config.scan.nims))
@@ -86,7 +86,7 @@ class ScanSetup(Screen):
                                self.list.append(getConfigListEntry(_('Satellite'), config.scan.satselection[config.scan.nims.value]))
                                self.list.append(getConfigListEntry(_('Frequency'), config.scan.sat.frequency))
                                self.list.append(getConfigListEntry(_('Inversion'), config.scan.sat.inversion))
                                self.list.append(getConfigListEntry(_('Satellite'), config.scan.satselection[config.scan.nims.value]))
                                self.list.append(getConfigListEntry(_('Frequency'), config.scan.sat.frequency))
                                self.list.append(getConfigListEntry(_('Inversion'), config.scan.sat.inversion))
-                               self.list.append(getConfigListEntry(_('Symbolrate'), config.scan.sat.symbolrate))
+                               self.list.append(getConfigListEntry(_('Symbol Rate'), config.scan.sat.symbolrate))
                                self.list.append(getConfigListEntry(_("Polarity"), config.scan.sat.polarization))
                                self.list.append(getConfigListEntry(_("FEC"), config.scan.sat.fec))
                        if (config.scan.type.value == 1): # single satellite scan
                                self.list.append(getConfigListEntry(_("Polarity"), config.scan.sat.polarization))
                                self.list.append(getConfigListEntry(_("FEC"), config.scan.sat.fec))
                        if (config.scan.type.value == 1): # single satellite scan
@@ -101,9 +101,10 @@ class ScanSetup(Screen):
                                for x in SatList:
                                        if self.Satexists(tlist, x[1]) == 0:
                                                tlist.append(x[1])
                                for x in SatList:
                                        if self.Satexists(tlist, x[1]) == 0:
                                                tlist.append(x[1])
-                                               sat = configElement_nonSave(x[1], configSelection, 0, (_("Enable"), "Disable"))
-                                               self.list.append(getConfigListEntry(nimmanager.getSatDescription(x[1]), sat))
-       
+                                               sat = configElement_nonSave(x[1], configSelection, 0, (_("Enable"), _("Disable")))
+                                               configEntry = getConfigListEntry(nimmanager.getSatDescription(x[1]), sat)
+                                               self.list.append(configEntry)
+                                               self.multiscanlist.append(configEntry)
                                # if (rotor):
                           # for sat in nimmanager.satList:
                                #       self.list.append(getConfigListEntry(sat[0], config.scan.scansat[sat[1]]))
                                # if (rotor):
                           # for sat in nimmanager.satList:
                                #       self.list.append(getConfigListEntry(sat[0], config.scan.scansat[sat[1]]))
@@ -111,32 +112,28 @@ class ScanSetup(Screen):
 
                if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-C"]):
                        if (config.scan.typecable.value == 0): # single transponder
 
                if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-C"]):
                        if (config.scan.typecable.value == 0): # single transponder
-                               self.list.append(getConfigListEntry("Frequency", config.scan.cab.frequency))
-                               self.list.append(getConfigListEntry("Inversion", config.scan.cab.inversion))
-                               self.list.append(getConfigListEntry("Symbolrate", config.scan.cab.symbolrate))
-                               self.list.append(getConfigListEntry("Modulation", config.scan.cab.modulation))
-                               self.list.append(getConfigListEntry("FEC", config.scan.cab.fec))
+                               self.list.append(getConfigListEntry(_("Frequency"), config.scan.cab.frequency))
+                               self.list.append(getConfigListEntry(_("Inversion"), config.scan.cab.inversion))
+                               self.list.append(getConfigListEntry(_("Symbol Rate"), config.scan.cab.symbolrate))
+                               self.list.append(getConfigListEntry(_("Modulation"), config.scan.cab.modulation))
+                               self.list.append(getConfigListEntry(_("FEC"), config.scan.cab.fec))
                        if (config.scan.typecable.value == 1): # complete
                                pass
                        if (config.scan.typecable.value == 1): # complete
                                pass
-       
                                
                if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-T"]):
                        if (config.scan.typeterrestrial.value == 0): # single transponder
                                
                if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-T"]):
                        if (config.scan.typeterrestrial.value == 0): # single transponder
-                               self.list.append(getConfigListEntry("Frequency", config.scan.ter.frequency))
-                               self.list.append(getConfigListEntry("Inversion", config.scan.ter.inversion))
-                               self.list.append(getConfigListEntry("Bandwidth", config.scan.ter.bandwidth))
-                               self.list.append(getConfigListEntry("Code rate high", config.scan.ter.fechigh))
-                               self.list.append(getConfigListEntry("Code rate low", config.scan.ter.feclow))
-                               self.list.append(getConfigListEntry("Modulation", config.scan.ter.modulation))
-                               self.list.append(getConfigListEntry("Transmission mode", config.scan.ter.transmission))
-                               self.list.append(getConfigListEntry("Guard interval mode", config.scan.ter.guard))
-                               self.list.append(getConfigListEntry("Hierarchy mode", config.scan.ter.hierarchy))
+                               self.list.append(getConfigListEntry(_("Frequency"), config.scan.ter.frequency))
+                               self.list.append(getConfigListEntry(_("Inversion"), config.scan.ter.inversion))
+                               self.list.append(getConfigListEntry(_("Bandwidth"), config.scan.ter.bandwidth))
+                               self.list.append(getConfigListEntry(_("Code rate high"), config.scan.ter.fechigh))
+                               self.list.append(getConfigListEntry(_("Code rate low"), config.scan.ter.feclow))
+                               self.list.append(getConfigListEntry(_("Modulation"), config.scan.ter.modulation))
+                               self.list.append(getConfigListEntry(_("Transmission mode"), config.scan.ter.transmission))
+                               self.list.append(getConfigListEntry(_("Guard interval mode"), config.scan.ter.guard))
+                               self.list.append(getConfigListEntry(_("Hierarchy mode"), config.scan.ter.hierarchy))
                        if (config.scan.typeterrestrial.value == 1): # complete
                                pass
 
                        if (config.scan.typeterrestrial.value == 1): # complete
                                pass
 
-
-
-
                self["config"].list = self.list
                self["config"].l.setList(self.list)
 
                self["config"].list = self.list
                self["config"].l.setList(self.list)
 
@@ -166,38 +163,38 @@ class ScanSetup(Screen):
                        nimList = [ ]
                        for nim in nimmanager.nimList():
                                nimList.append(nim[0])
                        nimList = [ ]
                        for nim in nimmanager.nimList():
                                nimList.append(nim[0])
-                       nimList.append("all")
+                       #nimList.append("all")
                        config.scan.nims = configElement_nonSave("config.scan.nims", configSelection, 0, nimList)
 
                        # sat
                        config.scan.nims = configElement_nonSave("config.scan.nims", configSelection, 0, nimList)
 
                        # sat
-                       config.scan.sat.frequency = configElement_nonSave("config.scan.sat.frequency", configSequence, [11836], configsequencearg.get("INTEGER", (10000, 14000)))
-                       config.scan.sat.inversion = configElement_nonSave("config.scan.sat.inversion", configSelection, 2, ("on", "off", "auto"))
-                       config.scan.sat.symbolrate = configElement_nonSave("config.scan.sat.symbolrate", configSequence, [27500], configsequencearg.get("INTEGER", (1, 9999)))
-                       config.scan.sat.polarization = configElement_nonSave("config.scan.sat.polarization", configSelection, 0, ("horizontal", "vertical",  "circular left", "circular right"))
-                       config.scan.sat.fec = configElement_nonSave("config.scan.sat.fec", configSelection, 7, ("None", "1/2", "2/3", "3/4", "5/6", "7/8", "auto"))
+                       config.scan.sat.frequency = configElement_nonSave("config.scan.sat.frequency", configSequence, [11836], configsequencearg.get("INTEGER", (1, 99999)))
+                       config.scan.sat.inversion = configElement_nonSave("config.scan.sat.inversion", configSelection, 2, (_("off"), _("on"), _("Auto")))
+                       config.scan.sat.symbolrate = configElement_nonSave("config.scan.sat.symbolrate", configSequence, [27500], configsequencearg.get("INTEGER", (1, 99999)))
+                       config.scan.sat.polarization = configElement_nonSave("config.scan.sat.polarization", configSelection, 0, (_("horizontal"), _("vertical"),  _("circular left"), _("circular right")))
+                       config.scan.sat.fec = configElement_nonSave("config.scan.sat.fec", configSelection, 7, (_("Auto"), "1/2", "2/3", "3/4", "5/6", "7/8", _("None")))
 
                        # cable
                        config.scan.cab.frequency = configElement_nonSave("config.scan.cab.frequency", configSequence, [466], configsequencearg.get("INTEGER", (50, 9999)))
 
                        # cable
                        config.scan.cab.frequency = configElement_nonSave("config.scan.cab.frequency", configSequence, [466], configsequencearg.get("INTEGER", (50, 9999)))
-                       config.scan.cab.inversion = configElement_nonSave("config.scan.cab.inversion", configSelection, 2, ("off", "on", "Auto"))
-                       config.scan.cab.modulation = configElement_nonSave("config.scan.cab.modulation", configSelection, 2, ("16-QAM", "32-QAM", "64-QAM", "128-QAM", "256-QAM", "Auto"))
-                       config.scan.cab.fec = configElement_nonSave("config.scan.cab.fec", configSelection, 9, ("None", "1/2", "2/3", "3/4", "4/5", "5/6", "6/7", "7/8", "8/9", "Auto"))
-                       config.scan.cab.symbolrate = configElement_nonSave("config.scan.cab.symbolrate", configSequence, [6900], configsequencearg.get("INTEGER", (1, 30000)))
+                       config.scan.cab.inversion = configElement_nonSave("config.scan.cab.inversion", configSelection, 2, (_("off"), _("on"), _("Auto")))
+                       config.scan.cab.modulation = configElement_nonSave("config.scan.cab.modulation", configSelection, 2, ("16-QAM", "32-QAM", "64-QAM", "128-QAM", "256-QAM", _("Auto")))
+                       config.scan.cab.fec = configElement_nonSave("config.scan.cab.fec", configSelection, 9, (_("None"), "1/2", "2/3", "3/4", "4/5", "5/6", "6/7", "7/8", "8/9", _("Auto")))
+                       config.scan.cab.symbolrate = configElement_nonSave("config.scan.cab.symbolrate", configSequence, [6900], configsequencearg.get("INTEGER", (1, 9999)))
 
                        # terrestial
 
                        # terrestial
-                       config.scan.ter.frequency = configElement_nonSave("config.scan.ter.frequency", configSequence, [466], configsequencearg.get("INTEGER", (10000, 14000)))
-                       config.scan.ter.inversion = configElement_nonSave("config.scan.ter.inversion", configSelection, 2, ("off", "on", "Auto"))
-                       config.scan.ter.bandwidth = configElement_nonSave("config.scan.ter.bandwidth", configSelection, 3, ("8MHz", "7MHz", "6MHz", "Auto"))
-                       config.scan.ter.fechigh = configElement_nonSave("config.scan.ter.fechigh", configSelection, 6, ("None", "1/2", "2/3", "3/4", "5/6", "7/8", "Auto"))
-                       config.scan.ter.feclow = configElement_nonSave("config.scan.ter.feclow", configSelection, 6, ("None", "1/2", "2/3", "3/4", "5/6", "7/8", "Auto"))
-                       config.scan.ter.modulation = configElement_nonSave("config.scan.ter.modulation", configSelection, 2, ("QPSK", "QAM16", "Auto"))
-                       config.scan.ter.transmission = configElement_nonSave("config.scan.ter.transmission", configSelection, 2, ("2K", "8K", "Auto"))
-                       config.scan.ter.guard = configElement_nonSave("config.scan.ter.guard", configSelection, 4, ("1/32", "1/16", "1/8", "1/4", "Auto"))
-                       config.scan.ter.hierarchy = configElement_nonSave("config.scan.ter.hierarchy", configSelection, 4, ("None", "1", "2", "4", "Auto"))
+                       config.scan.ter.frequency = configElement_nonSave("config.scan.ter.frequency", configSequence, [466], configsequencearg.get("INTEGER", (100, 900)))
+                       config.scan.ter.inversion = configElement_nonSave("config.scan.ter.inversion", configSelection, 2, (_("off"), _("on"), _("Auto")))
+                       config.scan.ter.bandwidth = configElement_nonSave("config.scan.ter.bandwidth", configSelection, 3, ("8MHz", "7MHz", "6MHz", _("Auto")))
+                       config.scan.ter.fechigh = configElement_nonSave("config.scan.ter.fechigh", configSelection, 6, (_("None"), "1/2", "2/3", "3/4", "5/6", "7/8", _("Auto")))
+                       config.scan.ter.feclow = configElement_nonSave("config.scan.ter.feclow", configSelection, 6, (_("None"), "1/2", "2/3", "3/4", "5/6", "7/8", _("Auto")))
+                       config.scan.ter.modulation = configElement_nonSave("config.scan.ter.modulation", configSelection, 2, ("QPSK", "QAM16", _("Auto")))
+                       config.scan.ter.transmission = configElement_nonSave("config.scan.ter.transmission", configSelection, 2, ("2K", "8K", _("Auto")))
+                       config.scan.ter.guard = configElement_nonSave("config.scan.ter.guard", configSelection, 4, ("1/32", "1/16", "1/8", "1/4", _("Auto")))
+                       config.scan.ter.hierarchy = configElement_nonSave("config.scan.ter.hierarchy", configSelection, 4, (_("None"), "1", "2", "4", _("Auto")))
 
                        config.scan.scansat = {}
                        for sat in nimmanager.satList:
                                #print sat[1]
 
                        config.scan.scansat = {}
                        for sat in nimmanager.satList:
                                #print sat[1]
-                               config.scan.scansat[sat[1]] = configElement_nonSave("config.scan.scansat[" + str(sat[1]) + "]", configSelection, 0, ("yes", "no"))
+                               config.scan.scansat[sat[1]] = configElement_nonSave("config.scan.scansat[" + str(sat[1]) + "]", configSelection, 0, (_("yes"), _("no")))
 
                        config.scan.satselection = []
                        slotid = 0
 
                        config.scan.satselection = []
                        slotid = 0
@@ -248,18 +245,17 @@ class ScanSetup(Screen):
                tlist.append(parm)
 
        # FIXME use correct parameters
                tlist.append(parm)
 
        # FIXME use correct parameters
-       def addTerTransponder(self, tlist, frequency, symbol_rate, polarisation, fec, inversion, orbital_position):
-               print "Add Sat: frequ: " + str(frequency) + " symbol: " + str(symbol_rate) + " pol: " + str(polarisation) + " fec: " + str(fec) + " inversion: " + str(inversion)
-               print "orbpos: " + str(orbital_position)
+       def addTerTransponder(self, tlist, frequency):
                parm = eDVBFrontendParametersTerrestrial()
                parm = eDVBFrontendParametersTerrestrial()
-               parm.frequency = frequency * 1000
-               parm.symbol_rate = symbol_rate * 1000
-               parm.polarisation = polarisation # eDVBFrontendParametersSatellite.Polarisation.Verti   
-               parm.fec = fec                  # eDVBFrontendParametersSatellite.FEC.f3_4;
-               #parm.fec = 6                                   # AUTO
-               parm.inversion = inversion      #eDVBFrontendParametersSatellite.Inversion.Off;
-               #parm.inversion = 2             #AUTO
-               parm.orbital_position = int(orbital_position)
+               
+               parm.frequency = frequency * 1000000
+               parm.inversion = 2  # eDVBFrontendParametersTerrestrial.Inversion.Unknown;
+               parm.bandwidth = 0  #eDVBFrontendParametersTerrestrial.Bandwidth.Bw8MHz;
+               parm.code_rate_HP = parm.code_rate_LP = 6 #eDVBFrontendParametersTerrestrial.FEC.fAuto;
+               parm.modulation = 1 #eDVBFrontendParametersTerrestrial.Modulation.QAM16;
+               parm.transmission_mode = 1 # eDVBFrontendParametersTerrestrial.TransmissionMode.TM8k;
+               parm.guard_interval = 0 # eDVBFrontendParametersTerrestrial.GuardInterval.GI_1_32;
+               parm.hierarchy = 0 #eDVBFrontendParametersTerrestrial.Hierarchy.HNone;
                tlist.append(parm)
 
        def keyGo(self):
                tlist.append(parm)
 
        def keyGo(self):
@@ -280,12 +276,8 @@ class ScanSetup(Screen):
                                                                                          config.scan.cab.fec.value,
                                                                                          config.scan.cab.inversion.value)
                        if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-T"]):
                                                                                          config.scan.cab.fec.value,
                                                                                          config.scan.cab.inversion.value)
                        if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-T"]):
-                               self.addTerTransponder(tlist, config.scan.sat.frequency.value[0],
-                                                                                         config.scan.sat.symbolrate.value[0],
-                                                                                         config.scan.sat.polarization.value,
-                                                                                         config.scan.sat.fec.value,
-                                                                                         config.scan.sat.inversion.value,
-                                                                                         self.satList[config.scan.nims.value][config.scan.satselection[config.scan.nims.value].value][1])
+                               self.addTerTransponder(tlist, 
+                                                                                         config.scan.ter.frequency.value[0])
 
                if (config.scan.type.value == 1): # single sat scan
                        getInitialTransponderList(tlist, int(self.satList[config.scan.nims.value][config.scan.satselection[config.scan.nims.value].value][1]))
 
                if (config.scan.type.value == 1): # single sat scan
                        getInitialTransponderList(tlist, int(self.satList[config.scan.nims.value][config.scan.satselection[config.scan.nims.value].value][1]))
@@ -294,7 +286,7 @@ class ScanSetup(Screen):
                if (config.scan.type.value == 2): # multi sat scan
                        SatList = nimmanager.getSatListForNim(config.scan.nims.value)
 
                if (config.scan.type.value == 2): # multi sat scan
                        SatList = nimmanager.getSatListForNim(config.scan.nims.value)
 
-                       for x in self.list:
+                       for x in self.multiscanlist:
                                if x[1].parent.value == 0:
                                        print "   " + str(x[1].parent.configPath)
                                        getInitialTransponderList(tlist, x[1].parent.configPath)
                                if x[1].parent.value == 0:
                                        print "   " + str(x[1].parent.configPath)
                                        getInitialTransponderList(tlist, x[1].parent.configPath)
@@ -305,9 +297,11 @@ class ScanSetup(Screen):
 
                feid = config.scan.nims.value
                # flags |= eComponentScan.scanSearchBAT
 
                feid = config.scan.nims.value
                # flags |= eComponentScan.scanSearchBAT
-               self.session.openWithCallback(self.keyCancel, ServiceScan, tlist, feid, flags)
+               self.session.openWithCallback(self.doNothing, ServiceScan, tlist, feid, flags)
 
                #self.close()
 
                #self.close()
+       def doNothing(self):
+               pass
 
        def keyCancel(self):
                for x in self["config"].list:
 
        def keyCancel(self):
                for x in self["config"].list:
@@ -316,7 +310,19 @@ class ScanSetup(Screen):
 
 class ScanSimple(Screen):
 
 
 class ScanSimple(Screen):
 
-       def keyOK(self):
+       def run(self):
+               print "start scan for sats:"
+               tlist = [ ]
+               for x in self.list:
+                       if x[1].parent.value == 0:
+                               print "   " + str(x[1].parent.configPath)
+                               getInitialTransponderList(tlist, x[1].parent.configPath)
+
+               feid = 0 # FIXME
+               self.session.openWithCallback(self.doNothing, ServiceScan, tlist, feid, eComponentScan.scanNetworkSearch)
+               
+
+       def keyGo(self):
                print "start scan for sats:"
                tlist = [ ]
                for x in self.list:
                print "start scan for sats:"
                tlist = [ ]
                for x in self.list:
@@ -325,8 +331,11 @@ class ScanSimple(Screen):
                                getInitialTransponderList(tlist, x[1].parent.configPath)
 
                feid = 0 # FIXME
                                getInitialTransponderList(tlist, x[1].parent.configPath)
 
                feid = 0 # FIXME
-               self.session.openWithCallback(self.keyCancel, ServiceScan, tlist, feid, eComponentScan.scanNetworkSearch)
+               self.session.openWithCallback(self.doNothing, ServiceScan, tlist, feid, eComponentScan.scanNetworkSearch)
 
 
+       def doNothing(self):
+               pass
+       
        def keyCancel(self):
                self.close()
 
        def keyCancel(self):
                self.close()
 
@@ -347,7 +356,7 @@ class ScanSimple(Screen):
 
                self["actions"] = ActionMap(["SetupActions"],
                {
 
                self["actions"] = ActionMap(["SetupActions"],
                {
-                       "ok": self.keyOK,
+                       "ok": self.keyGo,
                        "cancel": self.keyCancel,
                        "left": self.keyLeft,
                        "right": self.keyRight,
                        "cancel": self.keyCancel,
                        "left": self.keyLeft,
                        "right": self.keyRight,
@@ -356,13 +365,15 @@ class ScanSimple(Screen):
                self.list = []
                tlist = []
 
                self.list = []
                tlist = []
 
-               SatList = nimmanager.getConfiguredSats()
 
 
-               for x in SatList:
-                       if self.Satexists(tlist, x) == 0:
-                               tlist.append(x)
-                               sat = configElement_nonSave(x, configSelection, 0, (_("Enable"), _("Disable")))
-                               self.list.append(getConfigListEntry(nimmanager.getSatDescription(x), sat))
+               for slotid in nimmanager.getNimListOfType(nimmanager.nimType["DVB-S"]):
+                       SatList = nimmanager.getSatListForNim(slotid)
+
+                       for x in SatList:
+                               if self.Satexists(tlist, x[1]) == 0:
+                                       tlist.append(x[1])
+                                       sat = configElement_nonSave(x[1], configSelection, 0, (_("Enable"), _("Disable")))
+                                       self.list.append(getConfigListEntry(nimmanager.getSatDescription(x[1]), sat))
 
                self["config"] = ConfigList(self.list)
                self["header"] = Label(_("Automatic Scan"))
 
                self["config"] = ConfigList(self.list)
                self["header"] = Label(_("Automatic Scan"))