Fix handling of WEIGHT selectable items in the Pile#1006
Merged
Conversation
penguinolog
commented
Apr 15, 2025
| return col | ||
|
|
||
| def rows(self, size: tuple[int] | tuple[int, int], focus: bool = False) -> int: | ||
| def rows(self, size: tuple[int], focus: bool = False) -> int: |
Collaborator
Author
There was a problem hiding this comment.
fix type annotation. While not officially tuple[int, int] is accepted, it's incorrect behaviour.
penguinolog
commented
Apr 15, 2025
| """ | ||
| Return a size appropriate for passing to self.contents[i][0].render | ||
| """ | ||
| warnings.warn( |
Collaborator
Author
There was a problem hiding this comment.
it maybe questionable, but method is not used and not covered by tests.
penguinolog
commented
Apr 15, 2025
| heights: dict[int, int] = {} | ||
| weighted: dict[int, int] = {} | ||
| w_h_args: dict[int, tuple[int, int] | tuple[int] | tuple[()]] = {} | ||
| focus_position = self.focus_position |
Collaborator
Author
There was a problem hiding this comment.
pre-cache, asking self.focus on each iteration is expensive
e4416dc to
f582c0a
Compare
Pull Request Test Coverage Report for Build 14477399840Details
💛 - Coveralls |
In the case of not enough rows for full render, focused widget should receive priority and need to be rendered in the price of dropping other widgets. For the optimization purposes and better code organization, protected `_get_flow_rows_sizes` was detached from the `get_rows_sizes`. It should not be called manually. Fix urwid#1005
f582c0a to
d2b008b
Compare
penguinolog
commented
Apr 15, 2025
| for i, (w, (f, height)) in enumerate(self.contents): | ||
| if isinstance(w, Widget): | ||
| w_sizing = w.sizing() | ||
| else: |
Collaborator
Author
There was a problem hiding this comment.
I hope to kill this warning in the next major release.
Following documentation for 2.0, all widgets have to subclass Widget, but some users not adopted code due to no warnings from the urwid side
penguinolog
commented
Apr 15, 2025
| tuple(w_h_args[idx] for idx in range(len(w_h_args))), | ||
| ) | ||
|
|
||
| def _get_flow_rows_sizes( |
Collaborator
Author
There was a problem hiding this comment.
while code of this method is close to the get_rows_sizes, dedicated "semi copy-paste" should work faster and easier to debug
Pile
netbsd-srcmastr
pushed a commit
to NetBSD/pkgsrc
that referenced
this pull request
May 11, 2025
Urwid 3.0.2 =========== 2025-05-07 Bug fixes 🕷 ++++++++++++ * Bugfix: Corner case: Scrollbar render for only 1 row height by @penguinolog in urwid/urwid#1021 Urwid 3.0.1 =========== 2025-05-07 Bug fixes 🕷 ++++++++++++ * Packaging: drop setup.py and adjust requirements by @penguinolog in urwid/urwid#1018 Not updated `setup.py` lead to wrong metadata and mark of release 3.0.0 as Python 3.7 compatible. Since urwid is distribluted in the pre-packaged format (wheel), missing `setup.py` will not affect old toolchain users except special cases (manually enforced sdist usage). * Python 3.14 compatibility: adjust `AsyncioEventLoop` by @penguinolog in urwid/urwid#1019 Urwid 3.0.0 =========== 2025-05-06 Breaking Changes ⚠ ++++++++++++++++++ * Drop deprecated `__super` property by @penguinolog in urwid/urwid#956 * Drop deprecated `FlowWidget`, `BoxWidget` and `FixedWidget` widgets by @penguinolog in urwid/urwid#955 * Remove deprecated protected getter methods from the `Canvas` and `AttrSpec` by @penguinolog in urwid/urwid#958 * Remove support for the `bytes` based fonts by @penguinolog in urwid/urwid#961 * Remove deprecated `TermScroller` by @penguinolog in urwid/urwid#960 * Remove deprecated protected getter methods from the decoration widgets by @penguinolog in urwid/urwid#959 * Remove deprecated protected getter methods from the container widgets by @penguinolog in urwid/urwid#957 * Remove deprecated protected setters in the decoration widgets by @penguinolog in urwid/urwid#968 * Remove deprecated protected methods from the container widgets by @penguinolog in urwid/urwid#970 * Remove deprecated protected method `_set_done` from the `ProgressBar` by @penguinolog in urwid/urwid#971 New features 🗹 +++++++++++++++ * API Extension: make `CommandMap` `MutableMapping` by @penguinolog in urwid/urwid#969 * Make sizing computation much faster for nested containers by @ogayot in urwid/urwid#991 * `MetaSignals` subclass `ABCMeta` by @penguinolog in urwid/urwid#962 Deprecations ⚡ +++++++++++++++ * `MetaSuper` should be the last base for classes by @penguinolog in urwid/urwid#972 * Announce deprecated API removal versions by @penguinolog in urwid/urwid#999 Bug fixes 🕷 ++++++++++++ * Fix handling of WEIGHT selectable items in the `Pile` by @penguinolog in urwid/urwid#1006 Refactoring 🛠 ++++++++++++++ * Refactoring: micro optimizations of iterable items reconstruction by @penguinolog in urwid/urwid#1009 New Contributors ++++++++++++++++ * @ogayot made their first contribution in urwid/urwid#991
msk
pushed a commit
to msk/pkgsrc
that referenced
this pull request
May 11, 2026
Urwid 3.0.2 =========== 2025-05-07 Bug fixes 🕷 ++++++++++++ * Bugfix: Corner case: Scrollbar render for only 1 row height by @penguinolog in urwid/urwid#1021 Urwid 3.0.1 =========== 2025-05-07 Bug fixes 🕷 ++++++++++++ * Packaging: drop setup.py and adjust requirements by @penguinolog in urwid/urwid#1018 Not updated `setup.py` lead to wrong metadata and mark of release 3.0.0 as Python 3.7 compatible. Since urwid is distribluted in the pre-packaged format (wheel), missing `setup.py` will not affect old toolchain users except special cases (manually enforced sdist usage). * Python 3.14 compatibility: adjust `AsyncioEventLoop` by @penguinolog in urwid/urwid#1019 Urwid 3.0.0 =========== 2025-05-06 Breaking Changes ⚠ ++++++++++++++++++ * Drop deprecated `__super` property by @penguinolog in urwid/urwid#956 * Drop deprecated `FlowWidget`, `BoxWidget` and `FixedWidget` widgets by @penguinolog in urwid/urwid#955 * Remove deprecated protected getter methods from the `Canvas` and `AttrSpec` by @penguinolog in urwid/urwid#958 * Remove support for the `bytes` based fonts by @penguinolog in urwid/urwid#961 * Remove deprecated `TermScroller` by @penguinolog in urwid/urwid#960 * Remove deprecated protected getter methods from the decoration widgets by @penguinolog in urwid/urwid#959 * Remove deprecated protected getter methods from the container widgets by @penguinolog in urwid/urwid#957 * Remove deprecated protected setters in the decoration widgets by @penguinolog in urwid/urwid#968 * Remove deprecated protected methods from the container widgets by @penguinolog in urwid/urwid#970 * Remove deprecated protected method `_set_done` from the `ProgressBar` by @penguinolog in urwid/urwid#971 New features 🗹 +++++++++++++++ * API Extension: make `CommandMap` `MutableMapping` by @penguinolog in urwid/urwid#969 * Make sizing computation much faster for nested containers by @ogayot in urwid/urwid#991 * `MetaSignals` subclass `ABCMeta` by @penguinolog in urwid/urwid#962 Deprecations ⚡ +++++++++++++++ * `MetaSuper` should be the last base for classes by @penguinolog in urwid/urwid#972 * Announce deprecated API removal versions by @penguinolog in urwid/urwid#999 Bug fixes 🕷 ++++++++++++ * Fix handling of WEIGHT selectable items in the `Pile` by @penguinolog in urwid/urwid#1006 Refactoring 🛠 ++++++++++++++ * Refactoring: micro optimizations of iterable items reconstruction by @penguinolog in urwid/urwid#1009 New Contributors ++++++++++++++++ * @ogayot made their first contribution in urwid/urwid#991
jperkin
pushed a commit
to TritonDataCenter/pkgsrc
that referenced
this pull request
May 14, 2026
Urwid 3.0.2 =========== 2025-05-07 Bug fixes 🕷 ++++++++++++ * Bugfix: Corner case: Scrollbar render for only 1 row height by @penguinolog in urwid/urwid#1021 Urwid 3.0.1 =========== 2025-05-07 Bug fixes 🕷 ++++++++++++ * Packaging: drop setup.py and adjust requirements by @penguinolog in urwid/urwid#1018 Not updated `setup.py` lead to wrong metadata and mark of release 3.0.0 as Python 3.7 compatible. Since urwid is distribluted in the pre-packaged format (wheel), missing `setup.py` will not affect old toolchain users except special cases (manually enforced sdist usage). * Python 3.14 compatibility: adjust `AsyncioEventLoop` by @penguinolog in urwid/urwid#1019 Urwid 3.0.0 =========== 2025-05-06 Breaking Changes ⚠ ++++++++++++++++++ * Drop deprecated `__super` property by @penguinolog in urwid/urwid#956 * Drop deprecated `FlowWidget`, `BoxWidget` and `FixedWidget` widgets by @penguinolog in urwid/urwid#955 * Remove deprecated protected getter methods from the `Canvas` and `AttrSpec` by @penguinolog in urwid/urwid#958 * Remove support for the `bytes` based fonts by @penguinolog in urwid/urwid#961 * Remove deprecated `TermScroller` by @penguinolog in urwid/urwid#960 * Remove deprecated protected getter methods from the decoration widgets by @penguinolog in urwid/urwid#959 * Remove deprecated protected getter methods from the container widgets by @penguinolog in urwid/urwid#957 * Remove deprecated protected setters in the decoration widgets by @penguinolog in urwid/urwid#968 * Remove deprecated protected methods from the container widgets by @penguinolog in urwid/urwid#970 * Remove deprecated protected method `_set_done` from the `ProgressBar` by @penguinolog in urwid/urwid#971 New features 🗹 +++++++++++++++ * API Extension: make `CommandMap` `MutableMapping` by @penguinolog in urwid/urwid#969 * Make sizing computation much faster for nested containers by @ogayot in urwid/urwid#991 * `MetaSignals` subclass `ABCMeta` by @penguinolog in urwid/urwid#962 Deprecations ⚡ +++++++++++++++ * `MetaSuper` should be the last base for classes by @penguinolog in urwid/urwid#972 * Announce deprecated API removal versions by @penguinolog in urwid/urwid#999 Bug fixes 🕷 ++++++++++++ * Fix handling of WEIGHT selectable items in the `Pile` by @penguinolog in urwid/urwid#1006 Refactoring 🛠 ++++++++++++++ * Refactoring: micro optimizations of iterable items reconstruction by @penguinolog in urwid/urwid#1009 New Contributors ++++++++++++++++ * @ogayot made their first contribution in urwid/urwid#991
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In the case of not enough rows for full render,
focused widget should receive priority
and need to be rendered in the price of dropping other widgets.
For the optimization purposes and better code organization, protected
_get_flow_rows_sizeswas detached from theget_rows_sizes. It should not be called manually.Fix #1005
Checklist
masterbranchtoxsuccessfully in local environment