From aa8f15d6408b0a2b70b6a012c53b8cf0bd955b9c Mon Sep 17 00:00:00 2001 From: ewxl <elof@wecksell.se> Date: Tue, 21 Apr 2020 14:45:32 +0200 Subject: grc: add length to tooltip for variable with len Improving the module grc.gui.canvas.param to add length to tooltip of attributes of a block in grc. --- grc/gui/canvas/param.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'grc/gui/canvas/param.py') diff --git a/grc/gui/canvas/param.py b/grc/gui/canvas/param.py index 4277bfe665..b612902928 100644 --- a/grc/gui/canvas/param.py +++ b/grc/gui/canvas/param.py @@ -67,7 +67,10 @@ class Param(CoreParam): errors = self.get_error_messages() tooltip_lines = ['Key: ' + self.key, 'Type: ' + self.dtype] if self.is_valid(): - value = str(self.get_evaluated()) + value = self.get_evaluated() + if hasattr(value,"__len__"): + tooltip_lines.append('Length: {}'.format(len(value))) + value = str(value) if len(value) > 100: value = '{}...{}'.format(value[:50], value[-50:]) tooltip_lines.append('Value: ' + value) -- cgit v1.2.3