summaryrefslogtreecommitdiff
path: root/grc/python
diff options
context:
space:
mode:
Diffstat (limited to 'grc/python')
-rw-r--r--grc/python/Param.py31
-rw-r--r--grc/python/Port.py8
2 files changed, 17 insertions, 22 deletions
diff --git a/grc/python/Param.py b/grc/python/Param.py
index dd18d1c44..d574b513e 100644
--- a/grc/python/Param.py
+++ b/grc/python/Param.py
@@ -83,30 +83,27 @@ COMPLEX_TYPES = tuple(COMPLEX_TYPES + REAL_TYPES + INT_TYPES)
REAL_TYPES = tuple(REAL_TYPES + INT_TYPES)
INT_TYPES = tuple(INT_TYPES)
-##possible param types
-TYPES = [
- 'raw', 'enum',
- 'complex', 'real', 'int',
- 'complex_vector', 'real_vector', 'int_vector',
- 'hex', 'string', 'bool',
- 'file_open', 'file_save',
- 'id', 'stream_id',
- 'grid_pos', 'notebook',
- 'import',
-]
-
class Param(_Param):
- _init = False
- _hostage_cells = list()
-
- def __init__(self, block, n, **kwargs):
+ def __init__(self, block, n):
_Param.__init__(
self,
block=block,
n=n,
- types=TYPES,
)
+ self._init = False
+ self._hostage_cells = list()
+
+ def get_types(self): return (
+ 'raw', 'enum',
+ 'complex', 'real', 'int',
+ 'complex_vector', 'real_vector', 'int_vector',
+ 'hex', 'string', 'bool',
+ 'file_open', 'file_save',
+ 'id', 'stream_id',
+ 'grid_pos', 'notebook',
+ 'import',
+ )
def __repr__(self):
"""
diff --git a/grc/python/Port.py b/grc/python/Port.py
index 3214d937a..a714844ef 100644
--- a/grc/python/Port.py
+++ b/grc/python/Port.py
@@ -49,12 +49,9 @@ def _get_source_from_virtual_source_port(vsp, traversed=[]):
)
except: raise Exception, 'Could not resolve source for virtual source port %s'%vsp
-##possible port types
-TYPES = ['complex', 'float', 'int', 'short', 'byte', 'msg', '']
-
class Port(_Port):
- def __init__(self, block, n, dir, **kwargs):
+ def __init__(self, block, n, dir):
"""
Make a new port from nested data.
@param block the parent element
@@ -75,12 +72,13 @@ class Port(_Port):
block=block,
n=n,
dir=dir,
- types=TYPES,
)
self._nports = n.find('nports') or ''
self._vlen = n.find('vlen') or ''
self._optional = bool(n.find('optional'))
+ def get_types(self): return ('complex', 'float', 'int', 'short', 'byte', 'msg', '')
+
def validate(self):
_Port.validate(self)
try: assert self.get_enabled_connections() or self.get_optional()