Restore html_theme = 'default' in docs/conf.py
[snf-image-creator] / image_creator / dialog_wizard.py
index 9fa2438..31aa4a2 100644 (file)
@@ -33,7 +33,6 @@
 # interpreted as representing official policies, either expressed
 # or implied, of GRNET S.A.
 
-import dialog
 import time
 import StringIO
 
@@ -77,12 +76,12 @@ class Wizard:
                 msg = "All necessary information has been gathered:\n\n"
                 for page in self.pages:
                     msg += " * %s\n" % page.info
-                msg += "\nConfirm and Proceed."
+                msg += "\nContinue with the image creation process?"
 
                 ret = self.d.yesno(
-                    msg, width=PAGE_WIDTH, height=12, ok_label="Yes",
-                    cancel="Back", extra_button=1, extra_label="Quit",
-                    title="Confirmation")
+                    msg, width=PAGE_WIDTH, height=8 + len(self.pages),
+                    ok_label="Yes", cancel="Back", extra_button=1,
+                    extra_label="Quit", title="Confirmation")
 
                 if ret == self.d.DIALOG_CANCEL:
                     idx -= 1
@@ -100,16 +99,10 @@ class WizardPage(object):
     PREV = -1
 
     def __init__(self, **kargs):
-        if 'validate' in kargs:
-            validate = kargs['validate']
-        else:
-            validate = lambda x: x
+        validate = kargs['validate'] if 'validate' in kargs else lambda x: x
         setattr(self, "validate", validate)
 
-        if 'display' in kargs:
-            display = kargs['display']
-        else:
-            display = lambda x: x
+        display = kargs['display'] if 'display' in kargs else lambda x: x
         setattr(self, "display", display)
 
     def run(self, session, index, total):
@@ -181,7 +174,6 @@ class WizardInputPage(WizardPage):
 
 
 def wizard(session):
-
     init_token = Kamaki.get_token()
     if init_token is None:
         init_token = ""
@@ -204,14 +196,15 @@ def wizard(session):
         title="Registration Type", default="Private")
 
     def validate_account(token):
+        d = session['dialog']
+
         if len(token) == 0:
             d.msgbox("The token cannot be empty", width=PAGE_WIDTH)
             raise WizardInvalidData
 
         account = Kamaki.get_account(token)
         if account is None:
-            session['dialog'].msgbox("The token you provided in not valid!",
-                                     width=PAGE_WIDTH)
+            d.msgbox("The token you provided in not valid!", width=PAGE_WIDTH)
             raise WizardInvalidData
 
         return account