Add TreeNode.is_root

This commit is contained in:
Dave Pearson
2023-05-08 08:44:12 +01:00
parent 14850d54a3
commit 4c0d3766a8

View File

@@ -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?"""