diff options
author | Volker Schroer <3470424+dl1ksv@users.noreply.github.com> | 2019-07-24 11:57:52 +0200 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2019-07-25 11:07:50 +0200 |
commit | 88eb8e874c7af57b4e53eea04acb13317752e28c (patch) | |
tree | 6d933b16d4d0ee4e27f6b7f14148caa6dc453b9b /grc/gui/VariableEditor.py | |
parent | bfe0d588da527af892cc5869801ba52732f53832 (diff) |
Fix KeyError 'value' in variable blocks
Variable blocks must not have a param named value. But grc always trys to evaluate this params.
This leads to errors
Diffstat (limited to 'grc/gui/VariableEditor.py')
-rw-r--r-- | grc/gui/VariableEditor.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/grc/gui/VariableEditor.py b/grc/gui/VariableEditor.py index d9c829ebcc..f680a2dc18 100644 --- a/grc/gui/VariableEditor.py +++ b/grc/gui/VariableEditor.py @@ -192,8 +192,19 @@ class VariableEditor(Gtk.VBox): else: # Evaluate and show the value (if it is a variable) if block.is_variable: - evaluated = str(block.params['value'].evaluate()) - self.set_tooltip_text(evaluated) + # Evaluate the params + for key in block.params : + evaluated = str(block.params[key].evaluate()) + self.set_tooltip_text(evaluated) + + # Evaluate the block value + try: + evaluated = str( eval(block.value,block.parent.namespace,block.namespace)) + self.set_tooltip_text(evaluated) + except Exception as error: + self.set_tooltip_text(str(error)) + pass + # Always set the text value. sp('text', value) |