Work in progress: this documentation is still being written and reviewed. Check details against the source code.

Operator window

Coordinate task editing, saved runs, pose management, chat, and execution controls.

mtc_gui.main_window Β· Source

Operator GUI Β· Guide Β· Symbol index

How it is used

main() creates MTCMainWindow with the application’s ROS2Bridge. The window owns the active task document, builds the panels, connects their signals, loads beamline poses, and starts its AgentBridge. Registry poses remain in PosesPanel; config.poses holds task-only overrides.

For execution, _execute() packages all tasks or a selected suffix and calls ROS2Bridge.execute_task(). Feedback and results update the queue and chat through callbacks. Most methods below are handlers for existing controls, not a separate scripting API. Follow _connect_signals() when changing a workflow, and keep widget changes on the GUI thread.

Start here

Callable

Purpose

MTCMainWindow.__init__

Load the beamline configuration, create the task document and panels, and connect the bridges.

MTCMainWindow._connect_signals

Connect panel and bridge signals, register the document getter, and start the agent connection.

MTCMainWindow._edit_task_by_index

Open a task editor and apply its accepted result, including any task-only joint pose.

MTCMainWindow._execute

Validate queue/slice and supported preview types, then dispatch JSON with the selected starting gripper.

MTCMainWindow._on_result

Finish the execution display, update cache status, and return any agent-requested outcome.

MTCMainWindow

Own the operator application’s document and coordinate its panels and bridges. Button and signal handlers edit that document or submit it through ROS2Bridge. closeEvent() disconnects the agent; the application entry point owns ROS cleanup.

Inherits from: QMainWindow.

MTCMainWindow.__init__()

Load the beamline configuration, create the task document and panels, and connect the bridges.

Lifecycle Β· Source

__init__(self, ros2: ROS2Bridge)

Parameter

Meaning

ros2

ROS2Bridge for robot state and action/service requests; the application entry point owns its shutdown.

Errors: Beamline-file loading soft-fails; malformed nested config, UI, registry, and bridge errors can still propagate.

Side effects: Initializes home inline pose and empty queue; logical default gripper is none, first declared, or empty. Builds widgets, starts agent connection through _connect_signals, and loads poses. The combo initially selects its first declared item, which can differ from config’s logical default.

MTCMainWindow._connect_signals()

Connect panel and bridge signals, register the document getter, and start the agent connection.

Internal helper Β· Source

_connect_signals(self)

Returns: None.

Errors: Qt/widget errors propagate; no local exception handler.

Side effects: Projects initial execution state, registers all bridge callbacks, supplies AgentBridge a lambda returning self.config directly, and calls connect_agent. The getter neither snapshots the gripper combo nor marshals through Qt.

Referenced in source (1)

MTCMainWindow._edit_task_by_index()

Open a task editor and apply its accepted result, including any task-only joint pose.

Callback Β· Source

_edit_task_by_index(self, idx)

Parameter

Meaning

idx

Zero-based task index; out-of-range or pause steps are ignored.

Returns: None.

Errors: Form errors propagate but redocking runs in finally. Malformed accepted metadata can fail while applying results; no independent editability check.

Side effects: Inline poses override registry names for display. Detaches viewer, opens modal editor, moves _inline_joint_pose into config.poses, replaces task, refreshes, and logs. Viewer is detached even for a non-MoveTo form, then restored.

Referenced in source (1)

MTCMainWindow._execute()

Validate queue/slice and supported preview types, then dispatch JSON with the selected starting gripper.

Callback Β· Source

_execute(self, start_index: int=0)

Parameter

Meaning

start_index

Zero-based first submitted task; zero submits the whole queue. Prefix effects are not reconstructed.

Returns: None.

Errors: Empty tasks warn; invalid index returns. Dry Run rejects types outside moveto/end_effector. Other schema/serialization/Qt errors propagate; no independent connection/server-state/pending-goal check.

Side effects: Snapshots gripper into config, slices tasks in a shallow config copy, sets pending/dry-run/offset flags, projects controls, shows progress/row timers, then calls ros2.execute_task. Non-dry dispatch can command hardware.

Referenced in source (3)

MTCMainWindow._on_result()

Finish the execution display, update cache status, and return any agent-requested outcome.

Callback Β· Source

_on_result(self, status, error_msg, completed, total)

Parameter

Meaning

status

ROS GoalStatus integer; SUCCEEDED/CANCELED get separate branches, all others fail.

error_msg

Error text; CACHE_ prefix triggers the cache-invalid explanation dialog.

completed

Completed steps in the submitted suffix.

total

Server-reported total submitted steps used in logs and agent outcome.

Returns: None.

Errors: No exception handler; malformed error strings/Qt failures can interrupt cleanup.

Side effects: Clears pending/dry-run flags, finalizes rows, marks successful Dry Run cached, clears badge after successful real run, logs failures/cancellation, and may show cache warning. Agent runs notify bridge; resets initiator/offset and projects the last server state without forcing IDLE.

Referenced in source (1)

MTCMainWindow.closeEvent()

Disconnect the agent and accept window closure.

Lifecycle Β· Source

closeEvent(self, event)

Parameter

Meaning

event

QCloseEvent accepted after agent disconnection returns.

Returns: None.

Errors: Agent-disconnection errors propagate and prevent this handler from accepting the event.

Side effects: Calls agent_bridge.disconnect and event.accept. ROS cleanup belongs to main() after the event loop exits; this handler does not explicitly stop the VisualizationPanel server or cancel a robot goal.

Internal callbacks and helpers

MTCMainWindow._build_menu()

Create the application menus and keyboard shortcuts.

Internal helper Β· Source

_build_menu(self)

Returns: None.

Errors: Qt/widget errors propagate; no local exception handler.

Side effects: Connects load/save/exit, copy/paste, dark toggle, and About; stores clipboard actions for installation on the step list.

Referenced in source (1)

MTCMainWindow._build_central()

Arrange the configuration strip and the three main panes.

Internal helper Β· Source

_build_central(self)

Returns: None.

Errors: Qt/widget errors propagate; no local exception handler.

Side effects: Displays YAML robot.ip, creates gripper/test/pose controls, connects gripper changes to cache-badge invalidation, and sizes three panes. Save Current Pose appears only when ROS2_AVAILABLE is true.

Referenced in source (1)

MTCMainWindow._build_sidebar()

Create the task palette, pose browser, and saved-run controls.

Internal helper Β· Source

_build_sidebar(self) -> QWidget

Returns: The left QTabWidget.

Errors: Qt/run-directory errors propagate; individual run JSON errors are handled by _refresh_runs_list.

Side effects: Creates 13 palette entries, template placeholder, PosesPanel signal connections, and run CRUD controls; refreshing runs may create src/cms/runs.

Referenced in source (1)

MTCMainWindow._build_center_pane()

Create the task queue, execution controls, and activity log.

Internal helper Β· Source

_build_center_pane(self) -> QWidget

Returns: New center-pane QWidget.

Errors: Qt/widget errors propagate; no local exception handler.

Side effects: Wires Execute/From Selected/Pause/Resume/Stop, edits/reorder/clipboard, creates Dry Run and hidden cache/progress UI. Replay-promise text is not a server-cache eligibility check.

Referenced in source (1)

MTCMainWindow._build_right_tabs()

Create Chat and any available Camera and 3D View tabs.

Internal helper Β· Source

_build_right_tabs(self) -> QWidget

Returns: The right QTabWidget.

Errors: Qt/widget errors propagate; no local exception handler.

Side effects: Creates ChatPanel/AgentBridge; ROS2_AVAILABLE gates CameraPanel, WEBENGINE_AVAILABLE gates VisualizationPanel and its mesh server. Initializes viewer-docking state.

Referenced in source (1)

MTCMainWindow._add_task()

Append a deep copy of a task template.

Callback Β· Source

_add_task(self, task_type)

Parameter

Meaning

task_type

Template key; unknown keys create a minimal {task_type: value} step.

Returns: None.

Errors: Copy/config/render errors propagate; no local editing-state guard.

Side effects: Mutates config.tasks, refreshes rows/cache badge, and logs the added type.

Referenced in source (1)

MTCMainWindow._add_moveto_for_pose()

Append a joint-planned MoveTo step referencing a pose name.

Callback Β· Source

_add_moveto_for_pose(self, pose_name: str)

Parameter

Meaning

pose_name

Nonempty pose activation/drop target; registry membership is not checked.

Returns: None.

Errors: Empty names return; template/config/render errors propagate. No local editing-state guard.

Side effects: Copies moveto template, sets target, appends, refreshes, and logs.

Referenced in source (2)

MTCMainWindow._remove_task()

Delete selected valid queue indices in descending order.

Callback Β· Source

_remove_task(self)

Returns: None.

Errors: No selection returns; invalid indices are skipped. Config/render errors propagate.

Side effects: Removes tasks and refreshes rows/cache badge; no independent editability check.

Referenced in source (1)

MTCMainWindow._clear_tasks()

Confirm removal of every step in a nonempty sequence.

Callback Β· Source

_clear_tasks(self)

Returns: None.

Errors: Empty queue or non-Yes response returns; Qt/config errors propagate.

Side effects: Shows Yes/Cancel with Cancel default; clears config.tasks, refreshes, and logs when confirmed.

Referenced in source (1)

MTCMainWindow._copy_steps()

Copy selected task dictionaries as custom-MIME JSON and plain text.

Callback Β· Source

_copy_steps(self)

Returns: None.

Errors: No selection returns; >1,000,000 encoded bytes logs and returns. Index/serialization/Qt errors propagate. Copy does not enforce the 1,000-step paste limit.

Side effects: Writes application/x-erobs-task-steps+json and equivalent text to the system clipboard; logs count. Associated pose definitions are not copied separately.

Referenced in source (1)

MTCMainWindow._paste_steps()

Validate custom clipboard JSON and insert imported steps after the last selected row or at queue end.

Callback Β· Source

_paste_steps(self)

Returns: None.

Errors: Silently rejects disabled editing, absent MIME, empty/>1,000,000-byte data, JSON ValueError/RecursionError, nonlist/empty/>1,000-step roots, nondict items, unsupported/nonstring types, and task_summary KeyError/TypeError/ValueError/IndexError/OverflowError. This is renderability validation, not full backend-schema validation.

Side effects: Accepts configured defaults plus vision_task; mutates only after all items validate, refreshes, selects pasted range, and logs. No pose-registry import or execution occurs.

Referenced in source (1)

MTCMainWindow._on_tasks_proposed()

Replace/extend agent-proposed tasks and apply recognized gripper/inline-pose options.

Callback Β· Source

_on_tasks_proposed(self, tasks: list, options: dict)

Parameter

Meaning

tasks

Proposed list; elements are not individually validated or deep-copied.

options

replace defaults True; truthy start_gripper is applied only if it matches the combo; truthy poses merges into config.poses.

Returns: None.

Errors: Malformed tasks/options or rendering can fail after mutation; no running/editing-state guard.

Side effects: Replaces queue with list(tasks) or extends it, may change combo/inline poses, refreshes, and logs. config.start_gripper is updated later at dispatch/save.

Referenced in source (1)

MTCMainWindow._on_agent_tasks_cleared()

Clear the queue for the agent-local clear tool.

Callback Β· Source

_on_agent_tasks_cleared(self)

Returns: None.

Errors: Config/render errors propagate; no confirmation or editability check.

Side effects: Replaces config.tasks with [], refreshes rows/cache badge, and logs removed count.

Referenced in source (1)

MTCMainWindow._on_agent_execute_requested()

Reject an occupied accepted-goal handle or empty queue, then invoke normal Execute as agent-initiated.

Callback Β· Source

_on_agent_execute_requested(self)

Returns: None.

Errors: Prechecks notify bridge failure with zero counts. Checks _current_goal_handle, not _goal_pending or server state. _execute early returns, including unsupported Dry Run, do not resolve the pending agent future here.

Side effects: Sets initiator to agent, logs, and calls _execute using the current Dry Run and gripper controls.

Referenced in source (1)

MTCMainWindow._on_agent_mode_changed()

Replace visible chat with a mode-change notice after bridge acknowledgment.

Callback Β· Source

_on_agent_mode_changed(self, mode: str)

Parameter

Meaning

mode

Normally plan/run; displayed verbatim in status and uppercased in the notice.

Returns: None.

Errors: Qt/widget errors propagate; no local exception handler.

Side effects: Clears chat widgets, syncs/reenables radios, changes status, appends reset notice, and logs. Agent reconstruction/history reset belongs to AgentBridge.

Referenced in source (1)

MTCMainWindow._move_up()

Swap one selected task with its predecessor.

Callback Β· Source

_move_up(self)

Returns: None.

Errors: Zero/multiple selection or first row returns; stale index/config/render errors propagate.

Side effects: Swaps queue entries, refreshes/cache-invalidates, and selects the moved row; no independent editability check.

Referenced in source (1)

MTCMainWindow._move_down()

Swap one selected task with its successor.

Callback Β· Source

_move_down(self)

Returns: None.

Errors: Zero/multiple selection or last row returns; stale index/config/render errors propagate.

Side effects: Swaps queue entries, refreshes/cache-invalidates, and selects the moved row; no independent editability check.

Referenced in source (1)

MTCMainWindow._reorder_steps()

Apply a validated permutation of original indices from an internal drag.

Callback Β· Source

_reorder_steps(self, order: list, moved_rows: list)

Parameter

Meaning

order

New ordering as original row identities; length and set must match range(len(tasks)).

moved_rows

Original identities to reselect after rebuilding the queue.

Returns: None.

Errors: Disabled editing/invalid permutation causes refresh and return; unhashable/type errors propagate.

Side effects: Reorders config.tasks, refreshes rows/cache badge, and selects dragged rows at new positions.

Referenced in source (1)

MTCMainWindow._detach_viz_for_form()

Remove the 3D tab so a form can embed its viewer.

Internal helper Β· Source

_detach_viz_for_form(self)

Returns: None.

Errors: No-op without available viewer or when already floating; Qt errors propagate.

Side effects: Stores old tab index, removes the tab when present, and marks floating. MoveToForm performs reparenting.

Referenced in source (1)

MTCMainWindow._redock_viz_after_form()

Restore a detached viewer near its former tab position.

Internal helper Β· Source

_redock_viz_after_form(self)

Returns: None.

Errors: No-op without viewer or when not floating; Qt errors propagate.

Side effects: Restores Widget flags, inserts/shows viewer with saved title, and clears floating state.

Referenced in source (1)

MTCMainWindow._refresh_tree()

Refresh queue rows from the task document and clear the preview-cache badge.

Internal helper Β· Source

_refresh_tree(self)

Returns: None.

Errors: Malformed/missing tasks and summary/widget failures propagate.

Side effects: Refreshes StepListPanel, resetting row states, and hides badge; does not clear the server’s cache.

Referenced in source (13)

MTCMainWindow._set_plan_cached()

Show success-preview status, a temporary warning, or no cache badge.

Internal helper Β· Source

_set_plan_cached(self, cached: bool, reason: str='')

Parameter

Meaning

cached

True selects the green cached message regardless of reason.

reason

Warning text when cached=False; empty hides the badge.

Returns: None.

Errors: Qt/widget errors propagate; no local exception handler.

Side effects: Updates text/status property/visibility and restyles. Warnings schedule unconditional clearing after eight seconds; no server cache query/mutation.

Referenced in source (3)

MTCMainWindow._clear_plan_cache_warning()

Hide and clear the cache badge, restoring its success property.

Callback Β· Source

_clear_plan_cache_warning(self)

Returns: None.

Errors: Qt/widget errors propagate; no local exception handler.

Side effects: Erases text, hides/repolishes label, sets status=success. An old scheduled warning callback can also clear a newer badge.

Referenced in source (1)

MTCMainWindow._execute_from_selected()

Submit a queue suffix only when exactly one row is selected.

Callback Β· Source

_execute_from_selected(self)

Returns: None.

Errors: Qt/widget errors propagate; no local exception handler.

Side effects: Calls _execute(selected_index); other selection counts do nothing.

Referenced in source (1)

MTCMainWindow._on_execution_state()

Store server state, clear pending status for active states, and project controls.

Callback Β· Source

_on_execution_state(self, state)

Parameter

Meaning

state

IDLE, RUNNING, COMPLETING_TASK, PAUSED, or an unknown state string.

Returns: None.

Errors: Unknown states log and disable controls through projection; no exception handler.

Side effects: Sets state; RUNNING/COMPLETING_TASK/PAUSED clear _goal_pending, while IDLE does not; calls projection.

Referenced in source (1)

MTCMainWindow._project_execution_state()

Apply state-derived execution, editability, and pause flags to the controls.

Internal helper Β· Source

_project_execution_state(self)

Returns: None.

Errors: Qt/widget errors propagate; no local exception handler.

Side effects: Updates Execute/From Selected/Pause/Resume/Stop, task palette/edit buttons/gripper/Dry Run, step-list drag/edit state, and pause indicator. File menus, run loading, pose controls, and agent queue updates remain separately enabled.

Referenced in source (4)

MTCMainWindow._update_execute_from_selected()

Enable suffix execution when Execute is enabled and exactly one row is selected.

Callback Β· Source

_update_execute_from_selected(self, _=None)

Parameter

Meaning

_

Ignored optional selection_changed payload, normally a list of row indices.

Returns: None.

Errors: Qt/widget errors propagate; no local exception handler.

Side effects: Changes execute_from_btn enabled state.

Referenced in source (2)

MTCMainWindow._on_feedback()

Map feedback into the full queue’s progress and update the activity log.

Callback Β· Source

_on_feedback(self, progress, step, action, gripper, msg)

Parameter

Meaning

progress

Submitted-suffix progress percentage.

step

One-based step within the submitted suffix.

action

Current action/task-type label.

gripper

Reported gripper, logged but not applied to the combo here.

msg

Reported status-message text.

Returns: None.

Errors: Numeric/config/widget failures propagate; total zero yields zero progress.

Side effects: Sets progress to (start_index + progress/100 Γ— remaining)/total Γ—100, forwards row feedback, and logs the offset step number.

Referenced in source (1)

MTCMainWindow._on_joint_state()

Cache the latest degree-valued pose for saving and editor snapshots.

Callback Β· Source

_on_joint_state(self, pose)

Parameter

Meaning

pose

Joint-angle list from ROS2Bridge, retained by reference.

Returns: None.

Errors: No explicit validation or failure handling; the payload is assigned directly.

Side effects: Assigns current_robot_pose only.

Referenced in source (1)

MTCMainWindow._on_gripper_changed()

Select an exactly matching reported gripper in the combo.

Callback Β· Source

_on_gripper_changed(self, gripper: str)

Parameter

Meaning

gripper

Current-gripper topic string; matching is case-sensitive.

Returns: None.

Errors: Unknown names are ignored; Qt errors propagate.

Side effects: Changes combo, potentially invalidating the cache badge, but does not directly update config.start_gripper.

Referenced in source (1)

MTCMainWindow._load_json()

Choose and load a JSON file as the active task configuration.

Callback Β· Source

_load_json(self)

Returns: None.

Errors: Cancel returns. Read/update/render exceptions show a critical dialog; config is replaced before schema/render validation and is not rolled back.

Side effects: Reads file, replaces config, syncs recognized gripper, sets current_json_file, refreshes/cache-invalidates, and logs.

Referenced in source (1)

MTCMainWindow._save_json()

Choose a destination and write indented JSON with the current gripper selection.

Callback Β· Source

_save_json(self)

Returns: None.

Errors: Cancel returns; exceptions show a critical dialog. Direct non-atomic overwrite can leave a truncated file.

Side effects: Mutates config.start_gripper, writes chosen file, and logs. Does not update current_json_file or append an extension.

Referenced in source (1)

MTCMainWindow._runs_dir()

Locate or create the CMS saved-runs directory from the beamline configuration path.

Internal helper Β· Source

_runs_dir(self) -> 'Path | None'

Returns: workspace/src/cms/runs Path or None without config path/matching ancestor.

Errors: Path/mkdir errors propagate; filesystem root is not checked by the walk.

Side effects: Creates the runs directory if needed; location is CMS-specific regardless of beamline identity.

Referenced in source (2)

MTCMainWindow._refresh_runs_list()

List sorted *.json run files using run_name or the filename stem.

Callback Β· Source

_refresh_runs_list(self)

Returns: None.

Errors: Per-file read/JSON failures fall back to stem; directory/Qt errors and invalid display-name types can propagate.

Side effects: Clears/rebuilds run list, may create its directory, reads JSON metadata, and stores paths in item UserRole.

Referenced in source (4)

MTCMainWindow._save_run()

Prompt for display name/filename, confirm overwrites, and save a copied task document.

Callback Β· Source

_save_run(self)

Returns: None.

Errors: Missing directory/empty queue warns; blank/canceled prompts return. Save/copy/refresh errors show a critical dialog; directory resolution is outside the handler. Writes are non-atomic.

Side effects: Trims names, replaces spaces and / with _, appends .json, deep-copies config, writes run_name/current combo gripper, logs and refreshes. It preserves existing config.poses without stripping entries.

Referenced in source (1)

MTCMainWindow._load_run()

Load the file path stored by a run-list item into the active document.

Callback Β· Source

_load_run(self, item: 'QListWidgetItem')

Parameter

Meaning

item

QListWidgetItem carrying path in UserRole and display name in text.

Returns: None.

Errors: Missing path returns. Read/update/render exceptions show a critical dialog; prior config is not restored after a render failure.

Side effects: Reads JSON, replaces config, syncs recognized gripper, sets current_json_file, refreshes/cache-invalidates, and logs.

Referenced in source (1)

MTCMainWindow._rename_run()

Change the selected run’s run_name field while retaining its filename.

Callback Β· Source

_rename_run(self)

Returns: None.

Errors: No item/canceled/blank/unchanged name returns; read/write/refresh errors show a critical dialog. Direct overwrite can truncate on failure.

Side effects: Prompts, reads JSON, rewrites with trimmed name, logs, and rebuilds list.

Referenced in source (1)

MTCMainWindow._delete_run()

Confirm and remove the selected named-run file.

Callback Β· Source

_delete_run(self)

Returns: None.

Errors: No selection/non-Yes returns; unlink/refresh failures show a critical dialog.

Side effects: Shows confirmation, unlinks path, logs, and refreshes; leaves any active in-memory document intact.

Referenced in source (1)

MTCMainWindow._log()

Append an activity message with local HH:MM:SS timestamp.

Callback Β· Source

_log(self, msg)

Parameter

Meaning

msg

Text interpolated into QTextEdit.append; unlike chat bubbles, no explicit PlainText mode is set here.

Returns: None.

Errors: Qt/widget errors propagate; no local exception handler.

Side effects: Appends to status_log only; no file or ROS logging.

Referenced in source (23)

MTCMainWindow._toggle_dark_mode()

Forward the menu preference to the shared theme helper.

Callback Β· Source

_toggle_dark_mode(self, enabled)

Parameter

Meaning

enabled

Dark-mode action checked state.

Returns: None.

Errors: Qt/widget errors propagate; no local exception handler.

Side effects: Calls theme.toggle_dark_mode(self._app(), enabled), changing application appearance.

Referenced in source (1)

MTCMainWindow._app()

Retrieve the current QApplication singleton.

Internal helper Β· Source

_app(self)

Returns: QApplication.instance(), possibly None outside an initialized Qt app.

Errors: Import/Qt errors propagate.

Referenced in source (1)

MTCMainWindow._show_about()

Display GUI identity and beambot_execution action-server information.

Callback Β· Source

_show_about(self)

Returns: None.

Errors: Qt/widget errors propagate; no local exception handler.

Side effects: Shows the About message box.

Referenced in source (1)

MTCMainWindow._load_beamline_yaml()

Read BEAMBOT_BEAMLINE_CONFIG and accept a YAML mapping root.

Internal helper Β· Source

_load_beamline_yaml(self) -> tuple[dict, str | None]

Returns: (config_dict, absolute_path_string), or ({}, None) for unset/missing/invalid configuration.

Errors: Unset/missing paths/nonmapping roots record a diagnostic. Read/parse exceptions are caught; earlier path normalization failures can propagate. Empty/false YAML values become {} before the mapping check.

Side effects: Reads environment/file, strips path text, expands ~, normalizes .. with abspath without following symlinks, and sets _pending_log on failure.

Referenced in source (1)

MTCMainWindow._load_beamline_poses()

Load the referenced pose registry and flush any deferred startup diagnostic.

Internal helper Β· Source

_load_beamline_poses(self)

Returns: None.

Errors: Registry-load errors propagate and can prevent pending-log cleanup.

Side effects: Calls panel.load_from_beamline_config for the startup path, then logs/deletes _pending_log when present.

Referenced in source (1)

MTCMainWindow._on_poses_loaded()

Log registry size without copying registry entries into inline document poses.

Callback Β· Source

_on_poses_loaded(self, poses: dict)

Parameter

Meaning

poses

Registry mapping from PosesPanel; used only for len().

Returns: None.

Errors: Qt/widget errors propagate; no local exception handler.

Side effects: Appends count to the log; does not change config.poses or invalidate the cache badge.

Referenced in source (1)

MTCMainWindow._manage_poses()

Run the registry-manager dialog whose individual edits persist immediately.

Callback Β· Source

_manage_poses(self)

Returns: None.

Errors: Qt/widget errors propagate; no local exception handler.

Side effects: Constructs/executes PosesManagerDialog; no aggregate result is applied afterward.

Referenced in source (1)

MTCMainWindow._save_current_pose()

Save the cached robot pose to the registry or task document as chosen in the dialog.

Callback Β· Source

_save_current_pose(self)

Returns: None.

Errors: Missing pose warns. False registry save warns; other widget/persistence errors propagate.

Side effects: Runs SavePoseDialog; registry choice writes through panel.save_pose, inline choice updates config.poses. Logs either success; inline saving neither writes a file nor clears the cache badge.

Referenced in source (1)

MTCMainWindow._on_chat_message()

Display the user message and submit it to AgentBridge.

Callback Β· Source

_on_chat_message(self, text)

Parameter

Meaning

text

User text, normally trimmed by ChatPanel.

Returns: None.

Errors: Qt/widget errors propagate; no local exception handler.

Side effects: Appends a user bubble and schedules agent chat; bridge signals expose failures.

Referenced in source (1)

Functions

task_summary()

Format one task as the short description shown in a queue row.

Function Β· Source

task_summary(step)

Parameter

Meaning

step

Task mapping whose task_type selects formatting; uses target/direction/Cartesian, detection/tag, scan count, gripper action, normalized volume, and grid-coordinate fields.

Returns: Summary string; unknown and spincoater types fall back to raw task_type. MoveTo shows a truthy direction as relative even with zero distance; vision_moveto always labels the target ArUco, including sample_roi.

Errors: Malformed values can raise; clipboard paste uses this function as a renderability check.

Referenced in source (2)

Internal callbacks and helpers

_build_task_defaults()

Construct fresh templates for 13 task types using beamline gripper, dock, and marker defaults.

Internal helper Β· Source

_build_task_defaults(beamline_config: dict) -> dict

Parameter

Meaning

beamline_config

Beamline mapping; {} is supported. Uses grippers.*.states.grasp, tool_exchange.reference_dock, and camera.marker_dictionary.

Returns: Mapping task_type β†’ template dict. Tool exchange prefers the first non-none gripper; end effector uses the first gripper with states and its grasp action. Missing choices become empty strings; dock defaults to 1 and marker dictionary to aruco4x4_50.

Errors: Malformed nested mappings raise; None is not fully supported because tool_exchange is accessed unconditionally.

Side effects: None; allocates new template lists/dicts.

Referenced in source (1)

_execution_controls()

Project server state and local goal-pending status into six control flags.

Internal helper Β· Source

_execution_controls(state, goal_pending=False)

Parameter

Meaning

state

IDLE, RUNNING, COMPLETING_TASK, PAUSED, or unknown/None.

goal_pending

Truthy overrides server state and enables only Stop.

Returns: Tuple (execute, pause, resume, stop, editing, paused). IDLE=(T,F,F,F,T,F); RUNNING=(F,T,F,T,F,F); COMPLETING_TASK=(F,F,F,T,F,F); PAUSED=(F,F,T,T,F,T); unknown=(F,F,F,F,F,F).

Errors: Unhashable state can raise when no pending override applies.

Referenced in source (1)