diff options
author | Sebastian Koslowski <sebastian.koslowski@gmail.com> | 2016-05-03 17:13:08 +0200 |
---|---|---|
committer | Johnathan Corgan <johnathan@corganlabs.com> | 2017-06-29 09:16:49 -0700 |
commit | 7f7fa2f91467fdb2b11312be8562e7b51fdeb199 (patch) | |
tree | 24268bac15b9920d2a15ddbb45eaf3b9b03718a1 /grc/gui/canvas/param.py | |
parent | 44cae388881821942e691a4d69a923bbd8d347db (diff) |
grc: added yaml/mako support
Includes basic converter from XML/Cheetah to YAML/Mako based block format.
Diffstat (limited to 'grc/gui/canvas/param.py')
-rw-r--r-- | grc/gui/canvas/param.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/grc/gui/canvas/param.py b/grc/gui/canvas/param.py index b027b7653a..e2c335d9cf 100644 --- a/grc/gui/canvas/param.py +++ b/grc/gui/canvas/param.py @@ -39,20 +39,20 @@ class Param(CoreParam): Returns: gtk input class """ - type_ = self.get_type() - if type_ in ('file_open', 'file_save'): + dtype = self.dtype + if dtype in ('file_open', 'file_save'): input_widget_cls = ParamWidgets.FileParam - elif self.is_enum(): + elif dtype == 'enum': input_widget_cls = ParamWidgets.EnumParam elif self.options: input_widget_cls = ParamWidgets.EnumEntryParam - elif type_ == '_multiline': + elif dtype == '_multiline': input_widget_cls = ParamWidgets.MultiLineEntryParam - elif type_ == '_multiline_python_external': + elif dtype == '_multiline_python_external': input_widget_cls = ParamWidgets.PythonEditorParam else: @@ -64,8 +64,8 @@ class Param(CoreParam): block = self.parent # fixme: using non-public attribute here has_callback = \ - hasattr(block, 'get_callbacks') and \ - any(self.key in callback for callback in block._callbacks) + hasattr(block, 'templates') and \ + any(self.key in callback for callback in block.templates.get('callbacks', '')) return '<span {underline} {foreground} font_desc="Sans 9">{label}</span>'.format( underline='underline="low"' if has_callback else '', @@ -76,7 +76,7 @@ class Param(CoreParam): def format_tooltip_text(self): errors = self.get_error_messages() - tooltip_lines = ['Key: ' + self.key, 'Type: ' + self.get_type()] + tooltip_lines = ['Key: ' + self.key, 'Type: ' + self.dtype] if self.is_valid(): value = str(self.get_evaluated()) if len(value) > 100: @@ -117,7 +117,7 @@ class Param(CoreParam): if not self.is_valid(): return _truncate(value) if value in self.options: - return self.options_names[self.options.index(value)] + return self.options[value] # its name ################################################## # Split up formatting by type @@ -125,7 +125,7 @@ class Param(CoreParam): # Default center truncate truncate = 0 e = self.get_evaluated() - t = self.get_type() + t = self.dtype if isinstance(e, bool): return str(e) elif isinstance(e, Constants.COMPLEX_TYPES): |