summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Torborg <storborg@gmail.com>2018-07-16 08:06:01 -0700
committerMartin Braun <martin.braun@ettus.com>2020-01-05 16:07:47 -0800
commit7e961e4efd249e6509f2b3ec8cef592dfb1d0b87 (patch)
tree1438ff859032b31ba5e37c2910f75f9b2a92b7c5
parentb0a26eeb4d8a4e0233f30e7137ec4c13391ca2b1 (diff)
grc: Add handling of catch_exceptions top_block param
Adds an additional option to the flowgraph's "Generate Options" in GRC called "Catch block exceptions", under the Advanced tab. This parameter controls the catch_exceptions flag passed to top block instantiation.
-rw-r--r--grc/blocks/options.block.yml6
-rw-r--r--grc/core/generator/flow_graph.py.mako6
-rw-r--r--grc/core/generator/top_block.py3
3 files changed, 11 insertions, 4 deletions
diff --git a/grc/blocks/options.block.yml b/grc/blocks/options.block.yml
index 5b4c34babb..7d5d0389f8 100644
--- a/grc/blocks/options.block.yml
+++ b/grc/blocks/options.block.yml
@@ -110,6 +110,12 @@ parameters:
options: ['', '1']
option_labels: ['Off', 'On']
hide: part
+- id: catch_exceptions
+ label: Catch Block Exceptions
+ category: Advanced
+ dtype: bool
+ default: 'True'
+ hide: part
- id: run_command
label: Run Command
category: Advanced
diff --git a/grc/core/generator/flow_graph.py.mako b/grc/core/generator/flow_graph.py.mako
index 3fb540d8d1..7e731d1a9d 100644
--- a/grc/core/generator/flow_graph.py.mako
+++ b/grc/core/generator/flow_graph.py.mako
@@ -58,7 +58,7 @@ from gnuradio import qtgui
class ${class_name}(gr.top_block, Qt.QWidget):
def __init__(${param_str}):
- gr.top_block.__init__(self, "${title}")
+ gr.top_block.__init__(self, "${title}", catch_exceptions=${catch_exceptions})
Qt.QWidget.__init__(self)
self.setWindowTitle("${title}")
qtgui.util.check_set_qss()
@@ -91,7 +91,7 @@ class ${class_name}(gr.top_block, Qt.QWidget):
class ${class_name}(gr.top_block):
def __init__(self, doc):
- gr.top_block.__init__(self, "${title}")
+ gr.top_block.__init__(self, "${title}", catch_exceptions=${catch_exceptions})
self.doc = doc
self.plot_lst = []
self.widget_lst = []
@@ -100,7 +100,7 @@ class ${class_name}(gr.top_block):
class ${class_name}(gr.top_block):
def __init__(${param_str}):
- gr.top_block.__init__(self, "${title}")
+ gr.top_block.__init__(self, "${title}", catch_exceptions=${catch_exceptions})
% elif generate_options.startswith('hb'):
<% in_sigs = flow_graph.get_hier_block_stream_io('in') %>
<% out_sigs = flow_graph.get_hier_block_stream_io('out') %>
diff --git a/grc/core/generator/top_block.py b/grc/core/generator/top_block.py
index 32e8574aed..27d2428888 100644
--- a/grc/core/generator/top_block.py
+++ b/grc/core/generator/top_block.py
@@ -118,7 +118,8 @@ class TopBlockGenerator(object):
'parameters': parameters,
'monitors': monitors,
'generate_options': self._generate_options,
- 'version': platform.config.version
+ 'version': platform.config.version,
+ 'catch_exceptions': fg.get_option('catch_exceptions')
}
flow_graph_code = python_template.render(
title=title,