mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
implicit pause
This commit is contained in:
@@ -468,8 +468,10 @@ class MessagePump(metaclass=_MessagePumpMeta):
|
||||
due to calling it within the node's own task.
|
||||
|
||||
"""
|
||||
|
||||
if self._task is None or asyncio.current_task() is self._task:
|
||||
assert (
|
||||
self._task is not None
|
||||
), "Node must be running before calling wait_for_refresh"
|
||||
if asyncio.current_task() is self._task:
|
||||
return False
|
||||
refreshed_event = asyncio.Event()
|
||||
self.call_after_refresh(refreshed_event.set)
|
||||
|
||||
@@ -434,6 +434,7 @@ class Pilot(Generic[ReturnType]):
|
||||
widget_at = None
|
||||
for chain in range(1, times + 1):
|
||||
for mouse_event_cls in events:
|
||||
await self.pause()
|
||||
# Get the widget under the mouse before the event because the app might
|
||||
# react to the event and move things around. We override on each iteration
|
||||
# because we assume the final event in `events` is the actual event we care
|
||||
@@ -453,8 +454,8 @@ class Pilot(Generic[ReturnType]):
|
||||
# we patch the offset in there as well.
|
||||
app.mouse_position = offset
|
||||
screen._forward_event(event)
|
||||
await self.pause()
|
||||
|
||||
await self.pause()
|
||||
return widget is None or widget_at is target_widget
|
||||
|
||||
async def _wait_for_screen(self, timeout: float = 30.0) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user