diff options
Diffstat (limited to 'grc/data/platforms/python/blocks')
28 files changed, 234 insertions, 125 deletions
diff --git a/grc/data/platforms/python/blocks/audio_sink.xml b/grc/data/platforms/python/blocks/audio_sink.xml index decaf2a08..75d583470 100644 --- a/grc/data/platforms/python/blocks/audio_sink.xml +++ b/grc/data/platforms/python/blocks/audio_sink.xml @@ -13,7 +13,7 @@ <name>Sample Rate</name> <key>samp_rate</key> <value>32000</value> - <type>enum</type> + <type>int</type> <option> <name>16KHz</name> <key>16000</key> @@ -44,7 +44,7 @@ <key>device_name</key> <value></value> <type>string</type> - <hide>#if $device_name.eval then 'none' else 'part'#</hide> + <hide>#if $device_name() then 'none' else 'part'#</hide> </param> <param> <name>OK to Block</name> diff --git a/grc/data/platforms/python/blocks/audio_source.xml b/grc/data/platforms/python/blocks/audio_source.xml index 21407dccd..1f5d1033e 100644 --- a/grc/data/platforms/python/blocks/audio_source.xml +++ b/grc/data/platforms/python/blocks/audio_source.xml @@ -13,7 +13,7 @@ <name>Sample Rate</name> <key>samp_rate</key> <value>32000</value> - <type>enum</type> + <type>int</type> <option> <name>16KHz</name> <key>16000</key> @@ -44,7 +44,7 @@ <key>device_name</key> <value></value> <type>string</type> - <hide>#if $device_name.eval then 'none' else 'part'#</hide> + <hide>#if $device_name() then 'none' else 'part'#</hide> </param> <param> <name>OK to Block</name> diff --git a/grc/data/platforms/python/blocks/blks2_rational_resampler_xxx.xml b/grc/data/platforms/python/blocks/blks2_rational_resampler_xxx.xml index 2f81a50e5..b92ec8ec2 100644 --- a/grc/data/platforms/python/blocks/blks2_rational_resampler_xxx.xml +++ b/grc/data/platforms/python/blocks/blks2_rational_resampler_xxx.xml @@ -12,12 +12,12 @@ <make>blks2.rational_resampler_$(type)( interpolation=$interp, decimation=$decim, -#if $taps.eval +#if $taps() taps=$taps, #else taps=None, #end if -#if $fractional_bw.eval != 0 +#if $fractional_bw() != 0 fractional_bw=$fractional_bw, #else fractional_bw=None, diff --git a/grc/data/platforms/python/blocks/gr_fft_vxx.xml b/grc/data/platforms/python/blocks/gr_fft_vxx.xml index c2c13d0ae..d398486ef 100644 --- a/grc/data/platforms/python/blocks/gr_fft_vxx.xml +++ b/grc/data/platforms/python/blocks/gr_fft_vxx.xml @@ -9,7 +9,7 @@ <key>gr_fft_vxx</key> <import>from gnuradio import gr</import> <import>from gnuradio import window</import> - <make>#if $type.eval == "complex" + <make>#if $type() == "complex" gr.fft_vcc($fft_size, $forward, $window, $shift) #else gr.fft_vfc($fft_size, $forward, $window) diff --git a/grc/data/platforms/python/blocks/gr_mute_xx.xml b/grc/data/platforms/python/blocks/gr_mute_xx.xml index 668d7c599..a9a857c6a 100644 --- a/grc/data/platforms/python/blocks/gr_mute_xx.xml +++ b/grc/data/platforms/python/blocks/gr_mute_xx.xml @@ -41,6 +41,14 @@ <key>mute</key> <value>False</value> <type>raw</type> + <option> + <name>True</name> + <key>True</key> + </option> + <option> + <name>False</name> + <key>False</key> + </option> </param> <sink> <name>in</name> diff --git a/grc/data/platforms/python/blocks/gr_noise_source_x.xml b/grc/data/platforms/python/blocks/gr_noise_source_x.xml index 664a108d3..4fcef5148 100644 --- a/grc/data/platforms/python/blocks/gr_noise_source_x.xml +++ b/grc/data/platforms/python/blocks/gr_noise_source_x.xml @@ -9,6 +9,7 @@ <key>gr_noise_source_x</key> <import>from gnuradio import gr</import> <make>gr.noise_source_$(type.fcn)($noise_type, $amp, $seed)</make> + <callback>set_type($noise_type)</callback> <callback>set_amplitude($amp)</callback> <param> <name>Output Type</name> @@ -39,7 +40,7 @@ <name>Noise Type</name> <key>noise_type</key> <value>gr.GR_GAUSSIAN</value> - <type>enum</type> + <type>raw</type> <option> <name>Uniform</name> <key>gr.GR_UNIFORM</key> diff --git a/grc/data/platforms/python/blocks/gr_sig_source_x.xml b/grc/data/platforms/python/blocks/gr_sig_source_x.xml index 53434c430..c329dba67 100644 --- a/grc/data/platforms/python/blocks/gr_sig_source_x.xml +++ b/grc/data/platforms/python/blocks/gr_sig_source_x.xml @@ -10,6 +10,7 @@ <import>from gnuradio import gr</import> <make>gr.sig_source_$(type.fcn)($samp_rate, $waveform, $freq, $amp, $offset)</make> <callback>set_sampling_freq($samp_rate)</callback> + <callback>set_waveform($waveform)</callback> <callback>set_frequency($freq)</callback> <callback>set_amplitude($amp)</callback> <callback>set_offset($offset)</callback> @@ -52,7 +53,7 @@ <name>Waveform</name> <key>waveform</key> <value>gr.GR_COS_WAVE</value> - <type>enum</type> + <type>raw</type> <option> <name>Constant</name> <key>gr.GR_CONST_WAVE</key> diff --git a/grc/data/platforms/python/blocks/gr_vector_sink_x.xml b/grc/data/platforms/python/blocks/gr_vector_sink_x.xml index d901b1d78..3bd998698 100644 --- a/grc/data/platforms/python/blocks/gr_vector_sink_x.xml +++ b/grc/data/platforms/python/blocks/gr_vector_sink_x.xml @@ -8,7 +8,7 @@ <name>Vector Sink</name> <key>gr_vector_sink_x</key> <import>from gnuradio import gr</import> - <make>gr.vector_sink_$(type.fcn)()</make> + <make>gr.vector_sink_$(type.fcn)($vlen)</make> <param> <name>Input Type</name> <key>type</key> @@ -39,8 +39,16 @@ <opt>fcn:b</opt> </option> </param> + <param> + <name>Vec Length</name> + <key>vlen</key> + <value>1</value> + <type>int</type> + </param> + <check>$vlen > 0</check> <sink> <name>in</name> <type>$type</type> + <vlen>$vlen</vlen> </sink> </block> diff --git a/grc/data/platforms/python/blocks/gr_vector_source_x.xml b/grc/data/platforms/python/blocks/gr_vector_source_x.xml index 240273e42..7a6a3aeff 100644 --- a/grc/data/platforms/python/blocks/gr_vector_source_x.xml +++ b/grc/data/platforms/python/blocks/gr_vector_source_x.xml @@ -8,7 +8,7 @@ <name>Vector Source</name> <key>gr_vector_source_x</key> <import>from gnuradio import gr</import> - <make>gr.vector_source_$(type.fcn)($vector, $repeat)</make> + <make>gr.vector_source_$(type.fcn)($vector, $repeat, $vlen)</make> <param> <name>Output Type</name> <key>type</key> @@ -64,8 +64,16 @@ <key>False</key> </option> </param> + <param> + <name>Vec Length</name> + <key>vlen</key> + <value>1</value> + <type>int</type> + </param> + <check>$vlen > 0</check> <source> <name>out</name> <type>$type</type> + <vlen>$vlen</vlen> </source> </block> diff --git a/grc/data/platforms/python/blocks/options.xml b/grc/data/platforms/python/blocks/options.xml index 11e46bbe6..07f659af9 100644 --- a/grc/data/platforms/python/blocks/options.xml +++ b/grc/data/platforms/python/blocks/options.xml @@ -10,10 +10,14 @@ <name>Options</name> <key>options</key> <import>from gnuradio import gr -#if $generate_options.eval == 'wx_gui' +#if $generate_options() == 'wx_gui' from grc_gnuradio import wxgui as grc_wxgui import wx #end if +#if $generate_options() != 'hb' +from optparse import OptionParser +from gnuradio.eng_option import eng_option +#end if </import> <make></make> <param> @@ -64,16 +68,16 @@ import wx <key>category</key> <value>Custom</value> <type>string</type> - <hide>#if $generate_options.eval == 'hb' then 'none' else 'all'#</hide> + <hide>#if $generate_options() == 'hb' then 'none' else 'all'#</hide> </param> <param> <name>Realtime Scheduling</name> <key>realtime_scheduling</key> <value></value> <type>enum</type> - <hide>#if $generate_options.eval == 'hb' + <hide>#if $generate_options() == 'hb' all#slurp -#elif $realtime_scheduling.eval +#elif $realtime_scheduling() none#slurp #else part#slurp diff --git a/grc/data/platforms/python/blocks/parameter.xml b/grc/data/platforms/python/blocks/parameter.xml index de2085011..e7bf61564 100644 --- a/grc/data/platforms/python/blocks/parameter.xml +++ b/grc/data/platforms/python/blocks/parameter.xml @@ -7,13 +7,13 @@ <block> <name>Parameter</name> <key>parameter</key> - <import>from optparse import OptionParser</import> <make>$value</make> <param> <name>Label</name> <key>label</key> <value></value> <type>string</type> + <hide>#if $label() then 'none' else 'part'#</hide> </param> <param> <name>Value</name> @@ -41,7 +41,7 @@ </option> <option> <name>Float</name> - <key>float</key> + <key>eng_float</key> <opt>type:real</opt> <opt>hide:none</opt> </option> @@ -65,12 +65,14 @@ </option> </param> <doc> -This block represents a parameter to the flow graph, \ -used when the flow graph is instantiated as a hier block. +This block represents a parameter to the flow graph. \ +A parameter can be used to pass command line arguments into a top block. \ +Or, parameters can pass arguments into an instantiated hierarchical block. The paramater value cannot depend on any variables. -Leave the label blank to use the parameter id as the label. +Leave the label blank to use the parameter id as the label. \ +The label only applies when this flow graph is instantiated as a hierarchical block. When type is not None, this parameter also becomes a command line option of the form --[id] [value]. </doc> diff --git a/grc/data/platforms/python/blocks/probe_function.xml b/grc/data/platforms/python/blocks/probe_function.xml index d46878526..ac0b3dcde 100644 --- a/grc/data/platforms/python/blocks/probe_function.xml +++ b/grc/data/platforms/python/blocks/probe_function.xml @@ -9,7 +9,7 @@ <key>probe_function</key> <import>from grc_gnuradio import blks2 as grc_blks2</import> <make>grc_blks2.probe_function( - probe_callback=self.$(block_id.eval).$(function_name.eval), + probe_callback=self.$(block_id()).$(function_name()), probe_rate=$probe_rate, )</make> <callback>set_probe_rate($probe_rate)</callback> diff --git a/grc/data/platforms/python/blocks/usrp2_sink_xxxx.xml b/grc/data/platforms/python/blocks/usrp2_sink_xxxx.xml index e6e315786..264ed4f20 100644 --- a/grc/data/platforms/python/blocks/usrp2_sink_xxxx.xml +++ b/grc/data/platforms/python/blocks/usrp2_sink_xxxx.xml @@ -8,9 +8,9 @@ <name>USRP2 Sink</name> <key>usrp2_sink_xxxx</key> <import>from gnuradio import usrp2</import> - <make>#if not $interface.eval and not $mac_addr.eval + <make>#if not $interface() and not $mac_addr() usrp2.sink_$(type.fcn)() -#elif not $mac_addr.eval +#elif not $mac_addr() usrp2.sink_$(type.fcn)($interface) #else usrp2.sink_$(type.fcn)($interface, $mac_addr) diff --git a/grc/data/platforms/python/blocks/usrp2_source_xxxx.xml b/grc/data/platforms/python/blocks/usrp2_source_xxxx.xml index 8b8ae3248..54bea7a49 100644 --- a/grc/data/platforms/python/blocks/usrp2_source_xxxx.xml +++ b/grc/data/platforms/python/blocks/usrp2_source_xxxx.xml @@ -8,9 +8,9 @@ <name>USRP2 Source</name> <key>usrp2_source_xxxx</key> <import>from gnuradio import usrp2</import> - <make>#if not $interface.eval and not $mac_addr.eval + <make>#if not $interface() and not $mac_addr() usrp2.source_$(type.fcn)() -#elif not $mac_addr.eval +#elif not $mac_addr() usrp2.source_$(type.fcn)($interface) #else usrp2.source_$(type.fcn)($interface, $mac_addr) diff --git a/grc/data/platforms/python/blocks/usrp_dual_source_x.xml b/grc/data/platforms/python/blocks/usrp_dual_source_x.xml index 823850b52..cb75fcead 100644 --- a/grc/data/platforms/python/blocks/usrp_dual_source_x.xml +++ b/grc/data/platforms/python/blocks/usrp_dual_source_x.xml @@ -8,8 +8,8 @@ <name>USRP Dual Source</name> <key>usrp_dual_source_x</key> <import>from grc_gnuradio import usrp as grc_usrp</import> - <make>grc_usrp.dual_source_$(type.fcn)(which=$which, rx_ant_a='$rx_ant_a', rx_ant_b='$rx_ant_b') -#if $format.eval + <make>grc_usrp.dual_source_$(type.fcn)(which=$which, rx_ant_a=$rx_ant_a, rx_ant_b=$rx_ant_b) +#if $format() self.$(id).set_format(width=$format.width, shift=$format.shift) #end if self.$(id).set_decim_rate($decimation) @@ -42,7 +42,7 @@ self.$(id).set_gain_b($gain_b)</make> <key>format</key> <value></value> <type>enum</type> - <hide>#if $format.eval then '' else 'part'#</hide> + <hide>#if $format() then '' else 'part'#</hide> <option> <name>16 Bits (Default)</name> <key></key> @@ -95,7 +95,8 @@ self.$(id).set_gain_b($gain_b)</make> <param> <name>RX Antenna A</name> <key>rx_ant_a</key> - <type>enum</type> + <value>RXA</value> + <type>string</type> <option> <name>RXA</name> <key>RXA</key> @@ -125,7 +126,8 @@ self.$(id).set_gain_b($gain_b)</make> <param> <name>RX Antenna B</name> <key>rx_ant_b</key> - <type>enum</type> + <value>RXA</value> + <type>string</type> <option> <name>RXA</name> <key>RXA</key> diff --git a/grc/data/platforms/python/blocks/usrp_simple_sink_x.xml b/grc/data/platforms/python/blocks/usrp_simple_sink_x.xml index ca887997a..0c7fc53da 100644 --- a/grc/data/platforms/python/blocks/usrp_simple_sink_x.xml +++ b/grc/data/platforms/python/blocks/usrp_simple_sink_x.xml @@ -8,7 +8,7 @@ <name>USRP Sink</name> <key>usrp_simple_sink_x</key> <import>from grc_gnuradio import usrp as grc_usrp</import> - <make>grc_usrp.simple_sink_$(type.fcn)(which=$which, side='$side') + <make>grc_usrp.simple_sink_$(type.fcn)(which=$which, side=$side) self.$(id).set_interp_rate($interpolation) self.$(id).set_frequency($frequency, verbose=True) self.$(id).set_gain($gain) @@ -61,13 +61,13 @@ self.$(id).set_auto_tr(True) <name>Side</name> <key>side</key> <value>A</value> - <type>enum</type> + <type>string</type> <option> - <name>Side A</name> + <name>A</name> <key>A</key> </option> <option> - <name>Side B</name> + <name>B</name> <key>B</key> </option> </param> diff --git a/grc/data/platforms/python/blocks/usrp_simple_source_x.xml b/grc/data/platforms/python/blocks/usrp_simple_source_x.xml index d7f5475a6..8d7b9533d 100644 --- a/grc/data/platforms/python/blocks/usrp_simple_source_x.xml +++ b/grc/data/platforms/python/blocks/usrp_simple_source_x.xml @@ -8,8 +8,8 @@ <name>USRP Source</name> <key>usrp_simple_source_x</key> <import>from grc_gnuradio import usrp as grc_usrp</import> - <make>grc_usrp.simple_source_$(type.fcn)(which=$which, side='$side', rx_ant='$rx_ant'#if $hb_filters.eval then ', no_hb=True' else ''#) -#if $format.eval + <make>grc_usrp.simple_source_$(type.fcn)(which=$which, side=$side, rx_ant=$rx_ant#if $hb_filters() then ', no_hb=True' else ''#) +#if $format() self.$(id).set_format(width=$format.width, shift=$format.shift) #end if self.$(id).set_decim_rate($decimation) @@ -38,7 +38,7 @@ self.$(id).set_gain($gain)</make> <key>format</key> <value></value> <type>enum</type> - <hide>#if $format.eval then '' else 'part'#</hide> + <hide>#if $format() then '' else 'part'#</hide> <option> <name>16 Bits (Default)</name> <key></key> @@ -77,13 +77,13 @@ self.$(id).set_gain($gain)</make> <name>Side</name> <key>side</key> <value>A</value> - <type>enum</type> + <type>string</type> <option> - <name>Side A</name> + <name>A</name> <key>A</key> </option> <option> - <name>Side B</name> + <name>B</name> <key>B</key> </option> </param> @@ -91,7 +91,7 @@ self.$(id).set_gain($gain)</make> <name>RX Antenna</name> <key>rx_ant</key> <value>RXA</value> - <type>enum</type> + <type>string</type> <option> <name>RXA</name> <key>RXA</key> @@ -118,7 +118,7 @@ self.$(id).set_gain($gain)</make> <key>hb_filters</key> <value></value> <type>enum</type> - <hide>#if $hb_filters.eval then 'none' else 'part'#</hide> + <hide>#if $hb_filters() then 'none' else 'part'#</hide> <option> <name>Enable</name> <key></key> diff --git a/grc/data/platforms/python/blocks/variable_chooser.xml b/grc/data/platforms/python/blocks/variable_chooser.xml index 2a00a1cf2..6827c3675 100644 --- a/grc/data/platforms/python/blocks/variable_chooser.xml +++ b/grc/data/platforms/python/blocks/variable_chooser.xml @@ -1,42 +1,51 @@ <?xml version="1.0"?> <!-- ################################################### -##Variable Chooser: a grc variable with multiple choices +##Variable Chooser: +## a gui form with enumerated choices +## radio buttons, drop down, or button ################################################### --> <block> <name>Variable Chooser</name> <key>variable_chooser</key> - <make>$(choices)[$value_index] -_$(id)_control = grc_wxgui.$(chooser_type)_control( - window=self.GetWin(), - callback=self.set_$(id), - #if $label.eval + <import>from grc_gnuradio.wxgui import forms</import> + <make>$value +self['$id'] = $id +self.subscribe('$id', self.set_$(id)) +self._$(id)_control = forms.$(type)( + parent=self.GetWin(), + ps=self, + key='$id', + #if $label() label=$label, - #else + #else label='$id', - #end if - index=$value_index, + #end if choices=$choices, labels=$labels, +#if $type() == 'radio_buttons' + style=$style, +#end if ) -#set $grid_pos = $grid_pos.eval +#set $grid_pos = $grid_pos() #if not grid_pos -self.Add(_$(id)_control) +self.Add(self._$(id)_control) #else -self.GridAdd(_$(id)_control, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos[3]) +self.GridAdd(self._$(id)_control, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos[3]) #end if</make> <param> <name>Label</name> <key>label</key> <value></value> <type>string</type> + <hide>#if $label() then 'none' else 'part'#</hide> </param> <param> - <name>Value Index</name> - <key>value_index</key> - <value>0</value> - <type>int</type> + <name>Default Value</name> + <key>value</key> + <value>1</value> + <type>raw</type> </param> <param> <name>Choices</name> @@ -51,8 +60,8 @@ self.GridAdd(_$(id)_control, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos <type>raw</type> </param> <param> - <name>Chooser Type</name> - <key>chooser_type</key> + <name>Type</name> + <key>type</key> <value>drop_down</value> <type>enum</type> <option> @@ -60,12 +69,8 @@ self.GridAdd(_$(id)_control, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos <key>drop_down</key> </option> <option> - <name>Radio Buttons Horizontal</name> - <key>radio_buttons_horizontal</key> - </option> - <option> - <name>Radio Buttons Vertical</name> - <key>radio_buttons_vertical</key> + <name>Radio Buttons</name> + <key>radio_buttons</key> </option> <option> <name>Button</name> @@ -73,12 +78,27 @@ self.GridAdd(_$(id)_control, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos </option> </param> <param> + <name>Style</name> + <key>style</key> + <value>wx.RA_HORIZONTAL</value> + <type>enum</type> + <hide>#if $type() == 'radio_buttons' then 'part' else 'all'#</hide> + <option> + <name>Horizontal</name> + <key>wx.RA_HORIZONTAL</key> + </option> + <option> + <name>Vertical</name> + <key>wx.RA_VERTICAL</key> + </option> + </param> + <param> <name>Grid Position</name> <key>grid_pos</key> <value></value> <type>grid_pos</type> </param> - <check>$value_index in range(len($choices))</check> + <check>$value in $choices</check> <check>not $labels or len($labels) == len($choices)</check> <doc> This block creates a variable with a drop down, radio buttons, or a button. \ diff --git a/grc/data/platforms/python/blocks/variable_sink.xml b/grc/data/platforms/python/blocks/variable_sink.xml index 87575ae1b..426bd34fb 100644 --- a/grc/data/platforms/python/blocks/variable_sink.xml +++ b/grc/data/platforms/python/blocks/variable_sink.xml @@ -15,13 +15,13 @@ def _$(id)_run(): while True: time.sleep(1.0/$samp_rate) data = self.$(id).data() -#if $vlen.eval == 0 +#if $vlen() == 0 if data: - self.set_$(variable.eval)(data[-1]) + self.set_$(variable())(data[-1]) self.$(id).clear() #else if len(data) >= $vlen: - self.set_$(variable.eval)(data[-($vlen):]) + self.set_$(variable())(data[-($vlen):]) self.$(id).clear() #end if threading.Thread(target=_$(id)_run).start()</make> diff --git a/grc/data/platforms/python/blocks/variable_slider.xml b/grc/data/platforms/python/blocks/variable_slider.xml index 635f3ed4c..9c8e7ece9 100644 --- a/grc/data/platforms/python/blocks/variable_slider.xml +++ b/grc/data/platforms/python/blocks/variable_slider.xml @@ -1,38 +1,55 @@ <?xml version="1.0"?> <!-- ################################################### -##Variable Slider: a grc variable with key, value, min, max, step +##Variable Slider: +## a combined slider and text box form ################################################### --> <block> <name>Variable Slider</name> <key>variable_slider</key> + <import>from grc_gnuradio.wxgui import forms</import> <make>$value -_$(id)_control = grc_wxgui.slider_$(slider_type)_control( - window=self.GetWin(), - callback=self.set_$(id), - #if $label.eval +self['$id'] = $id +self.subscribe('$id', self.set_$(id)) +self._$(id)_sizer = wx.BoxSizer(wx.VERTICAL) +forms.text_box( + parent=self.GetWin(), + sizer=self._$(id)_sizer, + ps=self, + key='$id', + #if $label() label=$label, - #else + #else label='$id', - #end if - value=$id, - min=$min, - max=$max, + #end if + converter=forms.$(converver)(), + proportion=0, +) +forms.slider( + parent=self.GetWin(), + sizer=self._$(id)_sizer, + ps=self, + key='$id', + minimum=$min, + maximum=$max, num_steps=$num_steps, - slider_length=$slider_length, + style=$style, + cast=$(converver.slider_cast), + proportion=1, ) -#set $grid_pos = $grid_pos.eval +#set $grid_pos = $grid_pos() #if not grid_pos -self.Add(_$(id)_control) +self.Add(self._$(id)_sizer) #else -self.GridAdd(_$(id)_control, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos[3]) +self.GridAdd(self._$(id)_sizer, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos[3]) #end if</make> <param> <name>Label</name> <key>label</key> <value></value> <type>string</type> + <hide>#if $label() then 'none' else 'part'#</hide> </param> <param> <name>Default Value</name> @@ -60,24 +77,34 @@ self.GridAdd(_$(id)_control, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos <hide>part</hide> </param> <param> - <name>Slider Length (px)</name> - <key>slider_length</key> - <value>200</value> - <type>int</type> + <name>Style</name> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> + <type>enum</type> <hide>part</hide> + <option> + <name>Horizontal</name> + <key>wx.SL_HORIZONTAL</key> + </option> + <option> + <name>Vertical</name> + <key>wx.SL_VERTICAL</key> + </option> </param> <param> - <name>Slider Type</name> - <key>slider_type</key> - <value>horizontal</value> + <name>Converter</name> + <key>converver</key> + <value>float_converter</value> <type>enum</type> <option> - <name>Horizontal</name> - <key>horizontal</key> + <name>Float</name> + <key>float_converter</key> + <opt>slider_cast:float</opt> </option> <option> - <name>Vertical</name> - <key>vertical</key> + <name>Integer</name> + <key>int_converter</key> + <opt>slider_cast:int</opt> </option> </param> <param> diff --git a/grc/data/platforms/python/blocks/variable_text_box.xml b/grc/data/platforms/python/blocks/variable_text_box.xml index 97c6aa0d9..2857fa366 100644 --- a/grc/data/platforms/python/blocks/variable_text_box.xml +++ b/grc/data/platforms/python/blocks/variable_text_box.xml @@ -1,34 +1,40 @@ <?xml version="1.0"?> <!-- ################################################### -##Variable Text Box: a grc variable with key, value +##Variable Text Box: +## a gui text box form ################################################### --> <block> <name>Variable Text Box</name> <key>variable_text_box</key> + <import>from grc_gnuradio.wxgui import forms</import> <make>$value -_$(id)_control = grc_wxgui.text_box_control( - window=self.GetWin(), - callback=self.set_$(id), - #if $label.eval +self['$id'] = $id +self.subscribe('$id', self.set_$(id)) +self._$(id)_control = forms.text_box( + parent=self.GetWin(), + ps=self, + key='$id', + #if $label() label=$label, - #else + #else label='$id', - #end if - value=$id, + #end if + converter=forms.$(converver)(), ) -#set $grid_pos = $grid_pos.eval +#set $grid_pos = $grid_pos() #if not grid_pos -self.Add(_$(id)_control) +self.Add(self._$(id)_control) #else -self.GridAdd(_$(id)_control, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos[3]) +self.GridAdd(self._$(id)_control, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos[3]) #end if</make> <param> <name>Label</name> <key>label</key> <value></value> <type>string</type> + <hide>#if $label() then 'none' else 'part'#</hide> </param> <param> <name>Default Value</name> @@ -37,6 +43,28 @@ self.GridAdd(_$(id)_control, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos <type>raw</type> </param> <param> + <name>Converter</name> + <key>converver</key> + <value>float_converter</value> + <type>enum</type> + <option> + <name>Float</name> + <key>float_converter</key> + </option> + <option> + <name>Integer</name> + <key>int_converter</key> + </option> + <option> + <name>String</name> + <key>str_converter</key> + </option> + <option> + <name>Evaluate</name> + <key>eval_converter</key> + </option> + </param> + <param> <name>Grid Position</name> <key>grid_pos</key> <value></value> diff --git a/grc/data/platforms/python/blocks/wxgui_constellationsink2.xml b/grc/data/platforms/python/blocks/wxgui_constellationsink2.xml index 69869904f..471c9f4a8 100644 --- a/grc/data/platforms/python/blocks/wxgui_constellationsink2.xml +++ b/grc/data/platforms/python/blocks/wxgui_constellationsink2.xml @@ -23,7 +23,7 @@ symbol_rate=$symbol_rate, omega_limit=$omega_limit, ) -#set $grid_pos = $grid_pos.eval +#set $grid_pos = $grid_pos() #if not grid_pos self.Add(self.$(id).win) #else diff --git a/grc/data/platforms/python/blocks/wxgui_fftsink2.xml b/grc/data/platforms/python/blocks/wxgui_fftsink2.xml index c729bea4b..31680f7bd 100644 --- a/grc/data/platforms/python/blocks/wxgui_fftsink2.xml +++ b/grc/data/platforms/python/blocks/wxgui_fftsink2.xml @@ -17,11 +17,11 @@ fft_size=$fft_size, fft_rate=$fft_rate, average=$average, - avg_alpha=#if $avg_alpha.eval then $avg_alpha else 'None'#, + avg_alpha=#if $avg_alpha() then $avg_alpha else 'None'#, title=$title, peak_hold=$peak_hold, ) -#set $grid_pos = $grid_pos.eval +#set $grid_pos = $grid_pos() #if not grid_pos self.Add(self.$(id).win) #else @@ -112,7 +112,7 @@ self.GridAdd(self.$(id).win, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos <key>peak_hold</key> <value>False</value> <type>enum</type> - <hide>#if $peak_hold.eval == 'True' then 'none' else 'part'#</hide> + <hide>#if $peak_hold() == 'True' then 'none' else 'part'#</hide> <option> <name>On</name> <key>True</key> @@ -127,7 +127,7 @@ self.GridAdd(self.$(id).win, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos <key>average</key> <value>False</value> <type>enum</type> - <hide>#if $average.eval == 'True' then 'none' else 'part'#</hide> + <hide>#if $average() == 'True' then 'none' else 'part'#</hide> <option> <name>On</name> <key>True</key> @@ -142,7 +142,7 @@ self.GridAdd(self.$(id).win, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos <key>avg_alpha</key> <value>0</value> <type>real</type> - <hide>#if $average.eval == 'True' then 'none' else 'all'#</hide> + <hide>#if $average() == 'True' then 'none' else 'all'#</hide> </param> <param> <name>Grid Position</name> diff --git a/grc/data/platforms/python/blocks/wxgui_histosink2.xml b/grc/data/platforms/python/blocks/wxgui_histosink2.xml index 3d694aedc..4de57b1c4 100644 --- a/grc/data/platforms/python/blocks/wxgui_histosink2.xml +++ b/grc/data/platforms/python/blocks/wxgui_histosink2.xml @@ -14,7 +14,7 @@ num_bins=$num_bins, frame_size=$frame_size, ) -#set $grid_pos = $grid_pos.eval +#set $grid_pos = $grid_pos() #if not grid_pos self.Add(self.$(id).win) #else diff --git a/grc/data/platforms/python/blocks/wxgui_numbersink2.xml b/grc/data/platforms/python/blocks/wxgui_numbersink2.xml index 1b32993e1..af0281f6a 100644 --- a/grc/data/platforms/python/blocks/wxgui_numbersink2.xml +++ b/grc/data/platforms/python/blocks/wxgui_numbersink2.xml @@ -20,12 +20,12 @@ sample_rate=$samp_rate, number_rate=$number_rate, average=$average, - avg_alpha=#if $avg_alpha.eval then $avg_alpha else 'None'#, + avg_alpha=#if $avg_alpha() then $avg_alpha else 'None'#, label=$title, peak_hold=$peak_hold, show_gauge=$show_gauge, ) -#set $grid_pos = $grid_pos.eval +#set $grid_pos = $grid_pos() #if not grid_pos self.Add(self.$(id).win) #else @@ -112,7 +112,7 @@ self.GridAdd(self.$(id).win, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos <key>peak_hold</key> <value>False</value> <type>enum</type> - <hide>#if $peak_hold.eval == 'True' then 'none' else 'part'#</hide> + <hide>#if $peak_hold() == 'True' then 'none' else 'part'#</hide> <option> <name>On</name> <key>True</key> @@ -127,7 +127,7 @@ self.GridAdd(self.$(id).win, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos <key>average</key> <value>False</value> <type>enum</type> - <hide>#if $average.eval == 'True' then 'none' else 'part'#</hide> + <hide>#if $average() == 'True' then 'none' else 'part'#</hide> <option> <name>On</name> <key>True</key> @@ -142,7 +142,7 @@ self.GridAdd(self.$(id).win, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos <key>avg_alpha</key> <value>0</value> <type>real</type> - <hide>#if $average.eval == 'True' then 'none' else 'all'#</hide> + <hide>#if $average() == 'True' then 'none' else 'all'#</hide> </param> <param> <name>Show Gauge</name> diff --git a/grc/data/platforms/python/blocks/wxgui_scopesink2.xml b/grc/data/platforms/python/blocks/wxgui_scopesink2.xml index 1af0afb35..78c39f80d 100644 --- a/grc/data/platforms/python/blocks/wxgui_scopesink2.xml +++ b/grc/data/platforms/python/blocks/wxgui_scopesink2.xml @@ -19,7 +19,7 @@ xy_mode=$xy_mode, num_inputs=$num_inputs, ) -#set $grid_pos = $grid_pos.eval +#set $grid_pos = $grid_pos() #if not grid_pos self.Add(self.$(id).win) #else @@ -71,7 +71,7 @@ self.GridAdd(self.$(id).win, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos <key>ac_couple</key> <value>False</value> <type>enum</type> - <hide>#if $ac_couple.eval == 'True' then 'none' else 'part'#</hide> + <hide>#if $ac_couple() == 'True' then 'none' else 'part'#</hide> <option> <name>Off</name> <key>False</key> @@ -86,7 +86,7 @@ self.GridAdd(self.$(id).win, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos <key>xy_mode</key> <value>False</value> <type>enum</type> - <hide>#if $xy_mode.eval == 'True' then 'none' else 'part'#</hide> + <hide>#if $xy_mode() == 'True' then 'none' else 'part'#</hide> <option> <name>Off</name> <key>False</key> diff --git a/grc/data/platforms/python/blocks/wxgui_waterfallsink2.xml b/grc/data/platforms/python/blocks/wxgui_waterfallsink2.xml index 68d84dbba..6d76ee867 100644 --- a/grc/data/platforms/python/blocks/wxgui_waterfallsink2.xml +++ b/grc/data/platforms/python/blocks/wxgui_waterfallsink2.xml @@ -17,10 +17,10 @@ fft_size=$fft_size, fft_rate=$fft_rate, average=$options.average, - avg_alpha=#if $avg_alpha.eval then $avg_alpha else 'None'#, + avg_alpha=#if $avg_alpha() then $avg_alpha else 'None'#, title=$title, ) -#set $grid_pos = $grid_pos.eval +#set $grid_pos = $grid_pos() #if not grid_pos self.Add(self.$(id).win) #else diff --git a/grc/data/platforms/python/blocks/xmlrpc_client.xml b/grc/data/platforms/python/blocks/xmlrpc_client.xml index f132a7865..dc4d154d1 100644 --- a/grc/data/platforms/python/blocks/xmlrpc_client.xml +++ b/grc/data/platforms/python/blocks/xmlrpc_client.xml @@ -8,8 +8,8 @@ <name>XMLRPC Client</name> <key>xmlrpc_client</key> <import>import xmlrpclib</import> - <make>xmlrpclib.Server('http://$(addr.eval):$(port)')</make> - <callback>$(callback.eval)($variable)</callback> + <make>xmlrpclib.Server('http://$(addr()):$(port)')</make> + <callback>$(callback())($variable)</callback> <param> <name>Address</name> <key>addr</key> |