summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Quaresma2012-05-03 12:50:39 -0400
committerTom Rondeau2012-05-03 12:50:39 -0400
commitf4da804ea3dde5e376e520769a93f80545670208 (patch)
tree489751663f088de914906e925c4d4937f3617758
parent05b2c02f17d790df4896fcfb85c4020748f25747 (diff)
downloadgnuradio-f4da804ea3dde5e376e520769a93f80545670208.tar.gz
gnuradio-f4da804ea3dde5e376e520769a93f80545670208.tar.bz2
gnuradio-f4da804ea3dde5e376e520769a93f80545670208.zip
GRC: patch to allow users to specify max_noutput_items in GRC options block.
-rw-r--r--gr-wxgui/grc/top_block_gui.py8
-rw-r--r--grc/blocks/options.xml17
-rw-r--r--grc/python/flow_graph.tmpl16
3 files changed, 39 insertions, 2 deletions
diff --git a/gr-wxgui/grc/top_block_gui.py b/gr-wxgui/grc/top_block_gui.py
index 333ccf1c1..479f55a30 100644
--- a/gr-wxgui/grc/top_block_gui.py
+++ b/gr-wxgui/grc/top_block_gui.py
@@ -48,7 +48,7 @@ class top_block_gui(gr.top_block):
def SetIcon(self, *args, **kwargs): self._frame.SetIcon(*args, **kwargs)
- def Run(self, start=True):
+ def Run(self, start=True, max_nouts=0):
"""
Setup the wx gui elements.
Start the gr top block.
@@ -69,6 +69,10 @@ class top_block_gui(gr.top_block):
self._frame.Show(True)
self._app.SetTopWindow(self._frame)
#start flow graph
- if start: self.start()
+ if start:
+ if max_nouts != 0:
+ self.start(max_nouts)
+ else:
+ self.start()
#blocking main loop
self._app.MainLoop()
diff --git a/grc/blocks/options.xml b/grc/blocks/options.xml
index b27ea900c..1cf0b7707 100644
--- a/grc/blocks/options.xml
+++ b/grc/blocks/options.xml
@@ -125,6 +125,19 @@ else: self.stop(); self.wait()</callback>
</option>
</param>
<param>
+ <name>Max Number of Output</name>
+ <key>max_nouts</key>
+ <value>0</value>
+ <type>int</type>
+ <hide>#if $generate_options() == 'hb'
+all#slurp
+#elif $max_nouts()
+none#slurp
+#else
+part#slurp
+#end if</hide>
+ </param>
+ <param>
<name>Realtime Scheduling</name>
<key>realtime_scheduling</key>
<value></value>
@@ -169,5 +182,9 @@ For example, an id of my_block will generate the file my_block.py and class my_b
The category parameter determines the placement of the block in the block selection window. \
The category only applies when creating hier blocks. \
To put hier blocks into the root category, enter / for the category.
+
+The Max Number of Output is the maximum number of output items allowed for any block \
+in the flowgraph; to disable this set the max_nouts equal to 0.\
+Use this to adjust the maximum latency a flowgraph can exhibit.
</doc>
</block>
diff --git a/grc/python/flow_graph.tmpl b/grc/python/flow_graph.tmpl
index 0878be4ba..17feb01f6 100644
--- a/grc/python/flow_graph.tmpl
+++ b/grc/python/flow_graph.tmpl
@@ -244,12 +244,20 @@ if __name__ == '__main__':
#end if
#if $generate_options == 'wx_gui'
tb = $(class_name)($(', '.join($params_eq_list)))
+ #if $flow_graph.get_option('max_nouts')
+ tb.Run($flow_graph.get_option('run'), $flow_graph.get_option('max_nouts'))
+ #else
tb.Run($flow_graph.get_option('run'))
+ #end if
#elif $generate_options == 'qt_gui'
qapp = Qt.QApplication(sys.argv)
tb = $(class_name)($(', '.join($params_eq_list)))
#if $flow_graph.get_option('run')
+ #if $flow_graph.get_option('max_nouts')
+ tb.start($flow_graph.get_option('max_nouts'))
+ #else
tb.start()
+ #end if
#end if
tb.show()
qapp.exec_()
@@ -258,11 +266,19 @@ if __name__ == '__main__':
tb = $(class_name)($(', '.join($params_eq_list)))
#set $run_options = $flow_graph.get_option('run_options')
#if $run_options == 'prompt'
+ #if $flow_graph.get_option('max_nouts')
+ tb.start($flow_graph.get_option('max_nouts'))
+ #else
tb.start()
+ #end if
raw_input('Press Enter to quit: ')
tb.stop()
#elif $run_options == 'run'
+ #if $flow_graph.get_option('max_nouts')
+ tb.run($flow_graph.get_option('max_nouts'))
+ #else
tb.run()
+ #end if
#end if
#end if
#end if