diff options
Diffstat (limited to 'grc/base/FlowGraph.py')
-rw-r--r-- | grc/base/FlowGraph.py | 38 |
1 files changed, 2 insertions, 36 deletions
diff --git a/grc/base/FlowGraph.py b/grc/base/FlowGraph.py index 7fd8df5f64..52ec741db8 100644 --- a/grc/base/FlowGraph.py +++ b/grc/base/FlowGraph.py @@ -147,7 +147,7 @@ class FlowGraph(Element): def get_enabled_blocks(self): """ - Get a list of all blocks that are enabled. + Get a list of all blocks that are enabled and not bypassed. Returns: a list of blocks @@ -170,41 +170,7 @@ class FlowGraph(Element): Returns: a list of connections """ - # First get all the enabled connections, then get the bypassed blocks. - connections = filter(lambda c: c.get_enabled(), self.get_connections()) - bypassed_blocks = self.get_bypassed_blocks() - - # Bypassing blocks: Need to find all the enabled connections for the block using - # the *connections* object rather than get_connections(). Create new connections - # that bypass the selected block and remove the existing ones. This allows adjacent - # bypassed blocks to see the newly created connections to downstream blocks, - # allowing them to correctly construct bypass connections. - - for block in bypassed_blocks: - # Get the upstream connection (off of the sink ports) - # Use *connections* not get_connections() - get_source_connection = lambda c: c.get_sink() == block.get_sinks()[0] - source_connection = filter(get_source_connection, connections) - # The source connection should never have more than one element. - assert (len(source_connection) == 1) - - # Get the source of the connection. - source_port = source_connection[0].get_source() - - # Loop through all the downstream connections - get_sink_connections = lambda c: c.get_source() == block.get_sources()[0] - for sink in filter(get_sink_connections, connections): - if not sink.get_enabled(): - # Ignore disabled connections - continue - sink_port = sink.get_sink() - connection = self.get_parent().Connection(flow_graph=self, porta=source_port, portb=sink_port) - connections.append(connection) - # Remove this sink connection - connections.remove(sink) - # Remove the source connection - connections.remove(source_connection[0]) - return connections + return filter(lambda c: c.get_enabled(), self.get_connections()) def get_new_block(self, key): """ |