fix inverted setting (meaning was inverted too)
[enigma2.git] / lib / python / Components / ServiceScan.py
index d59b304..04690b5 100644 (file)
@@ -1,4 +1,4 @@
-from enigma import eComponentScan
+from enigma import eComponentScan, eDVBFrontendParametersSatellite, eDVBFrontendParametersCable, eDVBFrontendParametersTerrestrial
 
 class ServiceScan:
        
@@ -26,25 +26,39 @@ class ServiceScan:
                                        self.state = self.Error
                                        self.errorcode = errcode
                        else:
-                               self.text.setText("scan in progress - %d %% done!\n%d services found!" % (self.scan.getProgress(), self.scan.getNumServices()))
+                               self.text.setText(_("scan in progress - %d %% done!\n%d services found!") % (self.scan.getProgress(), self.scan.getNumServices()))
                
                if self.state == self.Done:
-                       self.text.setText("scan done!")
+                       if self.scan.getNumServices() == 1:
+                               self.text.setText(_("scan done!\nOne service found!"))
+                       elif self.scan.getNumServices() == 0:
+                               self.text.setText(_("scan done!\nNo service found!"))
+                       else:
+                               self.text.setText(_("scan done!\n%d services found!") % (self.scan.getNumServices()))
                
                if self.state == self.Error:
-                       self.text.setText("ERROR - failed to scan (%s)!" % (self.Errors[self.errorcode]) )
+                       self.text.setText(_("ERROR - failed to scan (%s)!") % (self.Errors[self.errorcode]) )
        
-       def __init__(self, progressbar, text):
+       def __init__(self, progressbar, text, servicelist, transponders, feid, flags):
                self.progressbar = progressbar
                self.text = text
                self.scan = eComponentScan()
                self.state = self.Idle
+               self.feid = feid
+               self.flags = flags
+               self.servicelist = servicelist
                self.scanStatusChanged()
                
+               for x in transponders:
+                       self.scan.addInitial(x)
+               
+               #self.scan.addInitial(parm)
+               
        def execBegin(self):
                self.scan.statusChanged.get().append(self.scanStatusChanged)
+               self.scan.newService.get().append(self.newService)
                self.state = self.Running
-               err = self.scan.start()
+               err = self.scan.start(self.feid, self.flags)
                if err:
                        self.state = self.Error
                        self.errorcode = 0
@@ -53,10 +67,15 @@ class ServiceScan:
        
        def execEnd(self):
                self.scan.statusChanged.get().remove(self.scanStatusChanged)
+               self.scan.newService.get().remove(self.newService)
                if not self.isDone():
                        print "*** warning *** scan was not finished!"
+               
+               del self.scan
 
        def isDone(self):
-               print "state is %d " % (self.state)
                return self.state == self.Done or self.state == self.Error
-       
+
+       def newService(self):
+               newServiceName = self.scan.getLastServiceName()
+               self.servicelist.addItem(newServiceName)