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

Support easier widget "support classes" importing #1637

Merged
merged 6 commits into from
Jan 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [0.11.0] - Unreleased

### Changed

- Breaking change: `TreeNode` can no longer be imported from `textual.widgets`; it is now available via `from textual.widgets.tree import TreeNode`. https://github.com/Textualize/textual/pull/1637

### Fixed

- Fixed stuck screen https://github.com/Textualize/textual/issues/1632
Expand Down
3 changes: 2 additions & 1 deletion examples/json_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
from rich.text import Text

from textual.app import App, ComposeResult
from textual.widgets import Header, Footer, Tree, TreeNode
from textual.widgets import Header, Footer, Tree
from textual.widgets.tree import TreeNode


class TreeApp(App):
Expand Down
2 changes: 0 additions & 2 deletions src/textual/widgets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
from ._static import Static
from ._text_log import TextLog
from ._tree import Tree
from ._tree_node import TreeNode
from ._welcome import Welcome
from ..widget import Widget

Expand All @@ -44,7 +43,6 @@
"Static",
"TextLog",
"Tree",
"TreeNode",
"Welcome",
]

Expand Down
1 change: 0 additions & 1 deletion src/textual/widgets/_tree_node.py

This file was deleted.

5 changes: 5 additions & 0 deletions src/textual/widgets/data_table.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""Make non-widget DataTable support classes available."""

from ._data_table import Column, Row

__all__ = ["Column", "Row"]
5 changes: 5 additions & 0 deletions src/textual/widgets/tree.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""Make non-widget Tree support classes available."""

from ._tree import TreeNode

__all__ = ["TreeNode"]
3 changes: 2 additions & 1 deletion tests/tree/test_tree_node_children.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest
from textual.widgets import Tree, TreeNode
from textual.widgets import Tree
from textual.widgets.tree import TreeNode


def label_of(node: TreeNode[None]):
Expand Down
3 changes: 2 additions & 1 deletion tests/tree/test_tree_node_label.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from textual.widgets import Tree, TreeNode
from textual.widgets import Tree
from textual.widgets.tree import TreeNode
from rich.text import Text


Expand Down
2 changes: 1 addition & 1 deletion tests/tree/test_tree_node_parent.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from textual.widgets import TreeNode, Tree
from textual.widgets import Tree


def test_tree_node_parent() -> None:
Expand Down