16 |
# write to the Free Software Foundation, Inc., 59 Temple Place |
# write to the Free Software Foundation, Inc., 59 Temple Place |
17 |
# - Suite 330, Boston, MA 02111-1307, USA. |
# - Suite 330, Boston, MA 02111-1307, USA. |
18 |
# |
# |
19 |
# Copyright 2001-2002 Free Software Foundation |
# Copyright 2001-2003 Free Software Foundation |
20 |
# |
# |
21 |
# FILE: |
# FILE: |
22 |
# forms/wizards/AddBlock.py |
# forms/wizards/AddBlock.py |
36 |
|
|
37 |
class AddBlockWizard(FormTemplate): |
class AddBlockWizard(FormTemplate): |
38 |
|
|
39 |
|
# The first step in our wizard. |
40 |
|
# The template parser will initially |
41 |
|
# call GetStep(FIRST_STEP). |
42 |
|
FIRST_STEP = '0' |
43 |
|
|
44 |
|
|
45 |
############### |
############### |
46 |
# |
# |
50 |
self.form = root |
self.form = root |
51 |
self.current = current |
self.current = current |
52 |
|
|
53 |
|
############### |
54 |
|
# |
55 |
|
# Return the markup for a specific page |
56 |
|
# |
57 |
|
def GetStep(self, step): |
58 |
|
print step |
59 |
|
# |
60 |
|
# Step #0 / Get Name |
61 |
|
# |
62 |
|
if step == '0': |
63 |
|
|
64 |
|
content = [WizardText('This will insert a new block.'), |
65 |
|
WizardInput('name',label='Object Name:',required=1,size=20)] |
66 |
|
|
67 |
|
return { 'title': 'Add Block', |
68 |
|
'content': content, |
69 |
|
'prev': None, |
70 |
|
'next': None } |
71 |
|
|
72 |
############### |
############### |
73 |
# |
# |
75 |
# |
# |
76 |
def Finalize(self): |
def Finalize(self): |
77 |
|
|
78 |
|
attrs = {'name': self.GetUniqueName(self.variables['name'] or 'Block1')} |
79 |
# Find or create parent block... |
# Find form... |
80 |
page = self.current.findParentOfType('GFPage') |
logic = self.current['logic'] |
81 |
block = self.AddElement('block', page) |
block = self.AddElement('block', logic, attrs) |
82 |
|
|
83 |
return 1 |
return 1 |
84 |
|
|
95 |
'Description' : 'Inserts a Block', |
'Description' : 'Inserts a Block', |
96 |
'Version' : VERSION, |
'Version' : VERSION, |
97 |
'Author' : 'The GNUe Designer Team', |
'Author' : 'The GNUe Designer Team', |
98 |
'Behavior': TEMPLATE, |
'Behavior': WIZARD, |
99 |
'Location' : 'Tools|Insert|Block' |
'Location' : 'Edit|Insert|Block' |
100 |
} |
} |
101 |
|
|