aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/PySide6/QtAsyncio/__init__.py
Commit message (Collapse)AuthorAgeFilesLines
* QtAsyncio: Use modern typing syntaxAdrian Herrmann2024-06-281-6/+5
| | | | | | | | | | | We can already use the modern typing syntax introduced with Python 3.10 in 3.9 via future statement definitions, even before we raise the minimum Python version to 3.10. Task-number: PYSIDE-769 Task-number: PYSIDE-2786 Change-Id: I560d0c25f3503217f920906a5b26193282b0247b Reviewed-by: Christian Tismer <tismer@stackless.com>
* QtAsyncio: Properly document run() argsAdrian Herrmann2024-06-271-1/+19
| | | | | | | | | Properly document the arguments to QtAsyncio.run() with a docstring instead of leaving it only to the module rst. Task-number: PYSIDE-769 Change-Id: Ia4d63b3cdf81d052203a2752ed3ca6cb0b40f814 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* QtAsyncio: Remove application arg from loop policyAdrian Herrmann2024-06-271-1/+6
| | | | | | | | | | | | | Remove the optional application argument from the constructor of QAsyncioEventLoopPolicy, as it is unnecessary. If a QCoreApplication or other type of qApp was created outside of QtAsyncio, it will always be retrieved by QCoreApplication.instance(), and therefore passing it as an argument makes little sense. Task-number: PYSIDE-769 Change-Id: Iac7a913a1c9d6ebbb0984fe11f8b5cda955baab1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* Python-3.10: Allow the new syntax for Python 3.9Christian Tismer2024-06-201-0/+1
| | | | | | | | Add a future statement to all Python source files. Task-number: PYSIDE-2786 Change-Id: Icd6688c7795a9e16fdcaa829686d57792df27690 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
* QtAsyncio: Improve documentation (part 2)Adrian Herrmann2024-05-101-2/+2
| | | | | | | | | | Improve the inline documentation of QtAsyncio with more comprehensive comments. Pick-to: 6.7 Task-number: PYSIDE-769 Change-Id: I7306da43d8f1f350dae188f5346cdec8f60a7a06 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QtAsyncio: Reset loop policy after QtAsyncio.run()Adrian Herrmann2024-03-111-2/+13
| | | | | | | | | | | | | | When running QtAsyncio.run(), the global asyncio event loop policy is set. Currently, the policy setting is kept to QtAsyncio's policy even after QtAsyncio.run() returns, which can lead to unexpected behavior (e.g., if executing asyncio.run() afterwards expecting the default event loop to be used). Reset the event loop policy to the default one after returning from QtAsyncio.run() to mitigate this. Pick-to: 6.6 Task-number: PYSIDE-769 Change-Id: Ifd31c0924317ba09c53ded165c9a5d6f1e2dc808 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* QtAsyncio: Add handle_sigint argument to run()Adrian Herrmann2024-03-071-1/+3
| | | | | | | | | | | | An argument handle_sigint determines whether QtAsyncio should handle SIGINT (Ctrl+C) and shut down the event loop when it is received. The default is False. This can be set to True if you want QtAsyncio to take care of handling SIGINT instead of your program. Pick-to: 6.6 Task-number: PYSIDE-769 Change-Id: Ie4364025448405f36158a8e997d90ae143961ba8 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* QtAsyncio: Fix missing return value of run()Adrian Herrmann2024-03-071-2/+2
| | | | | | | | | | If QtAsyncio.run() executes asyncio.run(), then its return value should be passed on. Pick-to: 6.6 Task-number: PYSIDE-769 Change-Id: Ic36e3bfd0f15b0697e310af3d9eb4ff6998ffce0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QtAsyncio: Introduce quit_qapp argumentAdrian Herrmann2024-01-301-2/+3
| | | | | | | | | | | | | | | | A new optional argument quit_qapp can be passed to QtAsyncio.run() to configure whether the QCoreApplication at the core of QtAsyncio should be shut down when asyncio finishes. A special case where one would want to disable this is test suites that want to reuse a single QCoreApplication instance across all unit tests, which would fail if this instance is shut down every time. Pick-to: 6.6 Fixes: PYSIDE-2575 Task-number: PYSIDE-769 Change-Id: I49cd0a50311fb30cc50df9b7f6a6d73fe8c58613 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QtAsyncio: Fix QtAsyncio.run()Adrian Herrmann2024-01-051-5/+25
| | | | | | | | | | | | Programs started with QtAsyncio.run() were not terminating correctly in some scenarios. Add a keep_running argument to distinguish cases where the program is supposed to end after a coroutine finished and those where we want to keep the event loop active. Pick-to: 6.6 Task-number: PYSIDE-769 Change-Id: I87857bac7c55aa68c0e273fb0ecf94848d8c2bae Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QtAsyncio: Add QtAsyncio.run() functionAdrian Herrmann2023-12-201-0/+12
| | | | | | | | | | | | | | | | | Add a QtAsyncio.run() function as the new recommended method to launch QtAsyncio programs. This abstracts the event loop policy and reduces the API to one single call. Additionally, this will allow to transparently replace the event loop policy with a loop factory when event loop policies are removed in Python 3.15 following their deprecation in 3.12. More information: https://discuss.python.org/t/removing-the-asyncio-policy-system-asyncio-set-event-loop-policy-in-python-3-15/37553 Pick-to: 6.6 Task-number: PYSIDE-769 Change-Id: I59d7eeb81debe92315351995f041caead4f51d8b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Implement custom asyncio event loop based on QtAdrian Herrmann2023-07-271-0/+14
asyncio is an established library for Python applications with concurrency and asynchronous I/O, and the de facto standard that multiple other async frameworks build upon. Like Qt, it is based on an event loop, so to this end, it offers an extensive API to implement custom event loops that applications using asyncio can then leverage. Task-number: PYSIDE-769 Change-Id: I3daf5d631e2fa0d44fd8c3c272ac5cce96f58653 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>