show progress and current time in servicelist event information instead of
[enigma2.git] / lib / python / Screens / ScanSetup.py
index 9980df53dad1334393ca259a7b4e4da8545f7821..2a8c3df72b086067cadfe61d41622b5c23b8fec8 100644 (file)
@@ -1,9 +1,9 @@
 from Screen import Screen
-from ServiceScan import *
+from ServiceScan import ServiceScan
 from Components.config import config, ConfigSubsection, ConfigSelection, \
-       ConfigYesNo, ConfigInteger, getConfigListEntry, ConfigSlider, ConfigSatlist, ConfigEnableDisable
-from Components.ActionMap import NumberActionMap
-from Components.ConfigList import ConfigList, ConfigListScreen
+       ConfigYesNo, ConfigInteger, getConfigListEntry, ConfigSlider, ConfigEnableDisable
+from Components.ActionMap import NumberActionMap, ActionMap
+from Components.ConfigList import ConfigListScreen
 from Components.NimManager import nimmanager, getConfigSatlist
 from Components.Label import Label
 from Screens.MessageBox import MessageBox
@@ -277,6 +277,7 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport):
        def __init__(self, session):
                Screen.__init__(self, session)
 
+               self.finished_cb = None
                self.updateSatList()
                self.service = session.nav.getCurrentService()
                self.feinfo = None
@@ -306,7 +307,8 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport):
 
                self["introduction"] = Label(_("Press OK to start the scan"))
 
-       def run(self):
+       def runAsync(self, finished_cb):
+               self.finished_cb = finished_cb
                self.keyGo()
 
        def updateSatList(self):
@@ -385,7 +387,7 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport):
                elif nim.isCompatible("DVB-C"):
                        if self.scan_typecable.value == "single_transponder":
                                self.list.append(getConfigListEntry(_("Frequency"), self.scan_cab.frequency))
-                               self.list.append(getConfigListEntry(_("Inversions"), self.scan_cab.inversion))
+                               self.list.append(getConfigListEntry(_("Inversion"), self.scan_cab.inversion))
                                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))
@@ -735,9 +737,15 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport):
        def startScan(self, tlist, flags, feid):
                if len(tlist):
                        # flags |= eComponentScan.scanSearchBAT
-                       self.session.open(ServiceScan, [{"transponders": tlist, "feid": feid, "flags": flags}])
+                       if self.finished_cb:
+                               self.session.openWithCallback(self.finished_cb, ServiceScan, [{"transponders": tlist, "feid": feid, "flags": flags}])
+                       else:
+                               self.session.open(ServiceScan, [{"transponders": tlist, "feid": feid, "flags": flags}])
                else:
-                       self.session.open(MessageBox, _("Nothing to scan!\nPlease setup your tuner settings before you start a service scan."), MessageBox.TYPE_ERROR)
+                       if self.finished_cb:
+                               self.session.openWithCallback(self.finished_cb, MessageBox, _("Nothing to scan!\nPlease setup your tuner settings before you start a service scan."), MessageBox.TYPE_ERROR)
+                       else:
+                               self.session.open(MessageBox, _("Nothing to scan!\nPlease setup your tuner settings before you start a service scan."), MessageBox.TYPE_ERROR)
 
        def keyCancel(self):
                for x in self["config"].list:
@@ -781,6 +789,7 @@ class ScanSimple(ConfigListScreen, Screen, CableTransponderSearchSupport):
 
                known_networks = [ ]
                nims_to_scan = [ ]
+               self.finished_cb = None
 
                for nim in nimmanager.nim_slots:
                        # collect networks provided by this tuner
@@ -819,7 +828,8 @@ class ScanSimple(ConfigListScreen, Screen, CableTransponderSearchSupport):
                self["header"] = Label(_("Automatic Scan"))
                self["footer"] = Label(_("Press OK to scan"))
 
-       def run(self):
+       def runAsync(self, finished_cb):
+               self.finished_cb = finished_cb
                self.keyGo()
 
        def keyGo(self):
@@ -829,7 +839,6 @@ class ScanSimple(ConfigListScreen, Screen, CableTransponderSearchSupport):
                self.buildTransponderList()
 
        def buildTransponderList(self): # this method is called multiple times because of asynchronous stuff
-               print "buildTransponderList"
                APPEND_NOW = 0
                SEARCH_CABLE_TRANSPONDERS = 1
                action = APPEND_NOW
@@ -886,9 +895,15 @@ class ScanSimple(ConfigListScreen, Screen, CableTransponderSearchSupport):
 
        def startScan(self, scanList):
                if len(scanList):
-                       self.session.open(ServiceScan, scanList = scanList)
+                       if self.finished_cb:
+                               self.session.openWithCallback(self.finished_cb, ServiceScan, scanList = scanList)
+                       else:
+                               self.session.open(ServiceScan, scanList = scanList)
                else:
-                       self.session.open(MessageBox, _("Nothing to scan!\nPlease setup your tuner settings before you start a service scan."), MessageBox.TYPE_ERROR)
+                       if self.finished_cb:
+                               self.session.openWithCallback(self.finished_cb, MessageBox, _("Nothing to scan!\nPlease setup your tuner settings before you start a service scan."), MessageBox.TYPE_ERROR)
+                       else:
+                               self.session.open(MessageBox, _("Nothing to scan!\nPlease setup your tuner settings before you start a service scan."), MessageBox.TYPE_ERROR)
 
        def setCableTransponderSearchResult(self, tlist):
                self.scanList.append({"transponders": tlist, "feid": self.feid, "flags": self.flags})