summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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