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.get_node_by_id #1535

Merged
merged 6 commits into from
Jan 10, 2023
Merged

Conversation

davep
Copy link
Contributor

@davep davep commented Jan 10, 2023

The thinking here is that a user of a Tree may want to relate notes to other parts of their UI, or other data in their application. While this could be done by keeping a reference to the node itself, it could also be beneficial to just track the ID. Given that ID is a public property of a TreeNode, but given it doesn't currently have any other (public) purpose, this seems to add some useful symmetry.

The thinking here is that a user of a Tree may want to relate notes to other
parts of their UI, or other data in their application. While this could be
done by keeping a reference to the node itself, it could also be beneficial
to just track the ID. Given that ID is a public property of a TreeNode, but
given it doesn't currently have any other (public) purpose, this seems to
add some useful symmetry.
src/textual/widgets/_tree.py Outdated Show resolved Hide resolved
src/textual/widgets/_tree.py Outdated Show resolved Hide resolved
@willmcgugan willmcgugan merged commit 402afa5 into Textualize:main Jan 10, 2023
@davep davep deleted the get-treenode-by-id branch January 10, 2023 16:17
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.

2 participants