-
Notifications
You must be signed in to change notification settings - Fork 318
Fix CheckBox default state validation and initialization #553
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
Conversation
@@ -257,15 +270,12 @@ def set_state(self, state: bool | Literal['mixed'], do_callback: bool = True) -> | |||
# self._state is None is a special case when the CheckBox | |||
# has just been created | |||
old_state = self._state | |||
if do_callback and old_state is not None: |
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.
old_state is not None beacause explicit initialization used
|
||
# Initial create expect no callbacks call, create explicit | ||
super().__init__( | ||
Columns( |
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.
explicit full init -> no "semi-initialized state"
""" | ||
super().__init__(None) # self.w set by set_state below | ||
self._label = Text("") |
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.
we can set all in 1 call instead of chain "construct empty -> call helper to call modifier to replace value from constructor"
[...'[X] Extra onions '] | ||
>>> cb.render((20,), focus=True).text | ||
[b'[X] Extra onions '] | ||
>>> CheckBox("Test", None) |
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.
test for issue
Fix #552
Checklist
master
orpython-dual-support
branchtox
successfully in local environment