diff options
Diffstat (limited to 'grc')
-rw-r--r-- | grc/data/platforms/python/blocks/blks2_error_rate.xml | 3 | ||||
-rw-r--r-- | grc/data/platforms/python/blocks/options.xml | 1 | ||||
-rw-r--r-- | grc/data/platforms/python/blocks/preferences.xml | 14 | ||||
-rw-r--r-- | grc/examples/usrp/usrp_two_tone_loopback.grc | 247 | ||||
-rw-r--r-- | grc/src/gui/Preferences.py | 7 | ||||
-rw-r--r-- | grc/src/platforms/base/Param.py | 2 | ||||
-rw-r--r-- | grc/src/platforms/gui/Block.py | 3 | ||||
-rw-r--r-- | grc/src/platforms/gui/FlowGraph.py | 33 | ||||
-rw-r--r-- | grc/src/platforms/python/Param.py | 18 |
9 files changed, 141 insertions, 187 deletions
diff --git a/grc/data/platforms/python/blocks/blks2_error_rate.xml b/grc/data/platforms/python/blocks/blks2_error_rate.xml index 79703f6e9..852e7db01 100644 --- a/grc/data/platforms/python/blocks/blks2_error_rate.xml +++ b/grc/data/platforms/python/blocks/blks2_error_rate.xml @@ -21,10 +21,12 @@ <option> <name>Bit Error Rate</name> <key>"BER"</key> + <opt>hide_bps:</opt> </option> <option> <name>Symbol Error Rate</name> <key>"SER"</key> + <opt>hide_bps:all</opt> </option> </param> <param> @@ -38,6 +40,7 @@ <key>bits_per_symbol</key> <value>2</value> <type>int</type> + <hide>$type.hide_bps</hide> </param> <sink> <name>ref</name> diff --git a/grc/data/platforms/python/blocks/options.xml b/grc/data/platforms/python/blocks/options.xml index 8e8f06891..3a73050ae 100644 --- a/grc/data/platforms/python/blocks/options.xml +++ b/grc/data/platforms/python/blocks/options.xml @@ -39,6 +39,7 @@ import wx <key>window_size</key> <value>1280, 1024</value> <type>int_vector</type> + <hide>part</hide> </param> <param> <name>Generate Options</name> diff --git a/grc/data/platforms/python/blocks/preferences.xml b/grc/data/platforms/python/blocks/preferences.xml index 51138c123..e426b5a34 100644 --- a/grc/data/platforms/python/blocks/preferences.xml +++ b/grc/data/platforms/python/blocks/preferences.xml @@ -114,20 +114,6 @@ <key>hide</key> </option> </param> - <param> - <name>Show ID Label</name> - <key>show_id</key> - <value>show</value> - <type>enum</type> - <option> - <name>Show</name> - <key>show</key> - </option> - <option> - <name>Hide</name> - <key>hide</key> - </option> - </param> <!-- Misc Prefs --> <param> <name>Restore Open Files</name> diff --git a/grc/examples/usrp/usrp_two_tone_loopback.grc b/grc/examples/usrp/usrp_two_tone_loopback.grc index ccbe190ec..30f5409b3 100644 --- a/grc/examples/usrp/usrp_two_tone_loopback.grc +++ b/grc/examples/usrp/usrp_two_tone_loopback.grc @@ -1,6 +1,6 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Thu Jul 24 14:27:46 2008</timestamp> + <timestamp>Mon Sep 8 21:47:19 2008</timestamp> <block> <key>options</key> <param> @@ -312,46 +312,22 @@ </param> </block> <block> - <key>variable_slider</key> + <key>variable</key> <param> <key>id</key> - <value>tone_ampl</value> + <value>samp_rate</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>label</key> - <value>Tone Ampl</value> - </param> - <param> <key>value</key> - <value>5000</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>5000</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>slider_type</key> - <value>vertical</value> - </param> - <param> - <key>grid_pos</key> - <value>1, 0, 2, 1</value> + <value>64e6/200</value> </param> <param> <key>_coordinate</key> - <value>(21, 422)</value> + <value>(9, 166)</value> </param> <param> <key>_rotation</key> @@ -359,104 +335,22 @@ </param> </block> <block> - <key>usrp_simple_sink_x</key> + <key>variable</key> <param> <key>id</key> - <value>usrp_simple_sink_x</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>number</key> - <value>0</value> - </param> - <param> - <key>subdev_spec</key> - <value>None</value> - </param> - <param> - <key>frequency</key> <value>tun_freq</value> </param> <param> - <key>interpolation</key> - <value>400</value> - </param> - <param> - <key>gain</key> - <value>0</value> - </param> - <param> - <key>mux</key> - <value>0x0</value> - </param> - <param> - <key>auto_tr</key> - <value>None</value> - </param> - <param> - <key>tx_enb</key> - <value>None</value> - </param> - <param> - <key>_coordinate</key> - <value>(835, 5)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_float_to_complex</key> - <param> - <key>id</key> - <value>gr_float_to_complex</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(634, 226)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_add_vxx</key> - <param> - <key>id</key> - <value>gr_add_vxx</value> - </param> - <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>num_inputs</key> - <value>3</value> - </param> - <param> - <key>vlen</key> - <value>1</value> + <key>value</key> + <value>int(100e6)</value> </param> <param> <key>_coordinate</key> - <value>(528, 78)</value> + <value>(116, 166)</value> </param> <param> <key>_rotation</key> @@ -475,7 +369,7 @@ </param> <param> <key>type</key> - <value>float</value> + <value>complex</value> </param> <param> <key>samp_rate</key> @@ -518,7 +412,7 @@ </param> <param> <key>type</key> - <value>float</value> + <value>complex</value> </param> <param> <key>samp_rate</key> @@ -561,7 +455,7 @@ </param> <param> <key>type</key> - <value>float</value> + <value>complex</value> </param> <param> <key>noise_type</key> @@ -585,22 +479,30 @@ </param> </block> <block> - <key>variable</key> + <key>gr_add_vxx</key> <param> <key>id</key> - <value>samp_rate</value> + <value>gr_add_vxx</value> </param> <param> <key>_enabled</key> <value>True</value> </param> <param> - <key>value</key> - <value>64e6/200</value> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>num_inputs</key> + <value>3</value> + </param> + <param> + <key>vlen</key> + <value>1</value> </param> <param> <key>_coordinate</key> - <value>(9, 166)</value> + <value>(528, 78)</value> </param> <param> <key>_rotation</key> @@ -608,22 +510,101 @@ </param> </block> <block> - <key>variable</key> + <key>usrp_simple_sink_x</key> <param> <key>id</key> + <value>usrp_simple_sink_x</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>number</key> + <value>0</value> + </param> + <param> + <key>subdev_spec</key> + <value>None</value> + </param> + <param> + <key>frequency</key> <value>tun_freq</value> </param> <param> + <key>interpolation</key> + <value>400</value> + </param> + <param> + <key>gain</key> + <value>0</value> + </param> + <param> + <key>mux</key> + <value>0x0</value> + </param> + <param> + <key>auto_tr</key> + <value>None</value> + </param> + <param> + <key>tx_enb</key> + <value>None</value> + </param> + <param> + <key>_coordinate</key> + <value>(835, 5)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_slider</key> + <param> + <key>id</key> + <value>tone_ampl</value> + </param> + <param> <key>_enabled</key> <value>True</value> </param> <param> + <key>label</key> + <value>Tone Ampl</value> + </param> + <param> <key>value</key> - <value>int(100e6)</value> + <value>5000</value> + </param> + <param> + <key>min</key> + <value>-samp_rate/2</value> + </param> + <param> + <key>max</key> + <value>samp_rate/2</value> + </param> + <param> + <key>num_steps</key> + <value>100</value> + </param> + <param> + <key>slider_type</key> + <value>vertical</value> + </param> + <param> + <key>grid_pos</key> + <value>1, 0, 2, 1</value> </param> <param> <key>_coordinate</key> - <value>(116, 166)</value> + <value>(21, 422)</value> </param> <param> <key>_rotation</key> @@ -655,21 +636,9 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_float_to_complex</source_block_id> - <sink_block_id>usrp_simple_sink_x</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> <source_block_id>gr_add_vxx</source_block_id> - <sink_block_id>gr_float_to_complex</sink_block_id> + <sink_block_id>usrp_simple_sink_x</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> - <connection> - <source_block_id>gr_add_vxx</source_block_id> - <sink_block_id>gr_float_to_complex</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> </flow_graph>
\ No newline at end of file diff --git a/grc/src/gui/Preferences.py b/grc/src/gui/Preferences.py index a5591500d..fc06d9246 100644 --- a/grc/src/gui/Preferences.py +++ b/grc/src/gui/Preferences.py @@ -55,7 +55,6 @@ class _Preferences(object): self.file_open_param = self._prefs_block.get_param('file_open') self.files_open_param = self._prefs_block.get_param('files_open') self.show_params_param = self._prefs_block.get_param('show_params') - self.show_id_param = self._prefs_block.get_param('show_id') def save(self): try: ParseXML.to_file({'block': self._prefs_block.export_data()}, self._prefs_file_path) @@ -77,9 +76,8 @@ Snap to Grid forces the upper right corner of the signal block to align with a g ''' Show or hide the reports window at the bottom of the main window. Show or hide all paramater labels in the signal blocks. -Show or hide the ID label in the signal blocks. ''', - [self.show_reports_param, self.show_params_param, self.show_id_param], + [self.show_reports_param, self.show_params_param], ), ( 'Misc', @@ -125,6 +123,3 @@ def show_grid(): def show_params(): return _get_prefs().show_params_param.get_value() == 'show' - -def show_id(): - return _get_prefs().show_id_param.get_value() == 'show' diff --git a/grc/src/platforms/base/Param.py b/grc/src/platforms/base/Param.py index 3a8d98c30..232f6758f 100644 --- a/grc/src/platforms/base/Param.py +++ b/grc/src/platforms/base/Param.py @@ -188,8 +188,6 @@ class Param(Element): def is_enum(self): return self._type == 'enum' - def is_type_dependent(self): return '$' in self._type - ############################################## # Access Options ############################################## diff --git a/grc/src/platforms/gui/Block.py b/grc/src/platforms/gui/Block.py index d38e17133..7589540b9 100644 --- a/grc/src/platforms/gui/Block.py +++ b/grc/src/platforms/gui/Block.py @@ -134,10 +134,9 @@ class Block(Element): desc = pango.FontDescription(BLOCK_FONT) layout.set_font_description(desc) self.label_width, self.label_height = layout.get_pixel_size() - #display the params (except for the special params id and position) + #display the params if Preferences.show_params(): for param in filter(lambda p: p.get_hide() not in ('all', 'part'), self.get_params()): - if not Preferences.show_id() and param.get_key() == 'id': continue layout = param.get_layout() layouts.append(layout) w,h = layout.get_pixel_size() diff --git a/grc/src/platforms/gui/FlowGraph.py b/grc/src/platforms/gui/FlowGraph.py index 1e654e1bf..60bb57528 100644 --- a/grc/src/platforms/gui/FlowGraph.py +++ b/grc/src/platforms/gui/FlowGraph.py @@ -187,21 +187,22 @@ class FlowGraph(Element): """ changed = False for selected_block in self.get_selected_blocks(): - for child in selected_block.get_params() + selected_block.get_ports(): - #find a param that controls a type - type_param = None - for param in selected_block.get_params(): - if not type_param and param.is_enum(): type_param = param - if param.is_enum() and param.get_key() in child._type: type_param = param - if type_param: - #try to increment the enum by direction - try: - keys = type_param.get_option_keys() - old_index = keys.index(type_param.get_value()) - new_index = (old_index + direction + len(keys))%len(keys) - type_param.set_value(keys[new_index]) - changed = True - except: pass + type_param = None + for param in filter(lambda p: p.is_enum(), selected_block.get_params()): + children = param.get_parent().get_ports() + param.get_parent().get_params() + #priority to the type controller + if param.get_key() in ' '.join(map(lambda p: p._type, children)): type_param = param + #use param if type param is unset + if not type_param: type_param = param + if type_param: + #try to increment the enum by direction + try: + keys = type_param.get_option_keys() + old_index = keys.index(type_param.get_value()) + new_index = (old_index + direction + len(keys))%len(keys) + type_param.set_value(keys[new_index]) + changed = True + except: pass return changed def port_controller_modify_selected(self, direction): @@ -212,7 +213,7 @@ class FlowGraph(Element): """ changed = False for selected_block in self.get_selected_blocks(): - for ports in (selected_block.get_sources(), selected_block.get_sinks()): + for ports in selected_block.get_ports(): if ports and hasattr(ports[0], 'get_nports') and ports[0].get_nports(): #find the param that controls port0 for param in selected_block.get_params(): diff --git a/grc/src/platforms/python/Param.py b/grc/src/platforms/python/Param.py index ed5c64063..39ec57e32 100644 --- a/grc/src/platforms/python/Param.py +++ b/grc/src/platforms/python/Param.py @@ -39,19 +39,21 @@ class Param(_Param): def get_hide(self): """ Get the hide value from the base class. - If hide was empty, and this is a type controller, set hide to part. - If hide was empty, and this is an id of a non variable, set hide to part. + Hide the ID parameter for most blocks. Exceptions below. + If the parameter controls a port type, vlen, or nports, return part. + These parameters are redundant to display in the flow graph view. @return hide the hide property string """ hide = _Param.get_hide(self) - #hide IO controlling params - if not hide and self.get_key() in ( - 'type', 'vlen', 'num_inputs', 'num_outputs' - ): hide = 'part' + if hide: return hide #hide ID in non variable blocks - elif not hide and self.get_key() == 'id' and self.get_parent().get_key() not in ( + if self.get_key() == 'id' and self.get_parent().get_key() not in ( 'variable', 'variable_slider', 'variable_chooser', 'variable_text_box', 'parameter', 'options' - ): hide = 'part' + ): return 'part' + #hide port controllers + if self.get_key() in ' '.join(map( + lambda p: ' '.join([p._type, p._vlen, p._nports]), self.get_parent().get_ports()) + ): return 'part' return hide def evaluate(self): |