Skip to content

Commit

Permalink
Merge pull request #4571 from Textualize/bind-fix
Browse files Browse the repository at this point in the history
fix for bindings not refreshed
  • Loading branch information
willmcgugan committed May 29, 2024
2 parents 4adaf03 + 3d8ffb5 commit a44119d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 20 deletions.
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [0.63.5]
## [0.63.6] - 2024-05-29

### Fixed

- Fixed issue with bindings not refreshing https://github.com/Textualize/textual/pull/4571

## [0.63.5] - 2024-05-28

### Fixed

Expand All @@ -15,7 +21,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

- Added `Styles.is_auto_width` and `Style.is_auto_height`

## [0.63.4]
## [0.63.4] - 2024-05-26

### Added

Expand Down Expand Up @@ -2033,6 +2039,7 @@ https://textual.textualize.io/blog/2022/11/08/version-040/#version-040
- New handler system for messages that doesn't require inheritance
- Improved traceback handling

[0.63.6]: https://github.com/Textualize/textual/compare/v0.63.5...v0.63.6
[0.63.5]: https://github.com/Textualize/textual/compare/v0.63.4...v0.63.5
[0.63.4]: https://github.com/Textualize/textual/compare/v0.63.3...v0.63.4
[0.63.3]: https://github.com/Textualize/textual/compare/v0.63.2...v0.63.3
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "textual"
version = "0.63.5"
version = "0.63.6"
homepage = "https://github.com/Textualize/textual"
repository = "https://github.com/Textualize/textual"
documentation = "https://textual.textualize.io/"
Expand Down
36 changes: 19 additions & 17 deletions src/textual/screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ def scroll_to_center(widget: Widget) -> None:
self.log.debug(widget, "was focused")

self._update_focus_styles(focused, blurred)
self.call_after_refresh(self.refresh_bindings)
self.refresh_bindings()

def _extend_compose(self, widgets: list[Widget]) -> None:
"""Insert Textual's own internal widgets.
Expand All @@ -742,27 +742,29 @@ def _on_mount(self, event: events.Mount) -> None:
self.screen_layout_refresh_signal.subscribe(
self, self._maybe_clear_tooltip, immediate=True
)
self.refresh_bindings()

async def _on_idle(self, event: events.Idle) -> None:
# Check for any widgets marked as 'dirty' (needs a repaint)
event.prevent_default()

if not self.app._batch_count and self.is_current:
if (
self._layout_required
or self._scroll_required
or self._repaint_required
or self._recompose_required
or self._dirty_widgets
):
self._update_timer.resume()
return

await self._invoke_and_clear_callbacks()

if self._bindings_updated:
self._bindings_updated = False
self.app.call_later(self.bindings_updated_signal.publish, self)
try:
if not self.app._batch_count and self.is_current:
if (
self._layout_required
or self._scroll_required
or self._repaint_required
or self._recompose_required
or self._dirty_widgets
):
self._update_timer.resume()
return

await self._invoke_and_clear_callbacks()
finally:
if self._bindings_updated:
self._bindings_updated = False
self.app.call_later(self.bindings_updated_signal.publish, self)

def _compositor_refresh(self) -> None:
"""Perform a compositor refresh."""
Expand Down

0 comments on commit a44119d

Please sign in to comment.