-
-
Notifications
You must be signed in to change notification settings - Fork 926
added textual.getters #5930
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
added textual.getters #5930
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.
I find a mistake in error info.
return self | ||
child = obj._nodes._get_by_id(self.child_id) | ||
if child is None: | ||
raise NoMatches(f"No child found with id={id!r}") |
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 think the id
should be self.child_id
.
if not isinstance(child, self.expect_type): | ||
if not isinstance(child, self.expect_type): | ||
raise WrongType( | ||
f"Child with id={id!r} is wrong type; expected {self.expect_type}, got" |
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 think the id
should be self.child_id
.
|
Good for DRY
getters.query_one
getters.child_by_id
These create nicely typed properties which return a Widget.
Can be replaced with:
Works nicely, just don't look behind the curtain.