Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
snf-image-creator
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
itminedu
snf-image-creator
Commits
aeb95900
Commit
aeb95900
authored
12 years ago
by
Nikos Skalkotos
Browse files
Options
Downloads
Patches
Plain Diff
Implement a WizardExit exception in dialog_wizard
This exception can be used by the WizardPage instances to exit the wizard.
parent
1d413d1e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
image_creator/dialog_wizard.py
+9
-3
9 additions, 3 deletions
image_creator/dialog_wizard.py
with
9 additions
and
3 deletions
image_creator/dialog_wizard.py
+
9
−
3
View file @
aeb95900
...
...
@@ -44,6 +44,10 @@ from image_creator.output.cli import OutputWthProgress
PAGE_WIDTH
=
70
class
WizardExit
(
Exception
):
pass
class
Wizard
:
def
__init__
(
self
,
session
):
self
.
session
=
session
...
...
@@ -56,7 +60,10 @@ class Wizard:
def
run
(
self
):
idx
=
0
while
True
:
idx
+=
self
.
pages
[
idx
].
run
(
self
.
session
,
idx
,
len
(
self
.
pages
))
try
:
idx
+=
self
.
pages
[
idx
].
run
(
self
.
session
,
idx
,
len
(
self
.
pages
))
except
WizardExit
:
return
False
if
idx
>=
len
(
self
.
pages
):
break
...
...
@@ -69,7 +76,6 @@ class Wizard:
class
WizardPage
:
NEXT
=
1
PREV
=
-
1
EXIT
=
-
255
def
run
(
self
,
session
,
index
,
total
):
raise
NotImplementedError
...
...
@@ -124,7 +130,7 @@ class WizardYesNoPage(WizardPage):
if
ret
==
d
.
DIALOG_CANCEL
:
return
self
.
PREV
elif
ret
==
d
.
DIALOG_EXTRA
:
r
eturn
self
.
EXIT
r
aise
WizardExit
elif
ret
==
d
.
DIALOG_OK
:
return
self
.
NEXT
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment