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

Pose editing dialogs

Edit joint poses and choose where to save them.

mtc_gui.pose_dialogs · Source

Operator GUI · Guide · Symbol index

How it is used

MTCMainWindow opens PosesManagerDialog with its existing PosesPanel to manage the shared registry. Each accepted add, edit, import, or deletion is saved immediately through the panel; closing the manager does not undo those changes. Joint values use degrees.

PoseEditorDialog returns six edited angles after acceptance. SavePoseDialog returns a pose name, values, and a choice of registry or task-only storage. The caller applies that choice; the save dialog does not write the file itself.

Start here

Callable

Purpose

PosesManagerDialog.__init__

Build the registry manager; each accepted edit is persisted immediately.

PoseEditorDialog.__init__

Build six joint-angle spin boxes and Home, Straight Up, and All Zero presets.

SavePoseDialog.__init__

Collect a name and storage destination for a current-pose snapshot.

PosesManagerDialog

Browse and modify the registry owned by a PosesPanel. Individual actions persist immediately, including entries imported before a later import error.

Inherits from: QDialog.

PosesManagerDialog.__init__()

Build the registry manager; each accepted edit is persisted immediately.

Lifecycle · Source

__init__(self, panel, parent=None)

Parameter

Meaning

panel

PosesPanel owning the loaded registry and implementing get_poses/get_pose/save_pose/delete_pose.

parent

Optional parent widget.

Returns: None; this manager provides no aggregate result payload.

Errors: Qt and initial-refresh failures propagate.

Side effects: Stores panel, creates the modal dialog, connects controls and double-click editing, and populates the tree.

Referenced in source (1)

Internal callbacks and helpers

PosesManagerDialog._refresh()

Repopulate the tree with alphabetically sorted registry names and two-decimal joint lists.

Internal helper · Source

_refresh(self)

Returns: None.

Errors: Nonnumeric values or unorderable names can raise during formatting/sorting; no local catch.

Side effects: Clears and rebuilds the tree from panel.get_poses().

Referenced in source (4)

PosesManagerDialog._persist()

Save one pose through the registry owner and refresh the manager display.

Internal helper · Source

_persist(self, name, values)

Parameter

Meaning

name

Registry key to insert or overwrite.

values

Joint-angle list forwarded unchanged to panel.save_pose.

Returns: None.

Errors: A False save result opens a No Registry warning; persistence/refresh exceptions propagate.

Side effects: May atomically rewrite the registry through the panel, emit panel reload signals, and rebuild the tree.

Referenced in source (2)

PosesManagerDialog._add_pose()

Open a zero-initialized joint editor, then request a name and persist the accepted pose.

Callback · Source

_add_pose(self)

Returns: None.

Errors: Canceling either prompt aborts; empty names are ignored, but whitespace-only names are not stripped here. Save failures follow _persist behavior.

Side effects: Shows modal dialogs and may immediately write the registry; existing names are overwritten without a separate confirmation.

Referenced in source (1)

PosesManagerDialog._edit_selected()

Open the editor for the first selected tree item.

Callback · Source

_edit_selected(self)

Returns: None.

Errors: No selection is a no-op; editing exceptions propagate.

Side effects: Delegates to _edit_pose and may persist an accepted change.

Referenced in source (1)

PosesManagerDialog._edit_pose()

Edit a tree item’s registry values and persist accepted changes under the same name.

Callback · Source

_edit_pose(self, item)

Parameter

Meaning

item

QTreeWidgetItem; column zero provides the pose name. Also used as the itemDoubleClicked slot.

Returns: None.

Errors: Missing/false pose values default to six zeros; other errors propagate.

Side effects: Shows PoseEditorDialog and writes the registry through _persist on acceptance.

Referenced in source (2)

PosesManagerDialog._delete_pose()

Confirm deletion of the first selected pose and apply it immediately through PosesPanel.

Callback · Source

_delete_pose(self)

Returns: None.

Errors: No selection or a non-Yes confirmation is a no-op. A False delete result shows a No Registry warning; file errors propagate.

Side effects: Displays confirmation, may rewrite the registry, and refreshes the tree after a confirmed deletion.

Referenced in source (1)

PosesManagerDialog._import_json()

Import six-element pose lists from a selected JSON mapping or its poses member, saving entries one at a time.

Callback · Source

_import_json(self)

Returns: None.

Errors: Cancel returns. Nonmapping roots import nothing; entries that are not six-element lists are skipped. All import exceptions display a critical dialog; previously saved entries remain persisted after a later failure.

Side effects: Reads a chosen JSON file, may overwrite registry names with repeated save/reload operations, refreshes the tree, and displays the count of successful saves.

Referenced in source (1)

PoseEditorDialog

Collect six joint angles in a modal editor. On acceptance, result contains the edited list; the caller decides whether to persist it.

Inherits from: QDialog.

PoseEditorDialog.__init__()

Build six joint-angle spin boxes and Home, Straight Up, and All Zero presets.

Lifecycle · Source

__init__(self, name, values, parent=None)

Parameter

Meaning

name

Pose name used in the window title; this dialog does not edit the name.

values

Initial joint-angle sequence in degrees; missing trailing values default to zero and extra values are ignored.

parent

Optional parent widget.

Returns: None; result starts as None and becomes a six-float list on Save.

Errors: Spin boxes constrain values to −360…360 degrees with two decimals; malformed initial values/Qt errors propagate.

Side effects: Creates a modal dialog and connects Save/Cancel/preset buttons; writes no registry file.

Referenced in source (2)

Internal callbacks and helpers

PoseEditorDialog._apply_preset()

Assign preset angles to the corresponding joint spin boxes.

Callback · Source

_apply_preset(self, values)

Parameter

Meaning

values

Sequence of joint angles in degrees; zip limits updates to available spin boxes and supplied values.

Returns: None.

Errors: Qt rejects invalid value types and constrains values to each spin box’s range.

Side effects: Updates joint editors without accepting or saving the dialog.

Referenced in source (1)

PoseEditorDialog._on_save()

Collect the six displayed joint angles and accept the editor.

Callback · Source

_on_save(self)

Returns: None; result is a list of six spin-box float values in degrees.

Errors: No additional validation beyond spin-box constraints.

Side effects: Sets result and closes the modal dialog with Accepted.

Referenced in source (1)

SavePoseDialog

Collect a name and storage destination for a supplied current-pose snapshot. On acceptance, result tells the main window what to save.

Inherits from: QDialog.

SavePoseDialog.__init__()

Collect a name and storage destination for a current-pose snapshot.

Lifecycle · Source

__init__(self, current_pose, registry_file=None, parent=None)

Parameter

Meaning

current_pose

Current joint-angle sequence in degrees; retained by reference for the eventual result.

registry_file

Registry path used for its filename label and availability. None disables registry storage; a supplied path is not checked for existence.

parent

Optional parent widget.

Returns: None; result begins as None.

Errors: Nonnumeric display values/path/Qt errors propagate.

Side effects: Builds a modal dialog; defaults to registry when registry_file is not None, otherwise inline. Does not write poses.

Referenced in source (1)

Internal callbacks and helpers

SavePoseDialog._on_save()

Validate the trimmed pose name and return the requested save operation to the caller.

Callback · Source

_on_save(self)

Returns: None; result becomes {“action”: “save_to_registry” or “save_inline”, “pose_name”: name, “pose_values”: current_pose}.

Errors: Blank names produce a warning and leave the dialog open; no joint validation occurs.

Side effects: Sets result and accepts the dialog; performs no registry/file write itself.

Referenced in source (1)