3 # Copyright 2012 GRNET S.A. All rights reserved.
5 # Redistribution and use in source and binary forms, with or
6 # without modification, are permitted provided that the following
9 # 1. Redistributions of source code must retain the above
10 # copyright notice, this list of conditions and the following
13 # 2. Redistributions in binary form must reproduce the above
14 # copyright notice, this list of conditions and the following
15 # disclaimer in the documentation and/or other materials
16 # provided with the distribution.
18 # THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
19 # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
22 # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
25 # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26 # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 # POSSIBILITY OF SUCH DAMAGE.
31 # The views and conclusions contained in the software and
32 # documentation are those of the authors and should not be
33 # interpreted as representing official policies, either expressed
34 # or implied, of GRNET S.A.
42 def __init__(self, session, title):
43 self.session = session
47 raise NotImplementedError
50 class ImageName(WizardPage):
52 d = self.session['dialog']
53 w = self.session['wizard']
55 init = w['ImageName'] if 'ImageName' in w else ""
57 (code, answer) = d.inputbox("Please provide a name for the image:",
58 init=init, width=INPUTBOX_WIDTH,
59 ok_label="Next", cancel="Back",
62 if code in (d.DIALOG_CANCEL, d.DIALOG_ESC):
67 d.msgbox("Image name cannot be empty", width=MSGBOX_WIDTH)
75 class ImageDescription(WizardPage):
77 d = self.session['dialog']
78 w = self.session['wizard']
80 init = w['ImageDescription'] if 'ImageDescription' in w else ""
83 (code, answer) = d.inputbox(
84 "Please provide a description for the image:",
85 init=init, width=INPUTBOX_WIDTH,
86 ok_label="Next", cancel="Back",
89 if code in (d.DIALOG_CANCEL, d.DIALOG_ESC):
93 if len(filename) == 0:
94 # Description is allowed to be empty
95 del w['ImageDescription']
97 w['ImageDescription'] = name
104 session['wizard'] = {}
107 steps.append(ImageName(session, "(1/5) Image Name"))
108 steps.append(ImageDescription(session, "(2/5) Image Description"))
113 # vim: set sta sts=4 shiftwidth=4 sw=4 et ai :