Details
-
User Story
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
None
-
None
Description
As a Python Developer who uses PySide to execute tasks in a background thread, I would like to use PySide and Python's asyncio features within an context manager that manages additional async tasks that could start prior to exec() so that I can use the same eventloop used by QtAsyncio.run but start co-routines prior or simultaneously to opening the window.
Just having asyncio is awesome but I wish I could send QtAsyncio.run() an object that supports the AbstractContextManager or (even better) Async AbstractAsyncContextManager interfaces so that I could easily clean up any Tasks/Futures not started or finished after the main window closes but the event loop has ended. Basically work like a destructor.
Basically I want to run this within a context manager that manages the event loop lifespan.....
- Start event loop
- Start background consumer co-routine with a shared Queue object.
- Start Qt Application window and show window. Buttons add jobs to Queue object mentioned in step 2.
- On exit of Qt Application (after returning from the exec() call), keep event loop open so that it allows me to manually clean up Queue and wait for background consumer co-routine to fully await