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

Tree: ASCII_GUIDES and TREE_GUIDES promoted to class attributes #3378

Merged
merged 5 commits into from
Jul 1, 2024

Conversation

jdvanwijk
Copy link
Contributor

@jdvanwijk jdvanwijk commented Jun 11, 2024

Type of changes

  • Bug fix
  • New feature
  • [ x ] Documentation / docstrings
  • Tests
  • [ x ] Other

Checklist

  • [ x ] I've run the latest black with default args on new code.
  • [ x ] I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
  • I've added tests for new code. (New tests didn't seem necessary in this case?)
  • [ x ] I accept that @willmcgugan may be pedantic in the code review.

Description

In the Tree class, I have promoted the ASCII_GUIDES and TREE_GUIDES constants (previously located within the rich_console method) to class attributes. Additionally, I have updated the Tree class docstring to reflect this change.

This modification simplifies the process of customizing the appearance of tree guides. Users can now easily inherit from the Tree class and modify its class attributes directly, rather than delving into the rich_console method.

@jdvanwijk
Copy link
Contributor Author

Example use:

class WideTree(Tree):
    ASCII_GUIDES = ("        ", "|       ", "+------- ", "`------- ")
    TREE_GUIDES = [
        ("        ", "│       ", "├────── ", "└────── "),
        ("        ", "┃       ", "┣━━━━━━ ", "┗━━━━━━ "),
        ("        ", "║       ", "╠══════ ", "╚══════ "),
    ]

@willmcgugan willmcgugan merged commit 0f04921 into Textualize:master Jul 1, 2024
2 of 5 checks passed
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