summaryrefslogtreecommitdiff
path: root/grc/python
diff options
context:
space:
mode:
authorTom2009-10-06 10:40:39 -0700
committerTom2009-10-06 10:40:39 -0700
commitbbd3df51732b2b63ae9d20e9fddd12229cf6b2ef (patch)
treedbf63fb638238e389ad970f2f4443299491e8fc6 /grc/python
parent314726ae7457b37f442a2751285b75b0d616c0f4 (diff)
parent3f8026a00c261c788357b3a04f5b338a6cda4d0e (diff)
downloadgnuradio-bbd3df51732b2b63ae9d20e9fddd12229cf6b2ef.tar.gz
gnuradio-bbd3df51732b2b63ae9d20e9fddd12229cf6b2ef.tar.bz2
gnuradio-bbd3df51732b2b63ae9d20e9fddd12229cf6b2ef.zip
Merge branch 'master' into sync
Conflicts: gr-utils/src/python/gr_plot_qt.py gr-utils/src/python/pyqt_plot.py gr-utils/src/python/pyqt_plot.ui
Diffstat (limited to 'grc/python')
-rw-r--r--grc/python/FlowGraph.py1
-rw-r--r--grc/python/Param.py10
-rw-r--r--grc/python/Port.py2
-rw-r--r--grc/python/flow_graph.tmpl5
4 files changed, 12 insertions, 6 deletions
diff --git a/grc/python/FlowGraph.py b/grc/python/FlowGraph.py
index 6b2936c75..4dd18a81f 100644
--- a/grc/python/FlowGraph.py
+++ b/grc/python/FlowGraph.py
@@ -42,6 +42,7 @@ class FlowGraph(_FlowGraph, _GUIFlowGraph):
@param namespace_hash a unique hash for the namespace
@return the resultant object
"""
+ if not code: raise Exception, 'Cannot evaluate empty statement.'
my_hash = hash(code) ^ namespace_hash
#cache if does not exist
if not self._eval_cache.has_key(my_hash):
diff --git a/grc/python/Param.py b/grc/python/Param.py
index e61779136..34d5ab116 100644
--- a/grc/python/Param.py
+++ b/grc/python/Param.py
@@ -153,9 +153,9 @@ class Param(_Param, _GUIParam):
dt_str = dt_str[:max_len-3] + '...'
return dt_str
- def get_input_class(self):
- if self.get_type() in ('file_open', 'file_save'): return FileParam
- return _GUIParam.get_input_class(self)
+ def get_input(self, *args, **kwargs):
+ if self.get_type() in ('file_open', 'file_save'): return FileParam(self, *args, **kwargs)
+ return _GUIParam.get_input(self, *args, **kwargs)
def get_color(self):
"""
@@ -254,7 +254,7 @@ class Param(_Param, _GUIParam):
elif t in ('raw', 'complex', 'real', 'int', 'complex_vector', 'real_vector', 'int_vector', '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: %s'%(v, e)
+ except Exception, e: raise Exception, 'Value "%s" cannot be evaluated:\n%s'%(v, e)
#raise an exception if the data is invalid
if t == 'raw': return e
elif t == 'complex':
@@ -385,7 +385,7 @@ class Param(_Param, _GUIParam):
try: notebook_block = filter(lambda b: b.get_id() == notebook_id, notebook_blocks)[0]
except: raise Exception, 'Notebook id "%s" is not an existing notebook id.'%notebook_id
#check that page index exists
- try: assert int(page_index) in range(len(notebook_block.get_param('labels').get_evaluated()))
+ try: assert int(page_index) in range(len(notebook_block.get_param('labels').evaluate()))
except: raise Exception, 'Page index "%s" is not a valid index number.'%page_index
return notebook_id, page_index
#########################
diff --git a/grc/python/Port.py b/grc/python/Port.py
index 33426d905..6965371df 100644
--- a/grc/python/Port.py
+++ b/grc/python/Port.py
@@ -45,7 +45,7 @@ def _get_source_from_virtual_source_port(vsp, traversed=[]):
lambda b: b.is_virtual_sink(),
vsp.get_parent().get_parent().get_enabled_blocks(),
),
- )[0].get_sink(vsp.get_key())
+ )[0].get_sinks()[0]
), traversed + [vsp],
)
except: raise Exception, 'Could not resolve source for virtual source port %s'%vsp
diff --git a/grc/python/flow_graph.tmpl b/grc/python/flow_graph.tmpl
index dce4037d5..31d99a61c 100644
--- a/grc/python/flow_graph.tmpl
+++ b/grc/python/flow_graph.tmpl
@@ -233,9 +233,14 @@ if __name__ == '__main__':
#if $generate_options == 'wx_gui'
tb.Run($flow_graph.get_option('run'))
#elif $generate_options == 'no_gui'
+ #set $run_options = $flow_graph.get_option('run_options')
+ #if $run_options == 'prompt'
tb.start()
raw_input('Press Enter to quit: ')
tb.stop()
+ #elif $run_options == 'run'
+ tb.run()
+ #end if
#end if
#end if