mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
add app to active message pump (#2071)
* add app to active message pump * made sender private * changelog
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -53,7 +53,7 @@ from ._ansi_sequences import SYNC_END, SYNC_START
|
||||
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
|
||||
@@ -918,6 +918,7 @@ class App(Generic[ReturnType], DOMNode):
|
||||
)
|
||||
|
||||
# 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.
|
||||
@@ -973,6 +974,7 @@ class App(Generic[ReturnType], DOMNode):
|
||||
raise
|
||||
|
||||
pilot = Pilot(app)
|
||||
active_message_pump.set(self)
|
||||
auto_pilot_task = create_task(
|
||||
run_auto_pilot(auto_pilot, pilot), name=repr(pilot)
|
||||
)
|
||||
|
||||
@@ -42,6 +42,7 @@ class Driver(ABC):
|
||||
|
||||
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:
|
||||
|
||||
@@ -64,12 +64,6 @@ class Message:
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user