From 7988371ae6fda5eddfdfbb7e2f21dfa82de1ab0a Mon Sep 17 00:00:00 2001 From: Russell Martin Date: Thu, 29 Aug 2024 13:37:42 -0400 Subject: [PATCH] Replace `add_background_task()` in Toga automation bootstrap --- automation/src/automation/bootstraps/toga.py | 6 ++---- changes/1977.misc.rst | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) create mode 100644 changes/1977.misc.rst diff --git a/automation/src/automation/bootstraps/toga.py b/automation/src/automation/bootstraps/toga.py index af271a234..f11057c94 100644 --- a/automation/src/automation/bootstraps/toga.py +++ b/automation/src/automation/bootstraps/toga.py @@ -26,10 +26,8 @@ def startup(self): self.main_window.content = main_box self.main_window.show() - self.add_background_task(self.exit_soon) - - async def exit_soon(self, app: toga.App, **kwargs): - """Background task that closes the app after a few seconds.""" + async def on_running(self): + """Close the app after a few seconds.""" await asyncio.sleep(2) print("{EXIT_SUCCESS_NOTIFY}") print("{BRIEFCASE_EXIT_SUCCESS_SIGNAL}") diff --git a/changes/1977.misc.rst b/changes/1977.misc.rst new file mode 100644 index 000000000..efc4f1481 --- /dev/null +++ b/changes/1977.misc.rst @@ -0,0 +1 @@ +The deprecated ``add_background_task()`` API was replaced in the Toga automation bootstrap.