diff options
Diffstat (limited to 'grc')
-rw-r--r-- | grc/base/Element.py | 12 | ||||
-rw-r--r-- | grc/base/FlowGraph.py | 3 | ||||
-rw-r--r-- | grc/base/Param.py | 4 | ||||
-rw-r--r-- | grc/python/FlowGraph.py | 13 |
4 files changed, 11 insertions, 21 deletions
diff --git a/grc/base/Element.py b/grc/base/Element.py index 87cedb37f..02b57df3a 100644 --- a/grc/base/Element.py +++ b/grc/base/Element.py @@ -21,7 +21,6 @@ class Element(object): def __init__(self, parent=None): self._parent = parent - self.flag() def test(self): """ @@ -45,17 +44,6 @@ class Element(object): def get_parent(self): return self._parent ############################################## - ## Update flagging - ############################################## - def is_flagged(self): return self._flag - def flag(self): - self._flag = True - if self.get_parent(): self.get_parent().flag() - def deflag(self): - self._flag = False - if self.get_parent(): self.get_parent().deflag() - - ############################################## ## Type testing methods ############################################## def is_element(self): return True diff --git a/grc/base/FlowGraph.py b/grc/base/FlowGraph.py index 9252f3668..b24f13b09 100644 --- a/grc/base/FlowGraph.py +++ b/grc/base/FlowGraph.py @@ -102,7 +102,6 @@ class FlowGraph(Element): @param key the block key @return the new block or None if not found """ - self.flag() if key not in self.get_parent().get_block_keys(): return None block = self.get_parent().get_new_block(self, key) self.get_elements().append(block) @@ -116,7 +115,6 @@ class FlowGraph(Element): @throw Exception bad connection @return the new connection """ - self.flag() connection = self.get_parent().Connection(flow_graph=self, porta=porta, portb=portb) self.get_elements().append(connection) return connection @@ -128,7 +126,6 @@ class FlowGraph(Element): If the element is a block, remove its connections. If the element is a connection, just remove the connection. """ - self.flag() if element not in self.get_elements(): return #found a port, set to parent signal block if element.is_port(): diff --git a/grc/base/Param.py b/grc/base/Param.py index 9279e736b..eb7a57f51 100644 --- a/grc/base/Param.py +++ b/grc/base/Param.py @@ -146,9 +146,7 @@ class Param(Element): self.set_value(value) return value - def set_value(self, value): - self.flag() - self._value = str(value) #must be a string + def set_value(self, value): self._value = str(value) #must be a string def get_type(self): return self.get_parent().resolve_dependencies(self._type) def is_enum(self): return self._type == 'enum' diff --git a/grc/python/FlowGraph.py b/grc/python/FlowGraph.py index 96188b816..6b2936c75 100644 --- a/grc/python/FlowGraph.py +++ b/grc/python/FlowGraph.py @@ -32,8 +32,8 @@ class FlowGraph(_FlowGraph, _GUIFlowGraph): def __init__(self, **kwargs): _FlowGraph.__init__(self, **kwargs) _GUIFlowGraph.__init__(self) + self._eval_cache = dict() - _eval_cache = dict() def _eval(self, code, namespace, namespace_hash): """ Evaluate the code with the given namespace. @@ -114,6 +114,13 @@ class FlowGraph(_FlowGraph, _GUIFlowGraph): parameters = filter(lambda b: _parameter_matcher.match(b.get_key()), self.get_enabled_blocks()) return parameters + def rewrite(self): + """ + Flag the namespace to be renewed. + """ + self._renew_eval_ns = True + _FlowGraph.rewrite(self) + def evaluate(self, expr): """ Evaluate the expression. @@ -121,8 +128,8 @@ class FlowGraph(_FlowGraph, _GUIFlowGraph): @throw Exception bad expression @return the evaluated data """ - if self.is_flagged(): - self.deflag() + if self._renew_eval_ns: + self._renew_eval_ns = False #reload namespace n = dict() #load imports |