[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 wizard import Step, PreviousStep, EndScenario, TryAgain
|
||||||
from itertools import izip
|
from itertools import izip
|
||||||
import dialog, time
|
import dialog, time, sys, commands
|
||||||
|
|
||||||
def really_quit(dico):
|
def really_quit(dico):
|
||||||
raise EndScenario("game over!", data = dico)
|
raise EndScenario("game over!", data = dico)
|
||||||
|
|
||||||
def error_handler(exc):
|
def error_handler(exc):
|
||||||
dialog.Dialog().msgbox('Erreur:', exc.__repr__())
|
sexc = (str(exc))
|
||||||
|
dialog.Dialog().msgbox(sexc, title = 'Erreur :')
|
||||||
raise TryAgain()
|
raise TryAgain()
|
||||||
|
|
||||||
class DialogStepGenerator():
|
class DialogStepGenerator:
|
||||||
u"""This class defines a step, that will prompt the user for various
|
u"""This class defines a step, that will prompt the user for various
|
||||||
fields."""
|
fields."""
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ class Step:
|
||||||
class Scenario:
|
class Scenario:
|
||||||
u"""This class allows us to define scenarios."""
|
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
|
u"""empty scenario, with an error handler (that takes an exception as
|
||||||
argument)"""
|
argument)"""
|
||||||
self.steps = None
|
self.steps = None
|
||||||
|
@ -162,7 +162,18 @@ class Running:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
self.handle(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:
|
else:
|
||||||
# Should not be called
|
# Should not be called
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue