FoldableTreeNodeImpl#
- class penzai.treescope.foldable_representation.foldable_impl.FoldableTreeNodeImpl[source]#
Bases:
FoldableTreeNode
Concrete implementation of a node that can be expanded or collapsed.
This is kept separate from the abstract definition of a FoldableTreeNode to avoid strong dependencies on its implementation as much as possible.
- Variables:
contents (RenderableTreePart) – Contents of the foldable node.
label (RenderableTreePart) – Optional label for the foldable node. This appears in front of the contents, and clicking it expands or collapses the foldable node. This should not contain any other foldables and should generally be a single line.
expand_state (ExpandState) – Current expand state for the node.
Inherited Attributes
collapsed_width
The length of this rendering if collapsed in one line, in characters.
newlines_in_expanded_parent
The number of newlines in this rendering if in an expanded parent.
tags_in_this_part
Returns a set of "tag" objects contained in this part.
Methods
__init__
(contents[, label, expand_state])Returns the contents of this foldable when expanded.
Returns the node's expand state.
html_setup_parts
(setup_context)render_to_html
(stream, *[, at_beginning_of_line])render_to_text
(stream, *, expanded_parent, ...)set_expand_state
(expand_state)Sets the node's expand state.
Attributes
collapsed_width
The length of this rendering if collapsed in one line, in characters.
expand_state
label
newlines_in_expanded_parent
The number of newlines in this rendering if in an expanded parent.
tags_in_this_part
Returns a set of "tag" objects contained in this part.
contents
Inherited Methods
(expand to view inherited methods)
foldables_in_this_part
()Returns this node itself, since it is a foldable node.
- as_expanded_part() RenderableTreePart [source]#
Returns the contents of this foldable when expanded.
- get_expand_state() ExpandState [source]#
Returns the node’s expand state.
- set_expand_state(expand_state: ExpandState)[source]#
Sets the node’s expand state.