Insert a snippet of Python code directly into the flowgraph at the end of the specified section.
Added in 3.9
CAUTION: This is an ADVANCED feature and can lead to unintended consequences in the rendering of a flowgraph. Use at your own risk.
For each snippet a function is generated with the block name of the snippet (use GRC Show Block IDs option to modify). These functions are then grouped into their respective sections in the rendered flowgraph.
The purpose of the python snippets is to be able to exercise features from within GRC that are not entirely supported by the block callbacks, methods and mechanisms to generate the code. One example of this would be calling UHD timed commands before starting the flowgraph
Indents will be handled upon insertion into the python flowgraph.
- Example 1:
epy_mod_0.some_function(self.some_block.some_property) Will place the function call in the generated .py file using the name of the appropriate embedded python block in the proper scope The scope is relative to the blocks in the flowgraph, e.g. to reference a block, it should be identified as self.block
- Example 2:
print('The flowgraph has been stopped') With section selected as 'Main - After Stop', will place the print statement after the flowgraph has been stopped.
(R): Run-time adjustable
- Section of Flowgraph
- options: ['Main - After Init', 'Main - After Start', 'Main - After Stop']
- priority within the section; larger number is higher priority
- Code Snippet
- content of code
- C++ files
- Header files
- Public header files
- Block definition