routine_builder module

class routine_builder.GlobalMiddlewareEditor(parent=None)

Bases: QWidget

add_middleware_entry(data: dict | None = None)

Add a new global middleware entry.

Parameters:

data (dict) – Data to pre-populate the middleware entry.

get_data()

Get the global middleware data as a list of dictionaries.”

init_ui()

” “Initialize the UI components for the global middleware editor.”

remove_middleware_entry(widget)

Remove a global middleware entry.

Parameters:

widget (MiddlewareEntryWidget) – The middleware entry widget to remove.

staticMetaObject = PySide6.QtCore.QMetaObject("GlobalMiddlewareEditor" inherits "QWidget": )
class routine_builder.MiddlewareEntryWidget(parent=None, data=None, remove_callback=None)

Bases: QWidget

get_data()

Get the middleware data as a dictionary.

Returns:

Dictionary containing middleware name and arguments.

Return type:

dict

init_ui()

Initialize the UI components for the middleware entry.

load_data(data)

Load data into the middleware entry widget.

Parameters:

data (dict) – Data to load into the widget.

request_removal()

Request the removal of this middleware entry.

staticMetaObject = PySide6.QtCore.QMetaObject("MiddlewareEntryWidget" inherits "QWidget": )
update_signature_and_args(mw_name: str)

Update the signature and default arguments based on the selected middleware.

Parameters:

mw_name (str) – Name of the selected middleware.

class routine_builder.RoutineBuilderMainWindow

Bases: QMainWindow

add_step()

Add a new step to the routine

duplicate_step()

” “Duplicate the selected step in the routine.””

edit_step()

“Edit the selected step in the routine.”

load_routine()

Load a routine from a YAML file.

move_step_down()

Handle moving the selected step up in the list.

move_step_up()

Handle moving the selected step up in the list.

refresh_steps_list()

Refresh the steps list widget to display the current steps.

remove_step()

“Remove the selected step from the routine.”

save_routine()

“Save the routine to a YAML file.”

staticMetaObject = PySide6.QtCore.QMetaObject("RoutineBuilderMainWindow" inherits "QMainWindow": )
class routine_builder.SaveDialog(parent, routine_yaml)

Bases: QDialog

staticMetaObject = PySide6.QtCore.QMetaObject("SaveDialog" inherits "QDialog": )
class routine_builder.StepEditorDialog(parent=None, step_data=None, available_steps=None, routine_file=None)

Bases: QDialog

add_middleware_entry(data=None)

Add a new middleware entry to the step.”

get_step_data()

” “Get the step data as a dictionary.”

init_ui()

Initialize the UI components for the step editor dialog.

insert_global_variable()

Insert a reference to a global variable from variables.yaml with support for nested dictionaries. Uses context-aware loading: looks for variables.yaml in the same directory as the routine file.

insert_step_reference()

Insert a reference to a previous step in the condition field.”

load_step_data(data)

Load step data into the dialog.

on_function_clicked(event)

When user clicks on a function in the allowed functions list, insert it into the appropriate field (expression for evaluate_expression, condition otherwise). Positions cursor inside the parentheses for easy parameter entry.

on_method_changed(method_name: str)

When the user picks a new method from the combo box, we: 1. Display its signature. 2. Attempt to load or create default arguments as JSON. 3. If the method is “output_values”, we override the defaults with an example.

Parameters:

method_name (str) – The name of the selected method.

populate_allowed_condition_functions()

Populate the allowed condition functions in the text area.

remove_middleware_entry(widget)

” Remove a middleware entry from the step.

staticMetaObject = PySide6.QtCore.QMetaObject("StepEditorDialog" inherits "QDialog": )
update_method_signature(method_name: str)

Update the method signature and default arguments based on the selected method.

Parameters:

method_name (str) – Name of the selected method.”

routine_builder.get_default_args_from_signature(func: Callable) dict

Return a dict of {param_name: default_value} from the function signature. If the function is None or signature cannot be inferred, return empty dict. Also handle special logic: if param is str and has no default, use ‘’.

Parameters:

func – The function to inspect.

Returns:

A dictionary of parameter names and their default values.

Return type:

dict