1 from enigma import eComponentScan
11 0: "error starting scanning",
12 1: "error while scanning",
13 2: "no resource manager",
17 def scanStatusChanged(self):
18 if self.state == self.Running:
19 self.progressbar.setValue(self.scan.getProgress())
20 if self.scan.isDone():
21 errcode = self.scan.getError()
24 self.state = self.Done
26 self.state = self.Error
27 self.errorcode = errcode
29 self.text.setText("scan in progress - %d %% done!\n%d services found!" % (self.scan.getProgress(), self.scan.getNumServices()))
31 if self.state == self.Done:
32 self.text.setText("scan done!")
34 if self.state == self.Error:
35 self.text.setText("ERROR - failed to scan (%s)!" % (self.Errors[self.errorcode]) )
37 def __init__(self, progressbar, text):
38 self.progressbar = progressbar
40 self.scan = eComponentScan()
41 self.state = self.Idle
42 self.scanStatusChanged()
45 self.scan.statusChanged.get().append(self.scanStatusChanged)
46 self.state = self.Running
47 err = self.scan.start()
49 self.state = self.Error
52 self.scanStatusChanged()
55 self.scan.statusChanged.get().remove(self.scanStatusChanged)
57 print "*** warning *** scan was not finished!"
60 print "state is %d " % (self.state)
61 return self.state == self.Done or self.state == self.Error