diff options
author | Josh Morman <jmorman@gnuradio.org> | 2021-11-24 12:48:20 -0500 |
---|---|---|
committer | mormj <34754695+mormj@users.noreply.github.com> | 2021-11-24 14:41:53 -0500 |
commit | 817fc3ce9cdc819a291e76ec324c4e748381f035 (patch) | |
tree | ed00faf5ea2c0f5a8caaba0ce41cd816dd6ca958 /grc/gui/canvas/param.py | |
parent | e776d673aa51b5ef19e16cfb6d22098c0b14a679 (diff) |
grc: pep8 formatting
Signed-off-by: Josh Morman <jmorman@gnuradio.org>
Diffstat (limited to 'grc/gui/canvas/param.py')
-rw-r--r-- | grc/gui/canvas/param.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/grc/gui/canvas/param.py b/grc/gui/canvas/param.py index 6b33ef223c..488ca7a5c3 100644 --- a/grc/gui/canvas/param.py +++ b/grc/gui/canvas/param.py @@ -86,20 +86,20 @@ class Param(CoreParam): tooltip_lines.extend(' * ' + msg for msg in errors) return '\n'.join(tooltip_lines) - - ################################################## # Truncate helper method ################################################## + def truncate(self, string, style=0): max_len = max(27 - len(self.name), 3) if len(string) > max_len: if style < 0: # Front truncate - string = '...' + string[3-max_len:] + string = '...' + string[3 - max_len:] elif style == 0: # Center truncate - string = string[:max_len//2 - 3] + '...' + string[-max_len//2:] + string = string[:max_len // 2 - 3] + \ + '...' + string[-max_len // 2:] elif style > 0: # Rear truncate - string = string[:max_len-3] + '...' + string = string[:max_len - 3] + '...' return string def pretty_print(self): @@ -183,5 +183,5 @@ class Param(CoreParam): display_value = expr_string return '<span {foreground} font_desc="{font}"><b>{label}:</b> {value}</span>'.format( - foreground='foreground="red"' if not self.is_valid() else '', font=Constants.PARAM_FONT, + foreground='foreground="red"' if not self.is_valid() else '', font=Constants.PARAM_FONT, label=Utils.encode(self.name), value=display_value) |