diff options
| author | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2007-06-06 22:30:18 +0000 |
|---|---|---|
| committer | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2007-06-06 22:30:18 +0000 |
| commit | 83fa9db5a2a4acb79d71f9a662f086d2931c63ae (patch) | |
| tree | 3486b3073852bbd9a5952d7ccbfc4178bc24eb71 /lib/python | |
| parent | 70608ea260f899f0c072b294f7f231ae072f7d6c (diff) | |
| download | enigma2-83fa9db5a2a4acb79d71f9a662f086d2931c63ae.tar.gz enigma2-83fa9db5a2a4acb79d71f9a662f086d2931c63ae.zip | |
add runAsync support to wizzard
change run to runAsync in ScanSimple and ScanSetup (now the new cable
transponder scan is working out of startwizzard too)
Diffstat (limited to 'lib/python')
| -rw-r--r-- | lib/python/Screens/ScanSetup.py | 28 | ||||
| -rw-r--r-- | lib/python/Screens/Wizard.py | 40 |
2 files changed, 49 insertions, 19 deletions
diff --git a/lib/python/Screens/ScanSetup.py b/lib/python/Screens/ScanSetup.py index 9980df53..32e19f55 100644 --- a/lib/python/Screens/ScanSetup.py +++ b/lib/python/Screens/ScanSetup.py @@ -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): @@ -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): @@ -886,9 +896,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}) diff --git a/lib/python/Screens/Wizard.py b/lib/python/Screens/Wizard.py index 8c4f8867..29bb6e2d 100644 --- a/lib/python/Screens/Wizard.py +++ b/lib/python/Screens/Wizard.py @@ -152,19 +152,14 @@ class Wizard(Screen, HelpableScreen): 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] @@ -179,9 +174,28 @@ class Wizard(Screen, HelpableScreen): 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) |
