Skip to content

feat(elements): rename desc -> label on all UI elements, with deprecation - #135

Merged
petercorke merged 2 commits into
jhavl:mainfrom
petercorke:feat/element-desc-to-label
Aug 22, 2026
Merged

feat(elements): rename desc -> label on all UI elements, with deprecation#135
petercorke merged 2 commits into
jhavl:mainfrom
petercorke:feat/element-desc-to-label

Conversation

@petercorke

Copy link
Copy Markdown
Collaborator

Summary

  • desc was a poor name for what's actually the caption/text shown on a Slider, Label, Button, Select, Checkbox, or Radio — label says what it is directly
  • Renamed the constructor param and property across all six SwiftElement subclasses, plus the wire-protocol dict key ui.js reads
  • desc keeps working everywhere (constructor kwarg and property, get and set) via a deprecation shim that forwards to label and emits a DeprecationWarning — nothing is removed, existing user code (including RTB's) keeps running, just with a warning pointing at the new name
  • Also renamed Slider's internal desc DOM id/JS field to label, matching how Button/Select/Checkbox/Radio/Label already name their own caption element — Slider was the only one still called desc client-side too
  • Updated all in-repo examples, README, and tests to the new label= kwarg; added parametrized tests covering the deprecated desc= constructor kwarg and property on every element class

Test plan

  • pytest — no regressions (one pre-existing, unrelated failure: test_add_path_sends_points_radius_and_linewidth, caused by the installed spatialgeometry PyPI release lagging behind an unreleased Polyline rename)
  • node --test src/swift/public/js/*.test.js — no regressions
  • Manual check: run one of the slider examples, confirm captions still render correctly in the browser panel

🤖 Generated with Claude Code

…tion

'desc' was a poor name for what's actually the caption/text shown on a
Slider, Label, Button, Select, Checkbox, or Radio -- 'label' says what
it is directly. Renamed the constructor param and property across all
six SwiftElement subclasses, plus the wire-protocol dict key ui.js reads.

'desc' keeps working everywhere (constructor kwarg and property, get and
set) via a deprecation shim that forwards to 'label' and emits a
DeprecationWarning -- nothing is removed, existing code (including RTB's)
keeps running, just with a warning pointing at the new name.

Also renamed Slider's internal desc DOM id/JS field to label, matching
how Button/Select/Checkbox/Radio/Label already name their own caption
element -- Slider was the only one still called desc client-side too.
petercorke added a commit to petercorke/robotics-toolbox-python that referenced this pull request Aug 22, 2026
Follow-up to this same PR's teach panel: swift-sim renamed desc to
label on all SwiftElement subclasses (jhavl/swift#135) while this was
in flight -- desc still works via a deprecation shim, but update to
the new name rather than carry the warning forward.
…label

# Conflicts:
#	examples/box_sliders.py
#	examples/panda_ik_sliders.py
#	examples/two_link_arm.py
#	src/swift/SwiftElement.py
@petercorke
petercorke merged commit ae86391 into jhavl:main Aug 22, 2026
2 checks passed
petercorke added a commit to jbkahrs/robotics-toolbox-python-csc376 that referenced this pull request Aug 22, 2026
swift-sim renamed the desc constructor kwarg/property to label on all
SwiftElement subclasses (jhavl/swift#135) -- desc still works via a
deprecation shim, but update RTB's own usages to the new name rather
than carry the warning forward.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant