-
Notifications
You must be signed in to change notification settings - Fork 841
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
New Tree Control #1170
New Tree Control #1170
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Saw it's a draft only after..
@@ -551,6 +551,22 @@ def _align_size(self, child: tuple[int, int], parent: tuple[int, int]) -> Offset | |||
self._align_height(height, parent_height), | |||
) | |||
|
|||
@property | |||
def partial_rich_style(self) -> Style: | |||
"""Get the style properties associated with this node only (not including parents in the DOM). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps use a more property-style docstring here rather than a function style?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean the "int: description"?
I've found that mkdocstrings doesn't render them correctly. It just omits the type :-(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes and no. While that'd be ideal (and it does render really nicely in Emacs and VSCode hints, from what I've seen), I'm meaning more the wording. "Get..."
sort of describing it as a function that does something, rather than as a property that has a value that has a particular meaning. So in this case likely just "The style properties associated with this node only (not including parents in the DOM)
".
It's unfortunate that mkdocstrings doesn't handle it given it's, as far as I can tell, a documented aspect of the Google docstring convention.
PS: Just omits or just emits?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type in properties docstrings is just omitted. You see the description but no type.
With a function style, you do see the type.
Will assume that's a bug in mkdocstrings, and go for property style docs then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may see about raising that with mkdocstrings then; it's unfortunate it does that.
@@ -966,6 +983,18 @@ def content_region(self) -> Region: | |||
content_region = self.region.shrink(self.styles.gutter) | |||
return content_region | |||
|
|||
@property | |||
def scrollable_content_region(self) -> Region: | |||
"""Gets an absolute region containing the scrollable content (minus padding, border, and scrollbars). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would likely be better with a property-style docstring.
|
||
Args: | ||
label (TextType): The new node's label. | ||
data (TreeDataType): Data associated with the new node. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data (TreeDataType): Data associated with the new node. | |
data (TreeDataType | None, optional): Data associated with the new node. |
return self._cursor_node | ||
|
||
@property | ||
def last_line(self) -> int: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing docstring
"tree--highlight-line", | ||
} | ||
|
||
show_root = reactive(True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this and the other reactives here have docstrings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably should, yeah.
"""Render a label for the given node. Override this to modify how labels are rendered. | ||
|
||
Args: | ||
node (TreeNode[TreeDataType]): A tree node. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
base_style
and style
are missing from the docstring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handful of "perhaps needs a docstring" and "perhaps needs to be a property-style docstring rather than function-style", that's all I could see.
Co-authored-by: Dave Pearson <[email protected]>
TreeControl
with a new implementation, and renamed it toTree
.DirectoryTree
with new implementation.code_browser.py
example.inherit_bindings=False
in the same way asinherit_css
Screen.Recording.2022-11-20.at.16.52.05.mov