summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2021-01-08 16:28:47 +0100
committerMartin Braun <martin@gnuradio.org>2021-01-12 02:54:42 -0800
commit9f8ed5bb5decdcc6905e4a8cbd22ac31bca619a7 (patch)
tree27f4388ff6509a539150a034495a65f16b0dfc39
parentd03358ff61223cd75d89e8b0d3c3a643029a5b2b (diff)
grc: Move snippets prep earlier in the file
They are going to be needed in the closeEvent() Qt stuff and this is earlier in the file ... Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
-rw-r--r--grc/core/generator/flow_graph.py.mako52
1 files changed, 28 insertions, 24 deletions
diff --git a/grc/core/generator/flow_graph.py.mako b/grc/core/generator/flow_graph.py.mako
index 81d71bd569..e79bfa6f29 100644
--- a/grc/core/generator/flow_graph.py.mako
+++ b/grc/core/generator/flow_graph.py.mako
@@ -44,6 +44,34 @@ ${imp}
% endfor
########################################################
+##Prepare snippets
+########################################################
+% for snip in flow_graph.get_snippets_dict():
+
+${indent(snip['def'])}
+% for line in snip['lines']:
+ ${indent(line)}
+% endfor
+% endfor
+\
+<%
+snippet_sections = ['main_after_init', 'main_after_start', 'main_after_stop']
+snippets = {}
+for section in snippet_sections:
+ snippets[section] = flow_graph.get_snippets_dict(section)
+%>
+\
+%for section in snippet_sections:
+%if snippets[section]:
+
+def snippets_${section}(tb):
+ % for snip in snippets[section]:
+ ${indent(snip['call'])}
+ % endfor
+%endif
+%endfor
+
+########################################################
##Create Class
## Write the class declaration for a top or hier block.
## The parameter names are the arguments to __init__.
@@ -269,30 +297,6 @@ gr.io_signature.makev(${len(io_sigs)}, ${len(io_sigs)}, [${', '.join(size_strs)}
% endif
% endfor
\
-% for snip in flow_graph.get_snippets_dict():
-
-${indent(snip['def'])}
-% for line in snip['lines']:
- ${indent(line)}
-% endfor
-% endfor
-\
-<%
-snippet_sections = ['main_after_init', 'main_after_start', 'main_after_stop']
-snippets = {}
-for section in snippet_sections:
- snippets[section] = flow_graph.get_snippets_dict(section)
-%>
-\
-%for section in snippet_sections:
-%if snippets[section]:
-
-def snippets_${section}(tb):
- % for snip in snippets[section]:
- ${indent(snip['call'])}
- % endfor
-%endif
-%endfor
########################################################
##Create Main