diff options
-rw-r--r-- | grc/data/platforms/python/blocks/blks2_selector.xml | 4 | ||||
-rw-r--r-- | grc/data/platforms/python/blocks/variable_slider.xml | 11 | ||||
-rw-r--r-- | grc/src/grc_gnuradio/wxgui/callback_controls.py | 10 | ||||
-rw-r--r-- | grc/src/platforms/python/Param.py | 3 |
4 files changed, 21 insertions, 7 deletions
diff --git a/grc/data/platforms/python/blocks/blks2_selector.xml b/grc/data/platforms/python/blocks/blks2_selector.xml index 457f8695e..2d89df186 100644 --- a/grc/data/platforms/python/blocks/blks2_selector.xml +++ b/grc/data/platforms/python/blocks/blks2_selector.xml @@ -16,8 +16,8 @@ input_index=$input_index, output_index=$output_index, )</make> - <callback>set_input_index($input_index)</callback> - <callback>set_output_index($output_index)</callback> + <callback>set_input_index(int($input_index))</callback> + <callback>set_output_index(int($output_index))</callback> <param> <name>Type</name> <key>type</key> diff --git a/grc/data/platforms/python/blocks/variable_slider.xml b/grc/data/platforms/python/blocks/variable_slider.xml index 2f6374b9a..27ac7ea5e 100644 --- a/grc/data/platforms/python/blocks/variable_slider.xml +++ b/grc/data/platforms/python/blocks/variable_slider.xml @@ -20,6 +20,7 @@ _$(id)_control = grc_wxgui.slider_$(slider_type)_control( min=$min, max=$max, num_steps=$num_steps, + slider_length=$slider_length, ) #set $grid_pos = $grid_pos.eval #if not grid_pos @@ -56,8 +57,16 @@ self.GridAdd(_$(id)_control, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos <key>num_steps</key> <value>100</value> <type>int</type> + <hide>part</hide> </param> - <param> + <param> + <name>Slider Length (px)</name> + <key>slider_length</key> + <value>200</value> + <type>int</type> + <hide>part</hide> + </param> + <param> <name>Slider Type</name> <key>slider_type</key> <value>horizontal</value> diff --git a/grc/src/grc_gnuradio/wxgui/callback_controls.py b/grc/src/grc_gnuradio/wxgui/callback_controls.py index 2bb0b994e..a8e7a9320 100644 --- a/grc/src/grc_gnuradio/wxgui/callback_controls.py +++ b/grc/src/grc_gnuradio/wxgui/callback_controls.py @@ -152,7 +152,7 @@ class radio_buttons_vertical_control(_radio_buttons_control_base): class _slider_control_base(_control_base): """House a Slider and a Text Box for variable control.""" - def __init__(self, window, callback, label='Label', value=50, min=0, max=100, num_steps=100): + def __init__(self, window, callback, label='Label', value=50, min=0, max=100, num_steps=100, slider_length=200): """ Slider contructor. Create the slider, text box, and label. @@ -163,12 +163,14 @@ class _slider_control_base(_control_base): @param min the min @param max the max @param num_steps the number of steps + @param slider_length the length of the slider bar in pixels """ #initialize _control_base.__init__(self, window, callback) self.min = float(min) self.max = float(max) self.num_steps = int(num_steps) + self.slider_length = slider_length #create gui elements label_text_sizer = wx.BoxSizer(self.label_text_orientation) #label and text box container label_text = LabelText(self.get_window(), '%s: '%str(label)) @@ -178,7 +180,7 @@ class _slider_control_base(_control_base): label_text_sizer.Add(obj, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL) self.Add(label_text_sizer, 0, wx.ALIGN_CENTER) #make the slider - self.slider = slider = wx.Slider(self.get_window(), -1, size=wx.Size(*self.slider_size), style=self.slider_style) + self.slider = slider = wx.Slider(self.get_window(), -1, size=wx.Size(*self.get_slider_size()), style=self.slider_style) try: slider.SetRange(0, num_steps) except Exception, e: print >> sys.stderr, 'Error in set slider range: "%s".'%e @@ -230,11 +232,11 @@ class _slider_control_base(_control_base): class slider_horizontal_control(_slider_control_base): label_text_orientation = wx.HORIZONTAL slider_style = wx.SL_HORIZONTAL - slider_size = 200, 20 + def get_slider_size(self): return self.slider_length, 20 class slider_vertical_control(_slider_control_base): label_text_orientation = wx.VERTICAL slider_style = wx.SL_VERTICAL - slider_size = 20, 200 + def get_slider_size(self): return 20, self.slider_length ############################################################################################## # Text Box Control diff --git a/grc/src/platforms/python/Param.py b/grc/src/platforms/python/Param.py index 1381f6490..321913ea8 100644 --- a/grc/src/platforms/python/Param.py +++ b/grc/src/platforms/python/Param.py @@ -77,6 +77,7 @@ class Param(_Param): Get the hide value from the base class. Hide the ID parameter for most blocks. Exceptions below. If the parameter controls a port type, vlen, or nports, return part. + If the parameter is an empty grid position, return part. These parameters are redundant to display in the flow graph view. @return hide the hide property string """ @@ -90,6 +91,8 @@ class Param(_Param): if self.get_key() in ' '.join(map( lambda p: ' '.join([p._type, p._vlen, p._nports]), self.get_parent().get_ports()) ): return 'part' + #hide empty grid positions + if self.get_key() == 'grid_pos' and not self.get_value(): return 'part' return hide def evaluate(self): |