]> Creatis software - bbtk.git/blob - packages/toolsbbtk/bbs/appli/GUICreateBlackBox.bbs
Feature #1774
[bbtk.git] / packages / toolsbbtk / bbs / appli / GUICreateBlackBox.bbs
1 # ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4 #                        pour la SantÈ)
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
8 #
9 #  This software is governed by the CeCILL-B license under French law and
10 #  abiding by the rules of distribution of free software. You can  use,
11 #  modify and/ or redistribute the software under the terms of the CeCILL-B
12 #  license as circulated by CEA, CNRS and INRIA at the following URL
13 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 #  or in the file LICENSE.txt.
15 #
16 #  As a counterpart to the access to the source code and  rights to copy,
17 #  modify and redistribute granted by the license, users are provided only
18 #  with a limited warranty  and the software's author,  the holder of the
19 #  economic rights,  and the successive licensors  have only  limited
20 #  liability.
21 #
22 #  The fact that you are presently reading this means that you have had
23 #  knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
25
26
27 description "Creates the XML or C++ code for a new black box (interface for bbCreateBlackBox)"
28 author "eduardo.davila@creatis.insa-lyon.fr"
29 category "toolsbbtk"
30
31 load std 
32 load wx
33
34 new OutputText windowTitle
35   set windowTitle.In "Create new black box in folder :"
36
37 new DirectorySelector dir
38     set dir.Message "Select the location of your new black box"
39
40 new InputText nameBlackbox
41     set nameBlackbox.Title "Black box name         (1 word)"
42     set nameBlackbox.In "BLACKBOX_NAME"
43
44 new InputText namePackage
45     set namePackage.Title "Package name         (1 word)"
46     set namePackage.In "PACKAGE_NAME"
47
48
49 new InputText author
50     set author.Title "Author(s)           (caracters   '<',  '>' not accepted...)"
51     set author.In "_author_"
52
53 new InputText description
54     set description.Title "Description    (caracters   '<',  '>' not accepted...)"
55     set description.In "_description_"
56
57 #---------------------------------------------------------------------
58
59
60 new RadioButton typeBlackbox
61   set typeBlackbox.Title "Type of the black box :"
62   set typeBlackbox.In0 "Basic  (inherits AtomicBlackBox, no particular Input/Output)"
63   set typeBlackbox.In1 "Widget (inherits WxBlackBox, has output 'Widget' of type 'wxWindow*')"
64   set typeBlackbox.In2 "VTK PolyDataAlgorithm (inherits AtomicBlackBox and a vtkPolyDataAlgorithm, has standard vtk I/O)"
65   set typeBlackbox.In3 "VTK ImageAlgorithm    (inherits AtomicBlackBox and a vtkImageAlgorithm, has standard vtk I/O)"
66
67
68 new StringSelect stringselectorType
69   set stringselectorType.In0 "std"
70   set stringselectorType.In1 "widget"
71   set stringselectorType.In2 "VTK_PolyDataAlgorithm"
72   set stringselectorType.In3 "VTK_ImageAlgorithm"
73   connect  typeBlackbox.Out stringselectorType.In
74
75 #---------------------------------------------------------------------
76
77 new RadioButton formatBlackbox
78   set formatBlackbox.Title "Format of the output file :"
79   set formatBlackbox.In 0
80   set formatBlackbox.In0 "C++"
81   set formatBlackbox.In1 "XML"
82
83 new StringSelect stringselectorFormat
84   set stringselectorFormat.In0 "C++"
85   set stringselectorFormat.In1 "XML"
86   connect  formatBlackbox.Out stringselectorFormat.In
87
88 #---------------------------------------------------------------------
89
90 new OutputText dirOutput
91   connect dir.Out dirOutput.In
92
93 new LayoutLine layoutTop
94   connect windowTitle.Widget layoutTop.Widget1
95   connect dirOutput.Widget layoutTop.Widget2
96   connect nameBlackbox.Widget layoutTop.Widget3
97   connect namePackage.Widget layoutTop.Widget4
98   connect author.Widget layoutTop.Widget5
99   connect description.Widget layoutTop.Widget6
100
101 new LayoutSplit layoutTypeFormat
102   connect typeBlackbox.Widget layoutTypeFormat.Widget1
103   connect formatBlackbox.Widget layoutTypeFormat.Widget2
104   set layoutTypeFormat.Proportion 60
105
106 new CommandButton createButton
107     set createButton.In "print $concatStr.Out$; exec command; exec Box02;"
108     set createButton.Label "Run"
109
110 new LayoutLine layoutButtons
111     set layoutButtons.Orientation Horizontal
112 #    connect cancelButton.Widget buttons.Widget1
113     connect createButton.Widget layoutButtons.Widget2
114
115 new LayoutSplit layoutBot
116     connect layoutTypeFormat.Widget layoutBot.Widget1
117     connect layoutButtons.Widget layoutBot.Widget2
118     set layoutBot.Proportion 70
119
120 new LayoutSplit main
121     connect layoutTop.Widget main.Widget1
122     connect layoutBot.Widget main.Widget2
123     set main.Proportion 50
124     set main.WinTitle "Create new black box"
125 #    set main.WinDialog true
126     set main.WinWidth 700 
127     set main.WinHeight 600 
128
129 #---------------------------------------------------------------------
130
131
132 #-----------------------------------------------------------------------------
133 new Configuration conf
134 # on windows : enclose paths between double quotes 
135 # if system==0 (Linux) dquote=space (ascci code 32)
136 # if system==1 (Win) dquote==" (ascii code 34)
137 new StringSelect onsystem
138 set onsystem.In0 "32"
139 set onsystem.In1 "34"
140 new ASCII dquote
141 connect conf.SystemType onsystem.In
142 connect onsystem.Out dquote.In
143 #set dquote.In 34
144
145 # directory
146 new ConcatStrings dirStr
147  set dirStr.In1 " "
148  connect dquote.Out dirStr.In2
149  connect dir.Out dirStr.In3
150  connect dquote.Out dirStr.In4
151  set dirStr.In5 " "
152
153 # package name
154 new ConcatStrings packageNameStr
155  set packageNameStr.In1 "  "
156  connect namePackage.Out packageNameStr.In2
157  set packageNameStr.In3 " "
158
159 # black box name
160 new ConcatStrings blackboxNameStr
161  set blackboxNameStr.In1 "  "
162  connect nameBlackbox.Out blackboxNameStr.In2
163  set blackboxNameStr.In3 " "
164
165 # type of black box
166 new ConcatStrings typeStr
167  set typeStr.In1 "  "
168  connect stringselectorType.Out typeStr.In2
169  set typeStr.In3 " "
170
171 # format of output 
172 new ConcatStrings formatStr
173  set formatStr.In1 "  "
174  connect stringselectorFormat.Out formatStr.In2
175  set formatStr.In3 " "
176
177 # author
178 new ConcatStrings authorStr
179  set authorStr.In1 " '"
180  connect author.Out authorStr.In2
181  set authorStr.In3 "' "
182
183 # description
184 new ConcatStrings descriptionStr
185  set descriptionStr.In1 " '"
186  connect description.Out descriptionStr.In2
187  set descriptionStr.In3 "' "
188
189 # Command string creation
190 new ConcatStrings concatStrCommand
191     set concatStrCommand.In1 " "
192 #EED-20-02-2012    connect dquote.Out                   concatStrCommand.In2
193 #EED-20-02-2012    connect conf.BinPath         concatStrCommand.In3
194 #EED-20-02-2012    connect conf.FileSeparator   concatStrCommand.In4
195     set         concatStrCommand.In5  "bbCreateBlackBox"
196 #EED-20-02-2012    connect dquote.Out                   concatStrCommand.In6
197     set         concatStrCommand.In7  " "
198
199 # Params string creation
200 new ConcatStrings concatStrParam
201     connect dirStr.Out                  concatStrParam.In1
202     connect packageNameStr.Out  concatStrParam.In2
203     connect blackboxNameStr.Out concatStrParam.In3
204     connect typeStr.Out                 concatStrParam.In4
205     connect formatStr.Out               concatStrParam.In5
206     connect authorStr.Out               concatStrParam.In6
207     connect descriptionStr.Out  concatStrParam.In7
208     
209 # Command + parameters string creation
210 new ConcatStrings concatStr
211 #EED-20-02-2012    connect dquote.Out                           concatStr.In1
212     connect concatStrCommand.Out        concatStr.In2
213     connect concatStrParam.Out          concatStr.In3
214 #EED-20-02-2012    connect dquote.Out                           concatStr.In4
215
216 # Box which executes the command
217 new ExecSystemCommand command
218     connect concatStr.Out command.In
219
220 ## ------------------------------------------------
221 new OutputText Box01
222    set Box01.In "            OK... Box created..."
223    set Box01.WinDialog true
224    set Box01.WinHeight 100
225    set Box01.WinTitle Confirmation
226    set Box01.WinWidth 400
227  
228 new LayoutLine Box02
229    set Box02.WinDialog true
230    set Box02.WinHeight 200
231    set Box02.WinTitle Confirmation
232    set Box02.WinWidth 400
233    connect Box01.Widget Box02.Widget2
234  
235  new OutputText Box03
236    connect Box03.Widget Box02.Widget1
237
238 exec dir
239 exec main
240