summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Koslowski <sebastian.koslowski@gmail.com>2018-04-24 17:36:11 +0200
committerSebastian Koslowski <sebastian.koslowski@gmail.com>2018-04-24 22:08:43 +0200
commit6ef5a5bd9a19398f7e75c010d23590823a3df38a (patch)
tree06ccfd190a3c19abefb12d65dcc61a31a29575d0
parent1070e3bbbf0d288c5b6950200dfdfbaa5362d6c8 (diff)
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.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/grc/core/Param.py b/grc/core/Param.py
index 01697919d0..f54a16ed9f 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
#########################
@@ -813,7 +824,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()