Repository navigation
widgets/sidebar: extract Toad's Qt sidebar primitives - #33
Merged
Merged
Conversation
QtPlacementControl, SidebarPane and SidebarToggle were duplicated inside Toad's qt/ and are the kind of Qt glue formbridge is for — a toolkit-concrete layer that uses PySide6 directly but is addressed through the formbridge protocols. The pane now arranges controls edge-aware: on a leading edge (left, top) the controls dock at the far end of the pane (right / bottom), on a trailing edge (right, bottom) they dock at the near end, so the controls are always on the interior-facing side regardless of which edge the pane is on. Top/bottom edges run the control band as a row; left/right as a column. Floating keeps the row layout, as a short horizontal overlay. Widgets live under formbridge.widgets, opt-in (extras: `qt`). Headless consumers never import PySide6 because they never import this subpackage. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016gZLdupVQyBzHTmHBC9Cyn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Toad was hand-rolling
QtPlacementControl,SidebarPaneandSidebarToggleinsrc/toad/qt/placement.py. They're Qt glue over formbridge-shaped contracts — move them intoformbridge.widgets.sidebarwhere any PySide6 app can use them.What changed
src/formbridge/widgets/sidebar.py— new module with the three widgets, plus runtime-checkablePlacement,PlacementAction,PlacementLayout,SidebarControlsOwner,PlacementEdgeprotocols that the Toad types already satisfy.SidebarPanenow arranges controls edge-aware: leading edges (left, top) put controls on the FAR end of the pane (interior-facing); trailing edges (right, bottom) put them on the NEAR end. Horizontal edge → control row; vertical edge → control column. Fixes the "controls at the top of the pane" bug once Toad passes a placement through to it.src/formbridge/widgets/__init__.py— one-line docstring, no imports.pyproject.toml— adds[project.optional-dependencies] qtwith PySide6 + pyqt-reactive. Headless consumers never import the widgets module.Follow-up
Toad's
src/toad/qt/placement.pywill import from here and the toggle-bar edge honoring + float repaint fix land in that repo's PR.🤖 Generated with Claude Code
https://claude.ai/code/session_016gZLdupVQyBzHTmHBC9Cyn