diff options
author | jblum | 2008-09-09 05:46:45 +0000 |
---|---|---|
committer | jblum | 2008-09-09 05:46:45 +0000 |
commit | a6aa6eb21209cf3004381c0c9f98b303929dac7a (patch) | |
tree | 4799690087869e655a19ad544828eb7fd67e0933 /grc/src | |
parent | 202d13adec25b771faa9e20531740c6ff771c444 (diff) | |
download | gnuradio-a6aa6eb21209cf3004381c0c9f98b303929dac7a.tar.gz gnuradio-a6aa6eb21209cf3004381c0c9f98b303929dac7a.tar.bz2 gnuradio-a6aa6eb21209cf3004381c0c9f98b303929dac7a.zip |
show/hide param logic, usrp loopback example - neg freq
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9541 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'grc/src')
-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 |
5 files changed, 29 insertions, 34 deletions
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): |