def __init__(self, session):
Screen.__init__(self, session)
+ self.finished_cb = None
self.updateSatList()
self.service = session.nav.getCurrentService()
self.feinfo = None
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):
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:
known_networks = [ ]
nims_to_scan = [ ]
+ self.finished_cb = None
for nim in nimmanager.nim_slots:
# collect networks provided by this tuner
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):
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})
return count
count += 1
return 0
-
- def ok(self):
- print "OK"
+
+ def finished(self, **args):
+ print "finished"
currStep = self.currStep
-
- if self.showConfig:
- if (self.wizard[currStep]["config"]["screen"] != None):
- # TODO: don't die, if no run() is available
- # there was a try/except here, but i can't see a reason
- # for this. If there is one, please do a more specific check
- # and/or a comment in which situation there is no run()
- self.configInstance.run()
-
+
+ if self.updateValues not in self.onShown:
+ self.onShown.append(self.updateValues)
+
if self.showList:
if (len(self.wizard[currStep]["list"]) > 0):
nextStep = self.wizard[currStep]["list"][self["list"].l.getCurrentSelectionIndex()][1]
self.currStep = self.getStepWithID(self.wizard[currStep]["nextstep"])
self.currStep += 1
self.updateValues()
-
+
print "Now: " + str(self.currStep)
+
+ def ok(self):
+ print "OK"
+ currStep = self.currStep
+
+ if self.showConfig:
+ if (self.wizard[currStep]["config"]["screen"] != None):
+ # TODO: don't die, if no run() is available
+ # there was a try/except here, but i can't see a reason
+ # for this. If there is one, please do a more specific check
+ # and/or a comment in which situation there is no run()
+ if callable(getattr(self.configInstance, "runAsync", None)):
+ self.onShown.remove(self.updateValues)
+ self.configInstance.runAsync(self.finished)
+ return
+ else:
+ self.configInstance.run()
+ self.finished()
+
def keyNumberGlobal(self, number):
if (self.wizard[self.currStep]["config"]["screen"] != None):
self.configInstance.keyNumberGlobal(number)