Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tree widget #229

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open

Add tree widget #229

wants to merge 26 commits into from

Conversation

hydra
Copy link
Contributor

@hydra hydra commented Dec 6, 2024

First attempt add adding a dynamic tree widget.

Features:

  • nodes are widgets.
  • nodes can be expanded/collapsed.
  • tree can be accessed and manipulated from within the node widgets, e.g. by 'Button::on_click'.

image

TODO

  • Make performant.
  • Use icons instead of > and v.
  • Remove use of the .contain() which is currently there for visualization/debugging purposes.
  • Document.
  • Cleanup code.
  • Squash or cleanup commits.

Issues:

  • the performance is currently abysmal once you add around 4 nested children. adding another child using the 'Add child' makes the UI stall for longer and longer periods for each nested child, scrolling becomes very slow.

Notes:

  • No idea if the approach I took, of using widget composition, was a good idea.
  • Probably some unneeded code, as I tried various approaches that didn't work until I stumbled on one that does.
  • Probably there's some unnecessary cloning going on too, maybe on the whole tree itself including all the nodes. Clone for Tree has been removed.

hydra added 26 commits December 6, 2024 12:55
* nothing renders at all.
* "root" renders, no children.
* the expand/collapse button doesn't work yet.
…ns into the nodes that need to refer to the tree and the node itself.
… callbacks.

* delete buttons only work for the root.
…ct location in the tree. Cleanup the API for `children_keys`.
…ound in the window when expanding/collapsing nodes.
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