Skip to content

Flowgraph Tools

Tools for managing flowgraph structure: blocks, connections, save/load, and metadata.

get_blocks

List all blocks currently in the flowgraph.

Returns

Type: list[BlockModel]

List of blocks with their names, keys, and states.

Example

blocks = get_blocks()
# Returns: [
# BlockModel(name="osmosdr_source_0", key="osmosdr_source", ...),
# BlockModel(name="low_pass_filter_0", key="low_pass_filter", ...),
# ]

make_block

Create a new block in the flowgraph.

Parameters

NameTypeDefaultDescription
block_namestr-Block type key (e.g., “osmosdr_source”)

Returns

Type: str

The unique name assigned to the block (e.g., “osmosdr_source_0”).

Example

name = make_block(block_name="osmosdr_source")
# Returns: "osmosdr_source_0"

remove_block

Remove a block from the flowgraph.

Parameters

NameTypeDefaultDescription
block_namestr-Name of the block to remove

Returns

Type: bool

True if successful.

Example

remove_block(block_name="osmosdr_source_0")
# Returns: True

save_flowgraph

Save the flowgraph to a .grc file.

Parameters

NameTypeDefaultDescription
filepathstr-Path to save the .grc file

Returns

Type: bool

True if successful.

Example

save_flowgraph(filepath="/tmp/my_flowgraph.grc")
# Returns: True

load_flowgraph

Load a flowgraph from a .grc file, replacing the current flowgraph.

Parameters

NameTypeDefaultDescription
filepathstr-Path to the .grc file

Returns

Type: list[BlockModel]

List of blocks in the loaded flowgraph.

Example

blocks = load_flowgraph(filepath="/tmp/my_flowgraph.grc")
# Returns: [BlockModel(...), ...]

get_flowgraph_options

Get the flowgraph-level options (title, author, generate_options, etc.).

Returns

Type: FlowgraphOptionsModel

Flowgraph metadata including title, author, category, description, and generate options.

Example

options = get_flowgraph_options()
# Returns: FlowgraphOptionsModel(
# title="FM Receiver",
# author="Your Name",
# generate_options="qt_gui",
# ...
# )

set_flowgraph_options

Set flowgraph-level options on the ‘options’ block.

Parameters

NameTypeDefaultDescription
paramsdict[str, Any]-Options to set

Returns

Type: bool

True if successful.

Example

set_flowgraph_options(params={
"title": "FM Receiver",
"author": "Your Name",
"generate_options": "qt_gui"
})
# Returns: True

export_flowgraph_data

Export the flowgraph as a nested dict (same format as .grc files).

Returns

Type: dict

Complete flowgraph data in GRC YAML format.

Example

data = export_flowgraph_data()
# Returns: {"options": {...}, "blocks": [...], "connections": [...]}

import_flowgraph_data

Import flowgraph data from a dict, replacing current contents.

Parameters

NameTypeDefaultDescription
datadict-Flowgraph data in GRC format

Returns

Type: bool

True if successful.

Example

import_flowgraph_data(data={
"options": {"title": "Test"},
"blocks": [...],
"connections": [...]
})
# Returns: True