Skip to content

Commit

Permalink
Merge pull request #1637 from davep/widget-importing
Browse files Browse the repository at this point in the history
Support easier widget "support classes" importing
  • Loading branch information
willmcgugan authored Jan 25, 2023
2 parents 5e0996d + 3212fbc commit a61e61f
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 7 deletions.
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

0 comments on commit a61e61f

Please sign in to comment.