Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add app to active message pump #2071

Merged
merged 4 commits into from
Mar 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

- Dropped "loading-indicator--dot" component style from LoadingIndicator https://github.com/Textualize/textual/pull/2050

### Removed

- Removed `sender` attribute from messages. It's now just private (`_sender`). https://github.com/Textualize/textual/pull/2071

### Fixed

- Fixed borders not rendering correctly. https://github.com/Textualize/textual/pull/2074


### Changed

- Breaking change: changed default behaviour of `Vertical` (see `VerticalScroll`) https://github.com/Textualize/textual/issues/1957
Expand Down
4 changes: 3 additions & 1 deletion src/textual/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
from ._asyncio import create_task
from ._callback import invoke
from ._compose import compose
from ._context import active_app
from ._context import active_app, active_message_pump
from ._event_broker import NoHandler, extract_handler_actions
from ._path import _make_path_object_relative
from ._wait import wait_for_idle
Expand Down Expand Up @@ -918,6 +918,7 @@ async def run_app(app) -> None:
)

# Launch the app in the "background"
active_message_pump.set(app)
app_task = create_task(run_app(app), name=f"run_test {app}")

# Wait until the app has performed all startup routines.
Expand Down Expand Up @@ -973,6 +974,7 @@ async def run_auto_pilot(
raise

pilot = Pilot(app)
active_message_pump.set(self)
auto_pilot_task = create_task(
run_auto_pilot(auto_pilot, pilot), name=repr(pilot)
)
Expand Down
1 change: 1 addition & 0 deletions src/textual/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def send_event(self, event: events.Event) -> None:

def process_event(self, event: events.Event) -> None:
"""Performs some additional processing of events."""
event._set_sender(self._target)
if isinstance(event, events.MouseDown):
self._mouse_down_time = event.time
if event.button:
Expand Down
6 changes: 0 additions & 6 deletions src/textual/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,6 @@ def __init_subclass__(
if namespace is not None:
cls.namespace = namespace

@property
def sender(self) -> MessageTarget:
"""The sender of the message."""
assert self._sender is not None
return self._sender

@property
def is_forwarded(self) -> bool:
return self._forwarded
Expand Down