Skip to content

Typing: Extend wimp typing annotations - #604

Merged
penguinolog merged 1 commit into
urwid:masterfrom
penguinolog:typing_radiobutton_checkbox
Sep 22, 2023
Merged

Typing: Extend wimp typing annotations#604
penguinolog merged 1 commit into
urwid:masterfrom
penguinolog:typing_radiobutton_checkbox

Conversation

@penguinolog

Copy link
Copy Markdown
Collaborator

Add overload info for constructors of:

  • CheckBox
  • RadioButton
  • Button

Fix info for Columns constructor (GIVEN size)

Checklist
  • I've ensured that similar functionality has not already been implemented
  • I've ensured that similar functionality has not earlier been proposed and declined
  • I've branched off the master or python-dual-support branch
  • I've merged fresh upstream into my branch recently
  • I've ran tox successfully in local environment
  • I've included docstrings and/or documentation and/or examples for my code (if this is a new feature)

Partial #406

@penguinolog penguinolog added Feature Feature request/implementation refactoring labels Sep 13, 2023
@penguinolog
penguinolog requested a review from wardi September 13, 2023 14:45
Comment thread urwid/widget/wimp.py
# Initial create expect no callbacks call, create explicit
super().__init__(
Columns(
[(Sizing.FIXED, self.reserve_columns, self.states[state]), self._label],

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

following Columns it's legacy API for GIVEN element sizing settings

@coveralls

coveralls commented Sep 13, 2023

Copy link
Copy Markdown

Coverage Status

coverage: 73.57% (+0.04%) from 73.527% when pulling db7d55a on penguinolog:typing_radiobutton_checkbox into 9f94979 on urwid:master.

Comment thread urwid/widget/wimp.py
# (this variable is picked up by the MetaSignals metaclass)
signals: typing.ClassVar[list[str]] = ["change", "postchange"]

@typing.overload

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

decorated code is only type annotation explaining difference for useful argument types depending on has_mixed and user_data

Comment thread urwid/widget/wimp.py
self,
group: MutableSequence[CheckBox],
label,
state: bool | Literal["mixed", "first True"] = "first True",

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mixed is incorrect state because by default has_mixed is false and change possibility is not public exposed

@penguinolog
penguinolog force-pushed the typing_radiobutton_checkbox branch 2 times, most recently from 2d58c97 to 90ed3f8 Compare September 22, 2023 15:19
Add overload info for constructors of:
* `CheckBox`
* `RadioButton`
* `Button`

Fix info for `Columns` constructor (`GIVEN` size)
Fix info for `Pile` constructor
@penguinolog
penguinolog force-pushed the typing_radiobutton_checkbox branch from 90ed3f8 to db7d55a Compare September 22, 2023 15:24
@penguinolog
penguinolog merged commit 3265dc6 into urwid:master Sep 22, 2023
@penguinolog
penguinolog deleted the typing_radiobutton_checkbox branch September 22, 2023 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature Feature request/implementation refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants