summaryrefslogtreecommitdiff
path: root/grc/core
diff options
context:
space:
mode:
authorJohnathan Corgan <johnathan@corganlabs.com>2017-08-03 15:01:46 -0700
committerJohnathan Corgan <johnathan@corganlabs.com>2017-08-03 15:01:46 -0700
commit41e1a272e6794feb4d58fed9807d409bd1930c01 (patch)
treed254831fe61361eb52d1b6176873ca547ef32786 /grc/core
parente776f1e7196a7543de240b88005b26a02a4c87af (diff)
parentf9dd0a8a347e97e08bc7644f0467e58dcaf1ca66 (diff)
Merge branch 'next' into python3
Conflicts: grc/core/Param.py grc/gui/Application.py grc/gui/NotebookPage.py
Diffstat (limited to 'grc/core')
-rw-r--r--grc/core/Param.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/grc/core/Param.py b/grc/core/Param.py
index e8c81383f3..a1e4c782fb 100644
--- a/grc/core/Param.py
+++ b/grc/core/Param.py
@@ -54,10 +54,19 @@ class TemplateArg(str):
setattr(instance, '_param', param)
return instance
+ def __getitem__(self, item):
+ return str(self._param.get_opt(item)) if self._param.is_enum() else NotImplemented
+
def __getattr__(self, item):
- param = self._param
- attributes = param.options.attributes[param.get_value()]
- return str(attributes.get(item)) or NotImplemented
+ if not self._param.is_enum():
+ raise AttributeError()
+ try:
+ return str(self._param.get_opt(item))
+ except KeyError:
+ raise AttributeError()
+
+ def __str__(self):
+ return str(self._param.to_code())
def __call__(self):
return self._param.get_evaluated()