force updates

This commit is contained in:
Will McGugan
2023-04-26 10:23:23 +01:00
parent 441b98d7a7
commit ec09fb5afc

View File

@@ -139,20 +139,22 @@ class Pilot(Generic[ReturnType]):
delay: Seconds to pause, or None to wait for cpu idle. delay: Seconds to pause, or None to wait for cpu idle.
""" """
# These sleep zeros, are to force asyncio to give up a time-slice, # These sleep zeros, are to force asyncio to give up a time-slice,
self.app.screen._on_timer_update() # Force one last repaint
if delay is None: if delay is None:
await wait_for_idle(0) await wait_for_idle(0)
else: else:
await asyncio.sleep(delay) await asyncio.sleep(delay)
self.app.screen._on_timer_update()
async def wait_for_animation(self) -> None: async def wait_for_animation(self) -> None:
"""Wait for any current animation to complete.""" """Wait for any current animation to complete."""
await self._app.animator.wait_for_idle() await self._app.animator.wait_for_idle()
self.app.screen._on_timer_update()
async def wait_for_scheduled_animations(self) -> None: async def wait_for_scheduled_animations(self) -> None:
"""Wait for any current and scheduled animations to complete.""" """Wait for any current and scheduled animations to complete."""
await self._app.animator.wait_until_complete() await self._app.animator.wait_until_complete()
await wait_for_idle() await wait_for_idle()
self.app.screen._on_timer_update()
async def exit(self, result: ReturnType) -> None: async def exit(self, result: ReturnType) -> None:
"""Exit the app with the given result. """Exit the app with the given result.