From fbab6c383d6f86ab0de42a90a9182d22637a5b96 Mon Sep 17 00:00:00 2001
From: Volker Schroer <3470424+dl1ksv@users.noreply.github.com>
Date: Fri, 9 Jul 2021 12:11:24 +0200
Subject: grc: update disabled blocks if they depend on others

If we want disabled blocks to be updated properly,
we have to consider all blocks when updating the fg not only the enabled.

This does the patch of Flowgraph.py and fixes #4788.

But a problem remains.
If you use the example in #4788 and disable the symbol_rate block,
only the samp_rate block 'turns to red'.
The other blocks don't change.
Only if you open and close an arbitrary block, the other blocks are updated.

This is fixed by clearing the namespace in renew_namespace in FlowGraph.py.

Signed-off-by: Volker Schroer <3470424+dl1ksv@users.noreply.github.com>

grc: update disabled blocks

Signed-off-by: Volker Schroer <3470424+dl1ksv@users.noreply.github.com>
---
 grc/core/FlowGraph.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'grc/core/FlowGraph.py')

diff --git a/grc/core/FlowGraph.py b/grc/core/FlowGraph.py
index 84ca180861..5ef776d6b2 100644
--- a/grc/core/FlowGraph.py
+++ b/grc/core/FlowGraph.py
@@ -216,7 +216,7 @@ class FlowGraph(Element):
         return elements
 
     def children(self):
-        return itertools.chain(self.iter_enabled_blocks(), self.connections)
+        return itertools.chain(self.blocks, self.connections)
 
     def rewrite(self):
         """
@@ -227,6 +227,7 @@ class FlowGraph(Element):
 
     def renew_namespace(self):
         namespace = {}
+        self.namespace.clear()
         # Load imports
         for expr in self.imports():
             try:
-- 
cgit v1.2.3