Merging r11186:11273 from grc branch.
[debian/gnuradio] / grc / blocks / variable_chooser.xml
1 <?xml version="1.0"?>
2 <!--
3 ###################################################
4 ##Variable Chooser:
5 ##      a gui form with enumerated choices
6 ##      radio buttons, drop down, or button
7 ###################################################
8  -->
9 <block>
10         <name>Variable Chooser</name>
11         <key>variable_chooser</key>
12         <import>from gnuradio.wxgui import forms</import>
13         <var_make>self.$(id) = $(id) = $value</var_make>
14         <make>self.$(id)_chooser = forms.$(type)(
15         parent=self.GetWin(),
16         value=self.$id,
17         callback=self.set_$(id),
18         #if $label()
19         label=$label,
20         #else
21         label='$id',
22         #end if
23         choices=$choices,
24         labels=$labels,
25 #if $type() == 'radio_buttons'
26         style=$style,
27 #end if
28 )
29 #set $grid_pos = $grid_pos()
30 #if not grid_pos
31 self.Add(self.$(id)_chooser)
32 #else
33 self.GridAdd(self.$(id)_chooser, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos[3])
34 #end if</make>
35         <callback>self.set_$(id)($value)</callback>
36         <callback>self.$(id)_chooser.set_value($id)</callback>
37         <param>
38                 <name>Label</name>
39                 <key>label</key>
40                 <value></value>
41                 <type>string</type>
42                 <hide>#if $label() then 'none' else 'part'#</hide>
43         </param>
44         <param>
45                 <name>Default Value</name>
46                 <key>value</key>
47                 <value>1</value>
48                 <type>raw</type>
49         </param>
50         <param>
51                 <name>Choices</name>
52                 <key>choices</key>
53                 <value>[1, 2, 3]</value>
54                 <type>raw</type>
55         </param>
56         <param>
57                 <name>Labels</name>
58                 <key>labels</key>
59                 <value>[]</value>
60                 <type>raw</type>
61         </param>
62         <param>
63                 <name>Type</name>
64                 <key>type</key>
65                 <value>drop_down</value>
66                 <type>enum</type>
67                 <option>
68                         <name>Drop Down</name>
69                         <key>drop_down</key>
70                 </option>
71                 <option>
72                         <name>Radio Buttons</name>
73                         <key>radio_buttons</key>
74                 </option>
75                 <option>
76                         <name>Button</name>
77                         <key>button</key>
78                 </option>
79         </param>
80         <param>
81                 <name>Style</name>
82                 <key>style</key>
83                 <value>wx.RA_HORIZONTAL</value>
84                 <type>enum</type>
85                 <hide>#if $type() == 'radio_buttons' then 'part' else 'all'#</hide>
86                 <option>
87                         <name>Horizontal</name>
88                         <key>wx.RA_HORIZONTAL</key>
89                 </option>
90                 <option>
91                         <name>Vertical</name>
92                         <key>wx.RA_VERTICAL</key>
93                 </option>
94         </param>
95         <param>
96                 <name>Grid Position</name>
97                 <key>grid_pos</key>
98                 <value></value>
99                 <type>grid_pos</type>
100         </param>
101         <check>$value in $choices</check>
102         <check>not $labels or len($labels) == len($choices)</check>
103         <doc>
104 This block creates a variable with a drop down, radio buttons, or a button. \
105 Leave the label blank to use the variable id as the label. \
106 The value index is the index of a particular choice, \
107 which defines the default choice when the flow graph starts. \
108 The choices must be a list of possible values. \
109 Leave labels empty to use the choices as the labels.
110
111 Use the Grid Position (row, column, row span, column span) to position the graphical element in the window.
112         </doc>
113 </block>