]> Creatis software - bbtk.git/blob - packages/toolsbbtk/bbs/appli/GUICreateBlackBox.bbs
65d3e9c40b42105ebc76371b49e5af4f80744a2b
[bbtk.git] / packages / toolsbbtk / bbs / appli / GUICreateBlackBox.bbs
1 description "Creates the XML or C++ code for a new black box (interface for bbCreateBlackBox)"
2 author "eduardo.davila@creatis.insa-lyon.fr"
3 category "toolsbbtk"
4
5 load std 
6 load wx
7
8 new OutputText windowTitle
9   set windowTitle.In "Create new black box in folder :"
10
11 new DirectorySelector dir
12     set dir.Message "Select the location of your new black box"
13
14 new InputText nameBlackbox
15     set nameBlackbox.Title "Black box name         (1 word)"
16     set nameBlackbox.In "BLACKBOX_NAME"
17
18 new InputText namePackage
19     set namePackage.Title "Package name         (1 word)"
20     set namePackage.In "PACKAGE_NAME"
21
22
23 new InputText author
24     set author.Title "Author(s)           (caracters   '<',  '>' not accepted...)"
25     set author.In "_author_"
26
27 new InputText description
28     set description.Title "Description    (caracters   '<',  '>' not accepted...)"
29     set description.In "_description_"
30
31 #---------------------------------------------------------------------
32
33
34 new RadioButton typeBlackbox
35   set typeBlackbox.Title "Type of the black box :"
36   set typeBlackbox.In0 "Basic  (inherits AtomicBlackBox, no particular Input/Output)"
37   set typeBlackbox.In1 "Widget (inherits WxBlackBox, has output 'Widget' of type 'wxWindow*')"
38   set typeBlackbox.In2 "VTK PolyDataAlgorithm (inherits AtomicBlackBox and a vtkPolyDataAlgorithm, has standard vtk I/O)"
39   set typeBlackbox.In3 "VTK ImageAlgorithm    (inherits AtomicBlackBox and a vtkImageAlgorithm, has standard vtk I/O)"
40
41
42 new StringSelect stringselectorType
43   set stringselectorType.In0 "std"
44   set stringselectorType.In1 "widget"
45   set stringselectorType.In2 "VTK_PolyDataAlgorithm"
46   set stringselectorType.In3 "VTK_ImageAlgorithm"
47   connect  typeBlackbox.Out stringselectorType.In
48
49 #---------------------------------------------------------------------
50
51 new RadioButton formatBlackbox
52   set formatBlackbox.Title "Format of the output file :"
53   set formatBlackbox.In 0
54   set formatBlackbox.In0 "C++"
55   set formatBlackbox.In1 "XML"
56
57 new StringSelect stringselectorFormat
58   set stringselectorFormat.In0 "C++"
59   set stringselectorFormat.In1 "XML"
60   connect  formatBlackbox.Out stringselectorFormat.In
61
62 #---------------------------------------------------------------------
63
64 new OutputText dirOutput
65   connect dir.Out dirOutput.In
66
67 new LayoutLine layoutTop
68   connect windowTitle.Widget layoutTop.Widget1
69   connect dirOutput.Widget layoutTop.Widget2
70   connect nameBlackbox.Widget layoutTop.Widget3
71   connect namePackage.Widget layoutTop.Widget4
72   connect author.Widget layoutTop.Widget5
73   connect description.Widget layoutTop.Widget6
74
75 new LayoutSplit layoutTypeFormat
76   connect typeBlackbox.Widget layoutTypeFormat.Widget1
77   connect formatBlackbox.Widget layoutTypeFormat.Widget2
78   set layoutTypeFormat.Proportion 60
79
80 new CommandButton createButton
81     set createButton.In "print $concatStr.Out$; exec command; exec Box02;"
82     set createButton.Label "Run"
83
84 new LayoutLine layoutButtons
85     set layoutButtons.Orientation Horizontal
86 #    connect cancelButton.Widget buttons.Widget1
87     connect createButton.Widget layoutButtons.Widget2
88
89 new LayoutSplit layoutBot
90     connect layoutTypeFormat.Widget layoutBot.Widget1
91     connect layoutButtons.Widget layoutBot.Widget2
92     set layoutBot.Proportion 70
93
94 new LayoutSplit main
95     connect layoutTop.Widget main.Widget1
96     connect layoutBot.Widget main.Widget2
97     set main.Proportion 50
98     set main.WinTitle "Create new black box"
99 #    set main.WinDialog true
100     set main.WinWidth 700 
101     set main.WinHeight 600 
102
103 #---------------------------------------------------------------------
104
105
106 #-----------------------------------------------------------------------------
107 new Configuration conf
108 # on windows : enclose paths between double quotes 
109 # if system==0 (Linux) dquote=space (ascci code 32)
110 # if system==1 (Win) dquote==" (ascii code 34)
111 new StringSelect onsystem
112 set onsystem.In0 "32"
113 set onsystem.In1 "34"
114 new ASCII dquote
115 connect conf.SystemType onsystem.In
116 connect onsystem.Out dquote.In
117 #set dquote.In 34
118
119 # directory
120 new ConcatStrings dirStr
121  set dirStr.In1 " "
122  connect dquote.Out dirStr.In2
123  connect dir.Out dirStr.In3
124  connect dquote.Out dirStr.In4
125  set dirStr.In5 " "
126
127 # package name
128 new ConcatStrings packageNameStr
129  set packageNameStr.In1 "  "
130  connect namePackage.Out packageNameStr.In2
131  set packageNameStr.In3 " "
132
133 # black box name
134 new ConcatStrings blackboxNameStr
135  set blackboxNameStr.In1 "  "
136  connect nameBlackbox.Out blackboxNameStr.In2
137  set blackboxNameStr.In3 " "
138
139 # type of black box
140 new ConcatStrings typeStr
141  set typeStr.In1 "  "
142  connect stringselectorType.Out typeStr.In2
143  set typeStr.In3 " "
144
145 # format of output 
146 new ConcatStrings formatStr
147  set formatStr.In1 "  "
148  connect stringselectorFormat.Out formatStr.In2
149  set formatStr.In3 " "
150
151 # author
152 new ConcatStrings authorStr
153  set authorStr.In1 " '"
154  connect author.Out authorStr.In2
155  set authorStr.In3 "' "
156
157 # description
158 new ConcatStrings descriptionStr
159  set descriptionStr.In1 " '"
160  connect description.Out descriptionStr.In2
161  set descriptionStr.In3 "' "
162
163 # Command string creation
164 new ConcatStrings concatStrCommand
165     set concatStrCommand.In1 " "
166 #EED-20-02-2012    connect dquote.Out                   concatStrCommand.In2
167 #EED-20-02-2012    connect conf.BinPath         concatStrCommand.In3
168 #EED-20-02-2012    connect conf.FileSeparator   concatStrCommand.In4
169     set         concatStrCommand.In5  "bbCreateBlackBox"
170 #EED-20-02-2012    connect dquote.Out                   concatStrCommand.In6
171     set         concatStrCommand.In7  " "
172
173 # Params string creation
174 new ConcatStrings concatStrParam
175     connect dirStr.Out                  concatStrParam.In1
176     connect packageNameStr.Out  concatStrParam.In2
177     connect blackboxNameStr.Out concatStrParam.In3
178     connect typeStr.Out                 concatStrParam.In4
179     connect formatStr.Out               concatStrParam.In5
180     connect authorStr.Out               concatStrParam.In6
181     connect descriptionStr.Out  concatStrParam.In7
182     
183 # Command + parameters string creation
184 new ConcatStrings concatStr
185 #EED-20-02-2012    connect dquote.Out                           concatStr.In1
186     connect concatStrCommand.Out        concatStr.In2
187     connect concatStrParam.Out          concatStr.In3
188 #EED-20-02-2012    connect dquote.Out                           concatStr.In4
189
190 # Box which executes the command
191 new ExecSystemCommand command
192     connect concatStr.Out command.In
193
194 ## ------------------------------------------------
195 new OutputText Box01
196    set Box01.In "            OK... Box created..."
197    set Box01.WinDialog true
198    set Box01.WinHeight 100
199    set Box01.WinTitle Confirmation
200    set Box01.WinWidth 400
201  
202 new LayoutLine Box02
203    set Box02.WinDialog true
204    set Box02.WinHeight 200
205    set Box02.WinTitle Confirmation
206    set Box02.WinWidth 400
207    connect Box01.Widget Box02.Widget2
208  
209  new OutputText Box03
210    connect Box03.Widget Box02.Widget1
211
212 exec dir
213 exec main
214