Skip to content

Commit e537125

Browse files
authored
Catch no widget (#3790)
* Catch no widget * changelog * version bump * remove prints
1 parent be8581e commit e537125

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8-
## Unreleased
8+
## [0.44.0] - 2023-12-1
99

1010
### Changed
1111

12+
- Breaking change: Dropped 3.7 support https://github.com/Textualize/textual/pull/3766
1213
- Breaking changes https://github.com/Textualize/textual/issues/1530
1314
- `link-hover-background` renamed to `link-background-hover`
1415
- `link-hover-color` renamed to `link-color-hover`
@@ -20,6 +21,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
2021
- Added support for Ctrl+Fn and Ctrl+Shift+Fn keys in urxvt https://github.com/Textualize/textual/pull/3737
2122
- Friendly error messages when trying to mount non-widgets https://github.com/Textualize/textual/pull/3780
2223

24+
### Fixed
25+
26+
- Fixed NoWidget when mouse goes outside window https://github.com/Textualize/textual/pull/3790
27+
- Removed suprious print statements from press_keys https://github.com/Textualize/textual/issues/3785
28+
2329
## [0.43.2] - 2023-11-29
2430

2531
### Fixed
@@ -1488,6 +1494,7 @@ https://textual.textualize.io/blog/2022/11/08/version-040/#version-040
14881494
- New handler system for messages that doesn't require inheritance
14891495
- Improved traceback handling
14901496

1497+
[0.44.0]: https://github.com/Textualize/textual/compare/v0.43.2...v0.44.0
14911498
[0.43.2]: https://github.com/Textualize/textual/compare/v0.43.1...v0.43.2
14921499
[0.43.1]: https://github.com/Textualize/textual/compare/v0.43.0...v0.43.1
14931500
[0.43.0]: https://github.com/Textualize/textual/compare/v0.42.0...v0.43.0

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "textual"
3-
version = "0.43.2"
3+
version = "0.44.0"
44
homepage = "https://github.com/Textualize/textual"
55
repository = "https://github.com/Textualize/textual"
66
documentation = "https://textual.textualize.io/"

src/textual/app.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,7 +1169,6 @@ async def _press_keys(self, keys: Iterable[str]) -> None:
11691169
for key in keys:
11701170
if key.startswith("wait:"):
11711171
_, wait_ms = key.split(":")
1172-
print(f"(pause {wait_ms}ms)")
11731172
await asyncio.sleep(float(wait_ms) / 1000)
11741173
else:
11751174
if len(key) == 1 and not key.isalnum():
@@ -1180,7 +1179,6 @@ async def _press_keys(self, keys: Iterable[str]) -> None:
11801179
char = unicodedata.lookup(_get_unicode_name_from_key(original_key))
11811180
except KeyError:
11821181
char = key if len(key) == 1 else None
1183-
print(f"press {key!r} (char={char!r})")
11841182
key_event = events.Key(key, char)
11851183
key_event._set_sender(app)
11861184
driver.send_event(key_event)
@@ -2698,13 +2696,19 @@ async def on_event(self, event: events.Event) -> None:
26982696

26992697
self.screen._forward_event(event)
27002698

2701-
if isinstance(event, events.MouseUp):
2702-
if self._mouse_down_widget is not None and (
2703-
self.get_widget_at(event.x, event.y)[0]
2704-
is self._mouse_down_widget
2705-
):
2706-
click_event = events.Click.from_event(event)
2707-
self.screen._forward_event(click_event)
2699+
if (
2700+
isinstance(event, events.MouseUp)
2701+
and self._mouse_down_widget is not None
2702+
):
2703+
try:
2704+
if (
2705+
self.get_widget_at(event.x, event.y)[0]
2706+
is self._mouse_down_widget
2707+
):
2708+
click_event = events.Click.from_event(event)
2709+
self.screen._forward_event(click_event)
2710+
except NoWidget:
2711+
pass
27082712

27092713
elif isinstance(event, events.Key):
27102714
if not await self.check_bindings(event.key, priority=True):

0 commit comments

Comments
 (0)