[lib/dialogwizard] typo
darcs-hash:20090929134214-bd074-b24076612b84473fe9acaa70d26fc649399e0015.gz
This commit is contained in:
parent
eac68563c9
commit
51ca5f4d5f
2 changed files with 17 additions and 5 deletions
|
@ -8,16 +8,17 @@
|
|||
|
||||
from wizard import Step, PreviousStep, EndScenario, TryAgain
|
||||
from itertools import izip
|
||||
import dialog, time
|
||||
import dialog, time, sys, commands
|
||||
|
||||
def really_quit(dico):
|
||||
raise EndScenario("game over!", data = dico)
|
||||
|
||||
def error_handler(exc):
|
||||
dialog.Dialog().msgbox('Erreur:', exc.__repr__())
|
||||
sexc = (str(exc))
|
||||
dialog.Dialog().msgbox(sexc, title = 'Erreur :')
|
||||
raise TryAgain()
|
||||
|
||||
class DialogStepGenerator():
|
||||
class DialogStepGenerator:
|
||||
u"""This class defines a step, that will prompt the user for various
|
||||
fields."""
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ class Step:
|
|||
class Scenario:
|
||||
u"""This class allows us to define scenarios."""
|
||||
|
||||
def __init__(self)
|
||||
def __init__(self):
|
||||
u"""empty scenario, with an error handler (that takes an exception as
|
||||
argument)"""
|
||||
self.steps = None
|
||||
|
@ -162,8 +162,19 @@ class Running:
|
|||
pass
|
||||
|
||||
except Exception, e:
|
||||
try:
|
||||
self.handle(e)
|
||||
|
||||
except PreviousStep:
|
||||
if self.stack:
|
||||
self.env, self.defaults, self.steps, self.stack = self.stack
|
||||
else:
|
||||
raise EndScenario("No previous step", self.env)
|
||||
|
||||
except TryAgain:
|
||||
# We can update defaults
|
||||
pass
|
||||
|
||||
else:
|
||||
# Should not be called
|
||||
raise "invalid step"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue