summaryrefslogtreecommitdiff
path: root/grc/python
diff options
context:
space:
mode:
authorJohnathan Corgan2009-10-15 12:02:04 -0700
committerJohnathan Corgan2009-10-15 12:02:04 -0700
commitc69f5205e13b1ae63a6e4705a892f695e57b20b3 (patch)
treeee50518a79f654244bd7866cb6ba4b761e93767f /grc/python
parentcc5253b05a49d87a81f8510188c40196b0965fad (diff)
parent25a8f7a8f09f37ea6f31ce02523170c64d71a561 (diff)
downloadgnuradio-c69f5205e13b1ae63a6e4705a892f695e57b20b3.tar.gz
gnuradio-c69f5205e13b1ae63a6e4705a892f695e57b20b3.tar.bz2
gnuradio-c69f5205e13b1ae63a6e4705a892f695e57b20b3.zip
Merge commit '25a8' from git@gnuradio.org:jblum
* commit '25a8': use clean numbers for waterfall ref and range tweaks to scope autoscaling registered key to hide/show control panel in wxgui windows Added window size param to all wxgui wrappers. add canonical options for copy enable param
Diffstat (limited to 'grc/python')
-rw-r--r--grc/python/Param.py28
1 files changed, 17 insertions, 11 deletions
diff --git a/grc/python/Param.py b/grc/python/Param.py
index 34d5ab116..81fb6ba7a 100644
--- a/grc/python/Param.py
+++ b/grc/python/Param.py
@@ -251,7 +251,7 @@ class Param(_Param, _GUIParam):
#########################
# Numeric Types
#########################
- elif t in ('raw', 'complex', 'real', 'int', 'complex_vector', 'real_vector', 'int_vector', 'hex', 'bool'):
+ elif t in ('raw', 'complex', 'real', '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)
@@ -269,10 +269,22 @@ class Param(_Param, _GUIParam):
try: assert isinstance(e, INT_TYPES)
except AssertionError: raise Exception, 'Expression "%s" is invalid for type integer.'%str(e)
return e
- #########################
- # Numeric Vector Types
- #########################
- elif t == 'complex_vector':
+ elif t == 'hex': return hex(e)
+ elif t == 'bool':
+ try: assert isinstance(e, bool)
+ except AssertionError: raise Exception, 'Expression "%s" is invalid for type bool.'%str(e)
+ return e
+ else: raise TypeError, 'Type "%s" not handled'%t
+ #########################
+ # Numeric Vector Types
+ #########################
+ elif t in ('complex_vector', 'real_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)
+ except Exception, e: raise Exception, 'Value "%s" cannot be evaluated:\n%s'%(v, e)
+ #raise an exception if the data is invalid
+ if t == 'complex_vector':
if not isinstance(e, VECTOR_TYPES):
self._lisitify_flag = True
e = [e]
@@ -296,12 +308,6 @@ class Param(_Param, _GUIParam):
for ei in e: assert isinstance(ei, INT_TYPES)
except AssertionError: raise Exception, 'Expression "%s" is invalid for type integer vector.'%str(e)
return e
- elif t == 'hex': return hex(e)
- elif t == 'bool':
- try: assert isinstance(e, bool)
- except AssertionError: raise Exception, 'Expression "%s" is invalid for type bool.'%str(e)
- return e
- else: raise TypeError, 'Type "%s" not handled'%t
#########################
# String Types
#########################