Add possibility to set Pilot also for DVB-S2 non 8PSK Transponders (i.e. the new...
[enigma2.git] / lib / python / Screens / ScanSetup.py
index 18995d10108b2f2867c2751d8cab67ed14477fac..608dcb2d2d0e1cb237102007bf695ef7c34da03c 100644 (file)
@@ -160,8 +160,8 @@ class CableTransponderSearchSupport:
 
        def cableTransponderSearchSessionClosed(self, *val):
                print "cableTransponderSearchSessionClosed, val", val
-               self.cable_search_container.appClosed.get().remove(self.cableTransponderSearchClosed)
-               self.cable_search_container.dataAvail.get().remove(self.getCableTransponderData)
+               self.cable_search_container.appClosed.remove(self.cableTransponderSearchClosed)
+               self.cable_search_container.dataAvail.remove(self.getCableTransponderData)
                self.cable_search_container = None
                self.cable_search_session = None
                if val and len(val) and val[0]:
@@ -207,8 +207,8 @@ class CableTransponderSearchSupport:
                                        return
                self.__tlist = [ ]
                self.cable_search_container = eConsoleAppContainer()
-               self.cable_search_container.appClosed.get().append(self.cableTransponderSearchClosed)
-               self.cable_search_container.dataAvail.get().append(self.getCableTransponderData)
+               self.cable_search_container.appClosed.append(self.cableTransponderSearchClosed)
+               self.cable_search_container.dataAvail.append(self.getCableTransponderData)
                cableConfig = config.Nims[nim_idx].cable
                cmd = "tda1002x --init --scan --verbose --wakeup --inv 2 --bus "
                #FIXMEEEEEE hardcoded i2c devices for dm7025 and dm8000
@@ -296,7 +296,7 @@ class DefaultSatLists(DefaultWizard):
                print "statusCallback:", status, progress
                from Components.DreamInfoHandler import DreamInfoHandler
                if status == DreamInfoHandler.STATUS_DONE:
-                       self["text"].setText(_("The installation of the default services lists is finished."))
+                       self["text"].setText(_("The installation of the default services lists is finished.") + "\n\n" + _("Please press OK to continue."))
                        self.markDone()
                        self.disableKeys = False        
 
@@ -372,6 +372,7 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport):
                        self.typeOfScanEntry = getConfigListEntry(_("Type of scan"), self.scan_typeterrestrial)
                        self.list.append(self.typeOfScanEntry)
 
+               self.scan_networkScan.value = False
                if nim.isCompatible("DVB-S"):
                        if self.scan_type.value == "single_transponder":
                                self.updateSatList()
@@ -393,29 +394,23 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport):
                                        self.modulationEntry = getConfigListEntry(_('Modulation'), self.scan_sat.modulation)
                                        self.list.append(self.modulationEntry)
                                        self.list.append(getConfigListEntry(_('Rolloff'), self.scan_sat.rolloff))
-                                       if self.scan_sat.modulation.value == "8psk":
-                                               self.list.append(getConfigListEntry(_('Pilot'), self.scan_sat.pilot))
-                               self.list.append(getConfigListEntry(_("Network scan"), self.scan_networkScan))
+                                       self.list.append(getConfigListEntry(_('Pilot'), self.scan_sat.pilot))
                        elif self.scan_type.value == "single_satellite":
                                self.updateSatList()
                                print self.scan_satselection[index_to_scan]
                                self.list.append(getConfigListEntry(_("Satellite"), self.scan_satselection[index_to_scan]))
-                               self.list.append(getConfigListEntry(_("Clear before scan"), self.scan_clearallservices))
-                       elif self.scan_type.value == "multisat":
-                               # if (norotor)
+                               self.scan_networkScan.value = True
+                       elif self.scan_type.value.find("multisat") != -1:
                                tlist = []
                                SatList = nimmanager.getSatListForNim(index_to_scan)
-                               self.list.append(getConfigListEntry(_("Clear before scan"), self.scan_clearallservices))
                                for x in SatList:
                                        if self.Satexists(tlist, x[0]) == 0:
                                                tlist.append(x[0])
-                                               sat = ConfigEnableDisable(default = True)
+                                               sat = ConfigEnableDisable(default = self.scan_type.value.find("_yes") != -1 and True or False)
                                                configEntry = getConfigListEntry(nimmanager.getSatDescription(x[0]), sat)
                                                self.list.append(configEntry)
                                                self.multiscanlist.append((x[0], sat))
-                               # if (rotor):
-                          # for sat in nimmanager.satList:
-                               #       self.list.append(getConfigListEntry(sat[1], self.scan_scansat[sat[0]]))
+                               self.scan_networkScan.value = True
                elif nim.isCompatible("DVB-C"):
                        if self.scan_typecable.value == "single_transponder":
                                self.list.append(getConfigListEntry(_("Frequency"), self.scan_cab.frequency))
@@ -423,9 +418,6 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport):
                                self.list.append(getConfigListEntry(_("Symbol Rate"), self.scan_cab.symbolrate))
                                self.list.append(getConfigListEntry(_("Modulation"), self.scan_cab.modulation))
                                self.list.append(getConfigListEntry(_("FEC"), self.scan_cab.fec))
-                               self.list.append(getConfigListEntry(_("Network scan"), self.scan_networkScan))
-                       elif self.scan_typecable.value == "complete":
-                               self.list.append(getConfigListEntry(_("Clear before scan"), self.scan_clearallservices))
                elif nim.isCompatible("DVB-T"):
                        if self.scan_typeterrestrial.value == "single_transponder":
                                self.list.append(getConfigListEntry(_("Frequency"), self.scan_ter.frequency))
@@ -437,23 +429,9 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport):
                                self.list.append(getConfigListEntry(_("Transmission mode"), self.scan_ter.transmission))
                                self.list.append(getConfigListEntry(_("Guard interval mode"), self.scan_ter.guard))
                                self.list.append(getConfigListEntry(_("Hierarchy mode"), self.scan_ter.hierarchy))
-                               self.list.append(getConfigListEntry(_("Network scan"), self.scan_networkScan))
-                       elif self.scan_typeterrestrial.value == "complete":
-                               self.list.append(getConfigListEntry(_("Clear before scan"), self.scan_clearallservices))
-
-#              if (nim.isCompatible("DVB-S") and self.scan_type.type == "single_transponder") or \
-#                      (nim.isCompatbile("DVB-C") and self.scan_typecable.type == "single_transponder") or \
-#                      (nim.isCompatible("DVB-T") and self.scan_typeterrestrial.type == "single_transponder"):
-#                              self.configElementSNR = getConfigListEntry(_("SNR"), self.scan_snr)
-#                              self.list.append(self.configElementSNR)
-#                              self.configElementACG = getConfigListEntry(_("AGC"), self.scan_agc)
-#                              self.list.append(self.configElementACG)
-#                              self.configElementBER = getConfigListEntry(_("BER"), self.scan_ber)
-#                              self.list.append(self.configElementBER)
-#                              self.statusTimer.start(500, False)
-#              else:
-#                      self.statusTimer.stop()
-
+               self.list.append(getConfigListEntry(_("Network scan"), self.scan_networkScan))
+               self.list.append(getConfigListEntry(_("Clear before scan"), self.scan_clearallservices))
+               self.list.append(getConfigListEntry(_("Only Free scan"), self.scan_onlyfree))
                self["config"].list = self.list
                self["config"].l.setList(self.list)
 
@@ -536,10 +514,11 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport):
                        self.scan_cab = ConfigSubsection()
                        self.scan_ter = ConfigSubsection()
 
-                       self.scan_type = ConfigSelection(default = "single_transponder", choices = [("single_transponder", _("Single transponder")), ("single_satellite", _("Single satellite")), ("multisat", _("Multisat"))])
+                       self.scan_type = ConfigSelection(default = "single_transponder", choices = [("single_transponder", _("Single transponder")), ("single_satellite", _("Single satellite")), ("multisat", _("Multisat")), ("multisat_yes", _("Multisat"))])
                        self.scan_typecable = ConfigSelection(default = "single_transponder", choices = [("single_transponder", _("Single transponder")), ("complete", _("Complete"))])
                        self.scan_typeterrestrial = ConfigSelection(default = "single_transponder", choices = [("single_transponder", _("Single transponder")), ("complete", _("Complete"))])
                        self.scan_clearallservices = ConfigSelection(default = "no", choices = [("no", _("no")), ("yes", _("yes")), ("yes_hold_feeds", _("yes (keep feeds)"))])
+                       self.scan_onlyfree = ConfigYesNo(default = False)
                        self.scan_networkScan = ConfigYesNo(default = False)
 
                        nim_list = []
@@ -663,9 +642,8 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport):
        def keyGo(self):
                tlist = []
                flags = None
-               extFlags = True
-               
                startScan = True
+               removeAll = True
                index_to_scan = int(self.scan_nims.value)
                
                if self.scan_nims == [ ]:
@@ -702,12 +680,11 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport):
                                                                self.scan_sat.modulation.index,
                                                                self.scan_sat.rolloff.index,
                                                                self.scan_sat.pilot.index)
-                               flags = self.scan_networkScan.value and eComponentScan.scanNetworkSearch or 0
-                               extFlags = False
+                               removeAll = False
                        elif self.scan_type.value == "single_satellite":
                                sat = self.satList[index_to_scan][self.scan_satselection[index_to_scan].index]
                                getInitialTransponderList(tlist, sat[0])
-                       elif self.scan_type.value == "multisat":
+                       elif self.scan_type.value.find("multisat") != -1:
                                SatList = nimmanager.getSatListForNim(index_to_scan)
                                for x in self.multiscanlist:
                                        if x[1].value:
@@ -722,8 +699,7 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport):
                                                                                          self.scan_cab.modulation.index + 1,
                                                                                          fec,
                                                                                          self.scan_cab.inversion.index)
-                               flags = self.scan_networkScan.value and eComponentScan.scanNetworkSearch or 0
-                               extFlags = False
+                               removeAll = False
                        elif self.scan_typecable.value == "complete":
                                if config.Nims[index_to_scan].cable.scan_type.value == "provider":
                                        getInitialCableTransponderList(tlist, index_to_scan)
@@ -742,21 +718,24 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport):
                                                transmission = self.scan_ter.transmission.index,
                                                guard = self.scan_ter.guard.index,
                                                hierarchy = self.scan_ter.hierarchy.index)
-                               flags = self.scan_networkScan.value and eComponentScan.scanNetworkSearch or 0
-                               extFlags = False
+                               removeAll = False
                        elif self.scan_typeterrestrial.value == "complete":
                                getInitialTerrestrialTransponderList(tlist, nimmanager.getTerrestrialDescription(index_to_scan))
 
-               if flags is None:
-                       flags = eComponentScan.scanNetworkSearch
+               flags = self.scan_networkScan.value and eComponentScan.scanNetworkSearch or 0
+
+               tmp = self.scan_clearallservices.value
+               if tmp == "yes":
+                       flags |= eComponentScan.scanRemoveServices
+               elif tmp == "yes_hold_feeds":
+                       flags |= eComponentScan.scanRemoveServices
+                       flags |= eComponentScan.scanDontRemoveFeeds
+
+               if tmp != "no" and not removeAll:
+                       flags |= eComponentScan.scanDontRemoveUnscanned
 
-               if extFlags:
-                       tmp = self.scan_clearallservices.value
-                       if tmp == "yes":
-                               flags |= eComponentScan.scanRemoveServices
-                       elif tmp == "yes_hold_feeds":
-                               flags |= eComponentScan.scanRemoveServices
-                               flags |= eComponentScan.scanDontRemoveFeeds
+               if self.scan_onlyfree.value:
+                       flags |= eComponentScan.scanOnlyFree
 
                for x in self["config"].list:
                        x[1].save()
@@ -797,18 +776,6 @@ class ScanSimple(ConfigListScreen, Screen, CableTransponderSearchSupport):
        def getNetworksForNim(self, nim):
                if nim.isCompatible("DVB-S"):
                        networks = nimmanager.getSatListForNim(nim.slot)
-# the original code took "loopthrough" etc. into account. Do we need this?
-#                      if nimmanager.getNimConfigMode(1) in ["loopthrough", "satposdepends", "equal", "nothing"]:
-#                              return False
-#                      sec = eDVBSatelliteEquipmentControl.getInstance()
-#                      if sec is not None:
-#                              exclusive_satellites = sec.get_exclusive_satellites(0,1)
-#                              if len(exclusive_satellites) == 2:
-#                                      return False
-#                              idx = exclusive_satellites[0]+1
-#                              exclusive_nim_sats = exclusive_satellites[idx+1:idx+1+exclusive_satellites[idx]]
-#                              if len(exclusive_nim_sats):
-#                                      return True
                elif not nim.empty:
                        networks = [ nim.type ] # "DVB-C" or "DVB-T". TODO: seperate networks for different C/T tuners, if we want to support that.
                else: