From b7a5f16fcd559b8246a9155c6602a6b539be039e Mon Sep 17 00:00:00 2001
From: Tom Rondeau <trondeau@vt.edu>
Date: Wed, 27 Mar 2013 15:34:53 -0400
Subject: grc: made 'float' an acceptable alias to 'real' in parameter types.

---
 grc/python/Param.py | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

(limited to 'grc/python/Param.py')

diff --git a/grc/python/Param.py b/grc/python/Param.py
index 2caca48024..3236441a86 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',
@@ -174,10 +174,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,
@@ -257,7 +259,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)
@@ -267,9 +269,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):
@@ -284,7 +286,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)
@@ -297,12 +299,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):
@@ -443,7 +445,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
-- 
cgit v1.2.3