Imported Upstream version 3.2.2
[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>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
15 #set $win = 'self._%s_chooser'%$id
16 $win = forms.$(type)(
17         parent=$(parent).GetWin(),
18         value=self.$id,
19         callback=self.set_$(id),
20         #if $label()
21         label=$label,
22         #else
23         label='$id',
24         #end if
25         choices=$choices,
26         labels=$labels,
27 #if $type() == 'radio_buttons'
28         style=$style,
29 #end if
30 )
31 #if not $grid_pos()
32 $(parent).Add($win)
33 #else
34 $(parent).GridAdd($win, $(', '.join(map(str, $grid_pos()))))
35 #end if</make>
36         <callback>self.set_$(id)($value)</callback>
37         <callback>self._$(id)_chooser.set_value($id)</callback>
38         <param>
39                 <name>Label</name>
40                 <key>label</key>
41                 <value></value>
42                 <type>string</type>
43                 <hide>#if $label() then 'none' else 'part'#</hide>
44         </param>
45         <param>
46                 <name>Default Value</name>
47                 <key>value</key>
48                 <value>1</value>
49                 <type>raw</type>
50         </param>
51         <param>
52                 <name>Choices</name>
53                 <key>choices</key>
54                 <value>[1, 2, 3]</value>
55                 <type>raw</type>
56         </param>
57         <param>
58                 <name>Labels</name>
59                 <key>labels</key>
60                 <value>[]</value>
61                 <type>raw</type>
62         </param>
63         <param>
64                 <name>Type</name>
65                 <key>type</key>
66                 <value>drop_down</value>
67                 <type>enum</type>
68                 <option>
69                         <name>Drop Down</name>
70                         <key>drop_down</key>
71                 </option>
72                 <option>
73                         <name>Radio Buttons</name>
74                         <key>radio_buttons</key>
75                 </option>
76                 <option>
77                         <name>Button</name>
78                         <key>button</key>
79                 </option>
80         </param>
81         <param>
82                 <name>Style</name>
83                 <key>style</key>
84                 <value>wx.RA_HORIZONTAL</value>
85                 <type>enum</type>
86                 <hide>#if $type() == 'radio_buttons' then 'part' else 'all'#</hide>
87                 <option>
88                         <name>Horizontal</name>
89                         <key>wx.RA_HORIZONTAL</key>
90                 </option>
91                 <option>
92                         <name>Vertical</name>
93                         <key>wx.RA_VERTICAL</key>
94                 </option>
95         </param>
96         <param>
97                 <name>Grid Position</name>
98                 <key>grid_pos</key>
99                 <value></value>
100                 <type>grid_pos</type>
101         </param>
102         <param>
103                 <name>Notebook</name>
104                 <key>notebook</key>
105                 <value></value>
106                 <type>notebook</type>
107         </param>
108         <check>$value in $choices</check>
109         <check>not $labels or len($labels) == len($choices)</check>
110         <doc>
111 This block creates a variable with a drop down, radio buttons, or a button. \
112 Leave the label blank to use the variable id as the label. \
113 The value index is the index of a particular choice, \
114 which defines the default choice when the flow graph starts. \
115 The choices must be a list of possible values. \
116 Leave labels empty to use the choices as the labels.
117
118 Use the Grid Position (row, column, row span, column span) to position the graphical element in the window.
119
120 Use the Notebook Param (notebook-id, page-index) to place the graphical element inside of a notebook page.
121         </doc>
122 </block>