mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Add TreeNode.is_root
This commit is contained in:
@@ -184,6 +184,11 @@ class TreeNode(Generic[TreeDataType]):
|
|||||||
self._parent._children and self._parent._children[-1] == self,
|
self._parent._children and self._parent._children[-1] == self,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_root(self) -> bool:
|
||||||
|
"""Is this node the root of the tree?"""
|
||||||
|
return self == self._tree.root
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def allow_expand(self) -> bool:
|
def allow_expand(self) -> bool:
|
||||||
"""Is this node allowed to expand?"""
|
"""Is this node allowed to expand?"""
|
||||||
|
|||||||
Reference in New Issue
Block a user