diff options
author | Tom Rondeau <trondeau@vt.edu> | 2013-03-27 15:35:20 -0400 |
---|---|---|
committer | Tom Rondeau <trondeau@vt.edu> | 2013-03-27 15:35:20 -0400 |
commit | 40ab0030dbe821c9ed475a0b73898040f4af581c (patch) | |
tree | 66ba23fbd6d04f9b74d46fdb70ea8771930931ae /grc/python/Param.py | |
parent | 9bbbda510c265b211b5b571db79ba259c67ee049 (diff) | |
parent | b7a5f16fcd559b8246a9155c6602a6b539be039e (diff) |
Merge branch 'master' into next
Diffstat (limited to 'grc/python/Param.py')
-rw-r--r-- | grc/python/Param.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/grc/python/Param.py b/grc/python/Param.py index b310468842..696f16cc94 100644 --- a/grc/python/Param.py +++ b/grc/python/Param.py @@ -94,8 +94,8 @@ class Param(_Param, _GUIParam): def get_types(self): return ( 'raw', 'enum', - 'complex', 'real', 'int', - 'complex_vector', 'real_vector', 'int_vector', + 'complex', 'real', 'float', 'int', + 'complex_vector', 'real_vector', 'float_vector', 'int_vector', 'hex', 'string', 'bool', 'file_open', 'file_save', 'id', 'stream_id', @@ -178,10 +178,12 @@ class Param(_Param, _GUIParam): #number types 'complex': Constants.COMPLEX_COLOR_SPEC, 'real': Constants.FLOAT_COLOR_SPEC, + 'float': Constants.FLOAT_COLOR_SPEC, 'int': Constants.INT_COLOR_SPEC, #vector types 'complex_vector': Constants.COMPLEX_VECTOR_COLOR_SPEC, 'real_vector': Constants.FLOAT_VECTOR_COLOR_SPEC, + 'float_vector': Constants.FLOAT_VECTOR_COLOR_SPEC, 'int_vector': Constants.INT_VECTOR_COLOR_SPEC, #special 'bool': Constants.INT_COLOR_SPEC, @@ -265,7 +267,7 @@ class Param(_Param, _GUIParam): ######################### # Numeric Types ######################### - elif t in ('raw', 'complex', 'real', 'int', 'hex', 'bool'): + elif t in ('raw', 'complex', 'real', 'float', 'int', 'hex', 'bool'): #raise exception if python cannot evaluate this value try: e = self.get_parent().get_parent().evaluate(v) except Exception, e: raise Exception, 'Value "%s" cannot be evaluated:\n%s'%(v, e) @@ -275,9 +277,9 @@ class Param(_Param, _GUIParam): if not isinstance(e, COMPLEX_TYPES): raise Exception, 'Expression "%s" is invalid for type complex.'%str(e) return e - elif t == 'real': + elif t == 'real' or t == 'float': if not isinstance(e, REAL_TYPES): - raise Exception, 'Expression "%s" is invalid for type real.'%str(e) + raise Exception, 'Expression "%s" is invalid for type float.'%str(e) return e elif t == 'int': if not isinstance(e, INT_TYPES): @@ -292,7 +294,7 @@ class Param(_Param, _GUIParam): ######################### # Numeric Vector Types ######################### - elif t in ('complex_vector', 'real_vector', 'int_vector'): + elif t in ('complex_vector', 'real_vector', 'float_vector', 'int_vector'): if not v: v = '()' #turn a blank string into an empty list, so it will eval #raise exception if python cannot evaluate this value try: e = self.get_parent().get_parent().evaluate(v) @@ -305,12 +307,12 @@ class Param(_Param, _GUIParam): if not all([isinstance(ei, COMPLEX_TYPES) for ei in e]): raise Exception, 'Expression "%s" is invalid for type complex vector.'%str(e) return e - elif t == 'real_vector': + elif t == 'real_vector' or t == 'float_vector': if not isinstance(e, VECTOR_TYPES): self._lisitify_flag = True e = [e] if not all([isinstance(ei, REAL_TYPES) for ei in e]): - raise Exception, 'Expression "%s" is invalid for type real vector.'%str(e) + raise Exception, 'Expression "%s" is invalid for type float vector.'%str(e) return e elif t == 'int_vector': if not isinstance(e, VECTOR_TYPES): @@ -453,7 +455,7 @@ class Param(_Param, _GUIParam): if not self._init: self.evaluate() if self._stringify_flag: return '"%s"'%v.replace('"', '\"') else: return v - elif t in ('complex_vector', 'real_vector', 'int_vector'): #vector types + elif t in ('complex_vector', 'real_vector', 'float_vector', 'int_vector'): #vector types if not self._init: self.evaluate() if self._lisitify_flag: return '(%s, )'%v else: return '(%s)'%v |