diff options
| author | Stefan Pluecken <stefan.pluecken@multimedia-labs.de> | 2009-09-03 16:25:07 +0200 |
|---|---|---|
| committer | Stefan Pluecken <stefan.pluecken@multimedia-labs.de> | 2009-09-03 16:25:07 +0200 |
| commit | a053f35db7edbd467bf01b9054d90dad3ce12803 (patch) | |
| tree | 78ddec3a03a3fee8705660c8984c35651c81da39 /lib/python | |
| parent | 9ec0803d291b661b38b2ebf94810133826be6a79 (diff) | |
| download | enigma2-a053f35db7edbd467bf01b9054d90dad3ce12803.tar.gz enigma2-a053f35db7edbd467bf01b9054d90dad3ce12803.zip | |
allow skipping of end screens in wizards
just add
<condition>
self.condition = self.isLastWizard
</condition>
to the last screen in your wizard
furthermore you need to update the <step>-tag of your last step according to the following example:
<step id="end" laststep="true">
...
</step>
Diffstat (limited to 'lib/python')
| -rwxr-xr-x | lib/python/Screens/Wizard.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/python/Screens/Wizard.py b/lib/python/Screens/Wizard.py index 6833c525..74219eb1 100755 --- a/lib/python/Screens/Wizard.py +++ b/lib/python/Screens/Wizard.py @@ -85,6 +85,8 @@ class Wizard(Screen): else: timeoutstep = '' self.wizard[self.lastStep] = {"id": id, "condition": "", "text": "", "timeout": timeout, "timeoutaction": timeoutaction, "timeoutstep": timeoutstep, "list": [], "config": {"screen": None, "args": None, "type": "" }, "code": "", "codeafter": "", "code_async": "", "codeafter_async": "", "nextstep": nextstep} + if attrs.has_key('laststep'): + self.wizard[self.lastStep]["laststep"] = str(attrs.get('laststep')) elif (name == "text"): self.wizard[self.lastStep]["text"] = str(attrs.get('value')).replace("\\n", "\n") elif (name == "displaytext"): @@ -163,6 +165,8 @@ class Wizard(Screen): def __init__(self, session, showSteps = True, showStepSlider = True, showList = True, showConfig = True): Screen.__init__(self, session) + + self.isLastWizard = False # can be used to skip a "goodbye"-screen in a wizard self.stepHistory = [] @@ -480,8 +484,14 @@ class Wizard(Screen): self.condition = True exec (self.wizard[self.currStep]["condition"]) if not self.condition: - self.currStep += 1 - self.updateValues() + print "keys*******************:", self.wizard[self.currStep].keys() + if self.wizard[self.currStep].has_key("laststep"): # exit wizard, if condition of laststep doesn't hold + self.markDone() + self.close() + return + else: + self.currStep += 1 + self.updateValues() else: if self.wizard[self.currStep].has_key("displaytext"): displaytext = self.wizard[self.currStep]["displaytext"] @@ -613,6 +623,10 @@ class WizardManager: def getWizards(self): # x[1] is precondition + for wizard in self.wizards: + wizard[0].isLastWizard = False + if len(self.wizards) > 0: + self.wizards[-1][0].isLastWizard = True return [(x[2], x[0]) for x in self.wizards if x[1] == 1] wizardManager = WizardManager() |
