diff options
Diffstat (limited to 'include/gras')
-rw-r--r-- | include/gras/block.i | 3 | ||||
-rw-r--r-- | include/gras/hier_block.i | 15 |
2 files changed, 18 insertions, 0 deletions
diff --git a/include/gras/block.i b/include/gras/block.i index 0fed36d..8daa55a 100644 --- a/include/gras/block.i +++ b/include/gras/block.i @@ -28,6 +28,9 @@ from PMC import * { %insert("python") %{ + def __getattr__(self, name): + return lambda *args: self.x(name, *args) + def post_output_msg(self, which_output, value): if not isinstance(value, PMCC): value = PMC_M(value) self._post_output_msg(which_output, value) diff --git a/include/gras/hier_block.i b/include/gras/hier_block.i index e3f8182..f89252e 100644 --- a/include/gras/hier_block.i +++ b/include/gras/hier_block.i @@ -12,4 +12,19 @@ %import <gras/element.i> %include <gras/hier_block.hpp> +//////////////////////////////////////////////////////////////////////// +// Create pythonic methods +//////////////////////////////////////////////////////////////////////// +%pythoncode %{ +from PMC import * +%} +%extend gras::HierBlock +{ + %insert("python") + %{ + def __getattr__(self, name): + return lambda *args: self.x(name, *args) + %} +} + #endif /*INCLUDED_GRAS_HIER_BLOCK_I*/ |