diff options
Diffstat (limited to 'grc/base/Block.py')
-rw-r--r-- | grc/base/Block.py | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/grc/base/Block.py b/grc/base/Block.py index 5a91810b7d..c440f00b6b 100644 --- a/grc/base/Block.py +++ b/grc/base/Block.py @@ -56,11 +56,11 @@ class Block(Element): def __init__(self, flow_graph, n): """ Make a new block from nested data. - + Args: flow: graph the parent element n: the nested odict - + Returns: block a new block """ @@ -177,7 +177,7 @@ class Block(Element): def back_ofthe_bus(self, portlist): portlist.sort(key=lambda a: a.get_type() == 'bus'); - def filter_bus_port(self, ports): + def filter_bus_port(self, ports): buslist = [i for i in ports if i.get_type() == 'bus']; if len(buslist) == 0: return ports; @@ -187,7 +187,7 @@ class Block(Element): def get_enabled(self): """ Get the enabled state of the block. - + Returns: true for enabled """ @@ -197,7 +197,7 @@ class Block(Element): def set_enabled(self, enabled): """ Set the enabled state of the block. - + Args: enabled: true for enabled """ @@ -225,11 +225,11 @@ class Block(Element): def get_param_keys(self): return _get_keys(self._params) def get_param(self, key): return _get_elem(self._params, key) def get_params(self): return self._params - def has_param(self, key): - try: - _get_elem(self._params, key); - return True; - except: + def has_param(self, key): + try: + _get_elem(self._params, key); + return True; + except: return False; ############################################## @@ -246,7 +246,7 @@ class Block(Element): def get_source_keys(self): return _get_keys(self._sources) def get_source(self, key): return _get_elem(self._sources, key) def get_sources(self): return self._sources - def get_sources_gui(self): return self.filter_bus_port(self.get_sources()); + def get_sources_gui(self): return self.filter_bus_port(self.get_sources()); def get_connections(self): return sum([port.get_connections() for port in self.get_ports()], []) @@ -254,10 +254,10 @@ class Block(Element): def resolve_dependencies(self, tmpl): """ Resolve a paramater dependency with cheetah templates. - + Args: tmpl: the string with dependencies - + Returns: the resolved value """ @@ -273,10 +273,10 @@ class Block(Element): def type_controller_modify(self, direction): """ Change the type controller. - + Args: direction: +1 or -1 - + Returns: true for change """ @@ -302,10 +302,10 @@ class Block(Element): def port_controller_modify(self, direction): """ Change the port controller. - + Args: direction: +1 or -1 - + Returns: true for change """ @@ -323,7 +323,7 @@ class Block(Element): struct = [range(len(get_p()))]; if True in map(lambda a: isinstance(a.get_nports(), int), get_p()): - + structlet = []; last = 0; @@ -332,7 +332,7 @@ class Block(Element): last = structlet[-1] + 1; struct = [structlet]; if bus_structure: - + struct = bus_structure self.current_bus_structure[direc] = struct; @@ -353,10 +353,10 @@ class Block(Element): for connect in elt.get_connections(): self.get_parent().remove_element(connect); - - - - + + + + if (not 'bus' in map(lambda a: a.get_type(), get_p())) and len(get_p()) > 0: @@ -364,16 +364,16 @@ class Block(Element): self.current_bus_structure[direc] = struct; if get_p()[0].get_nports(): n['nports'] = str(1); - + for i in range(len(struct)): n['key'] = str(len(get_p())); n = odict(n); port = self.get_parent().get_parent().Port(block=self, n=n, dir=direc); get_p().append(port); - - - + + + elif 'bus' in map(lambda a: a.get_type(), get_p()): for elt in get_p_gui(): get_p().remove(elt); @@ -384,7 +384,7 @@ class Block(Element): def export_data(self): """ Export this block's params to nested data. - + Returns: a nested data odict """ @@ -405,7 +405,7 @@ class Block(Element): call rewrite, and repeat the load until the params stick. This call to rewrite will also create any dynamic ports that are needed for the connections creation phase. - + Args: n: the nested data odict """ |