From 7aa434a1afe5386ee66ce02dfade9cc79e0dd898 Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Sat, 9 Nov 2024 16:23:32 +0000 Subject: [PATCH] rename --- CHANGELOG.md | 1 + src/textual/app.py | 3 ++- src/textual/driver.py | 14 +++++++------- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe3dddb20f..a69320fd14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Changed - `Driver.process_event` is now `Driver.process_message` https://github.com/Textualize/textual/pull/5217 +- `Driver.send_event` is now `Driver.send_message` https://github.com/Textualize/textual/pull/5217 ## [0.85.2] - 2024-11-02 diff --git a/src/textual/app.py b/src/textual/app.py index 6ffccdb657..fc9e361f08 100644 --- a/src/textual/app.py +++ b/src/textual/app.py @@ -1678,7 +1678,7 @@ async def _press_keys(self, keys: Iterable[str]) -> None: char = key if len(key) == 1 else None key_event = events.Key(key, char) key_event.set_sender(app) - driver.send_event(key_event) + driver.send_message(key_event) await wait_for_idle(0) await app._animator.wait_until_complete() await wait_for_idle(0) @@ -4470,6 +4470,7 @@ def _on_terminal_supports_in_band_window_resize( self.log.debug(message) def _on_idle(self) -> None: + """Send app resize events on idle, so we don't do more resizing that necessary.""" event = self._resize_event if event is not None: self._resize_event = None diff --git a/src/textual/driver.py b/src/textual/driver.py index f2ecc4d621..b16b982b5e 100644 --- a/src/textual/driver.py +++ b/src/textual/driver.py @@ -64,21 +64,21 @@ def can_suspend(self) -> bool: """Can this driver be suspended?""" return False - def send_event(self, event: events.Event) -> None: - """Send an event to the target app. + def send_message(self, message: messages.Message) -> None: + """Send a message to the target app. Args: - event: An event. + message: A message. """ asyncio.run_coroutine_threadsafe( - self._app._post_message(event), loop=self._loop + self._app._post_message(message), loop=self._loop ) def process_message(self, message: messages.Message) -> None: """Perform additional processing on a message, prior to sending. Args: - event: An event to send. + event: A message to process. """ # NOTE: This runs in a thread. # Avoid calling methods on the app. @@ -111,7 +111,7 @@ def process_message(self, message: messages.Message) -> None: self._down_buttons.clear() move_event = self._last_move_event for button in buttons: - self.send_event( + self.send_message( MouseUp( x=move_event.x, y=move_event.y, @@ -128,7 +128,7 @@ def process_message(self, message: messages.Message) -> None: ) self._last_move_event = message - self.send_event(message) + self.send_message(message) @abstractmethod def write(self, data: str) -> None: