From 319e8aae5a41393dc412114edc74fe4b922313a5 Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Fri, 2 Aug 2024 10:31:17 +0100 Subject: [PATCH] fix slow UI --- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/textual/scrollbar.py | 6 ++++-- src/textual/widget.py | 8 +++++--- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 188d9c94d7..ea1c614dd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +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.75.1] - 2024-08-02 + +### Fixed + +- Fixed issue with Enter events causing unresponsive UI + ## [0.75.0] - 2024-08-01 ### Added @@ -2250,6 +2257,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.75.1]: https://github.com/Textualize/textual/compare/v0.75.0...v0.75.1 [0.75.0]: https://github.com/Textualize/textual/compare/v0.74.0...v0.75.0 [0.74.0]: https://github.com/Textualize/textual/compare/v0.73.0...v0.74.0 [0.73.0]: https://github.com/Textualize/textual/compare/v0.72.0...v0.73.0 diff --git a/pyproject.toml b/pyproject.toml index 82c9eef6ba..24c4e924bd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "textual" -version = "0.75.0" +version = "0.75.1" homepage = "https://github.com/Textualize/textual" repository = "https://github.com/Textualize/textual" documentation = "https://textual.textualize.io/" diff --git a/src/textual/scrollbar.py b/src/textual/scrollbar.py index 069b33f6ab..d5d8cc259a 100644 --- a/src/textual/scrollbar.py +++ b/src/textual/scrollbar.py @@ -304,10 +304,12 @@ def _on_hide(self, event: events.Hide) -> None: self.grabbed = None def _on_enter(self, event: events.Enter) -> None: - self.mouse_over = True + if event.node is self: + self.mouse_over = True def _on_leave(self, event: events.Leave) -> None: - self.mouse_over = False + if event.node is self: + self.mouse_over = False def action_scroll_down(self) -> None: """Scroll vertical scrollbars down, horizontal scrollbars right.""" diff --git a/src/textual/widget.py b/src/textual/widget.py index 2d8592e4e3..ae3b042597 100644 --- a/src/textual/widget.py +++ b/src/textual/widget.py @@ -3848,11 +3848,13 @@ def _on_mount(self, event: events.Mount) -> None: self.show_horizontal_scrollbar = True def _on_leave(self, event: events.Leave) -> None: - self.mouse_hover = False - self.hover_style = Style() + if event.node is self: + self.mouse_hover = False + self.hover_style = Style() def _on_enter(self, event: events.Enter) -> None: - self.mouse_hover = True + if event.node is self: + self.mouse_hover = True def _on_focus(self, event: events.Focus) -> None: self.has_focus = True