Skip to content

Commit 4ec1935

Browse files
committed
version bump
1 parent 87622ad commit 4ec1935

File tree

4 files changed

+26
-7
lines changed

4 files changed

+26
-7
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ 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+
9+
## [0.68.1] - 2024-06-16
10+
11+
### Added
12+
13+
- Added `App.simulate_key`
14+
15+
### Fixed
16+
17+
- Fixed issue with pop_screen launched from an action
18+
819
## [0.68.0] - 2024-06-14
920

1021
### Added
@@ -2132,6 +2143,7 @@ https://textual.textualize.io/blog/2022/11/08/version-040/#version-040
21322143
- New handler system for messages that doesn't require inheritance
21332144
- Improved traceback handling
21342145

2146+
[0.68.1]: https://github.com/Textualize/textual/compare/v0.68.0...v0.68.1
21352147
[0.68.0]: https://github.com/Textualize/textual/compare/v0.67.1...v0.68.0
21362148
[0.67.1]: https://github.com/Textualize/textual/compare/v0.67.0...v0.67.1
21372149
[0.67.0]: https://github.com/Textualize/textual/compare/v0.66.0...v0.67.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.68.0"
3+
version = "0.68.1"
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: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2977,11 +2977,20 @@ def _binding_chain(self) -> list[tuple[DOMNode, _Bindings]]:
29772977

29782978
return namespace_bindings
29792979

2980+
def simulate_key(self, key: str) -> None:
2981+
"""Simulate a key press.
2982+
2983+
This will perform the same action as if the user had pressed the key.
2984+
2985+
Args:
2986+
key: Key to simulate. May also be the name of a key, e.g. "space".
2987+
"""
2988+
self.call_later(self.check_bindings, key)
2989+
29802990
async def check_bindings(self, key: str, priority: bool = False) -> bool:
29812991
"""Handle a key press.
29822992
2983-
This method is used internally by the bindings system, but may be called directly
2984-
if you wish to *simulate* a key being pressed.
2993+
This method is used internally by the bindings system.
29852994
29862995
Args:
29872996
key: A key.
@@ -3159,7 +3168,6 @@ async def _dispatch_action(
31593168
params=params,
31603169
)
31613170

3162-
reset_active_message_pump = active_message_pump.set(namespace)
31633171
try:
31643172
private_method = getattr(namespace, f"_action_{action_name}", None)
31653173
if callable(private_method):
@@ -3176,8 +3184,7 @@ async def _dispatch_action(
31763184
except SkipAction:
31773185
# The action method raised this to explicitly not handle the action
31783186
log.system(f"<action> {action_name!r} skipped.")
3179-
finally:
3180-
active_message_pump.reset(reset_active_message_pump)
3187+
31813188
return False
31823189

31833190
async def _broker_event(

src/textual/widgets/_footer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ async def on_mouse_down(self) -> None:
103103
if self._disabled:
104104
self.app.bell()
105105
else:
106-
await self.app.check_bindings(self.key)
106+
self.app.simulate_key(self.key)
107107

108108
def _watch_compact(self, compact: bool) -> None:
109109
self.set_class(compact, "-compact")

0 commit comments

Comments
 (0)