Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Nov 9, 2024
1 parent e157c6b commit 7aa434a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion src/textual/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions src/textual/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand All @@ -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:
Expand Down

0 comments on commit 7aa434a

Please sign in to comment.