diff options
author | 2018-04-24 17:36:11 +0200 | |
---|---|---|
committer | 2018-04-28 15:44:54 +0200 | |
commit | dbdd204ccd3e4d174f4390bcd0948f33f1a8bf0d (patch) | |
tree | 2ca38945dd8afd71c0fee5b8fd72fc46c56c6368 | |
parent | added GRC fix, boost 1.67 compat, Clang regex to changelog (diff) | |
download | gnuradio-dbdd204ccd3e4d174f4390bcd0948f33f1a8bf0d.tar.xz gnuradio-dbdd204ccd3e4d174f4390bcd0948f33f1a8bf0d.zip |
grc: make values of param type gui_hint callable again
The templating for gui_hint was changed in #1418 breaking some oot modules.
-rw-r--r-- | grc/core/Param.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/grc/core/Param.py b/grc/core/Param.py index 31465c7ed..7565703a6 100644 --- a/grc/core/Param.py +++ b/grc/core/Param.py @@ -76,6 +76,17 @@ def num_to_str(num): return str(num) +class CallableString(str): + """A string that perform old-style formatting when called + + Used as an adaptor for templates with gui_hint params + ToDo: remove this in the YAML/Mako format + """ + + def __call__(self, *args): + return self % args + + class Option(Element): def __init__(self, param, n): @@ -533,10 +544,10 @@ class Param(Element): # GUI Position/Hint ######################### elif t == 'gui_hint': - if (self.get_parent().get_state() == Constants.BLOCK_DISABLED): + if self.get_parent().get_state() == Constants.BLOCK_DISABLED: return '' else: - return self.parse_gui_hint(v) + return CallableString(self.parse_gui_hint(v)) ######################### # Grid Position Type ######################### @@ -817,7 +828,7 @@ class Param(Element): else: layout = 'top_grid_layout' - widget = '%s' # to be fill-out in the mail template + widget = '%s' # to be fill-out in the main template if pos: row, col, row_span, col_span = parse_pos() |