summaryrefslogtreecommitdiff
path: root/grc/src/platforms
diff options
context:
space:
mode:
Diffstat (limited to 'grc/src/platforms')
-rw-r--r--grc/src/platforms/base/Param.py2
-rw-r--r--grc/src/platforms/gui/Block.py3
-rw-r--r--grc/src/platforms/gui/FlowGraph.py33
-rw-r--r--grc/src/platforms/python/Param.py18
4 files changed, 28 insertions, 28 deletions
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):