aboutsummaryrefslogtreecommitdiffstats
path: root/examples/async
Commit message (Collapse)AuthorAgeFilesLines
* QtAsyncio: Fix wrong args in examplesAdrian Herrmann2024-07-052-2/+2
| | | | | | | | | | The minimal and eratosthenes examples kept now-invalid arguments to QtAsyncio.run() as leftovers from a previous change. Pick-to: 6.7 Task-number: PYSIDE-769 Change-Id: I64ec3dcf136f44b757ef93743b96aa0a2d8a91be Reviewed-by: Friedemann Kleint <[email protected]>
* QtAsyncio: Remove application arg from loop policyAdrian Herrmann2024-06-272-2/+2
| | | | | | | | | | | | | 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 <[email protected]> Reviewed-by: Christian Tismer <[email protected]>
* Python-3.10: Allow the new syntax for Python 3.9Christian Tismer2024-06-204-0/+4
| | | | | | | | Add a future statement to all Python source files. Task-number: PYSIDE-2786 Change-Id: Icd6688c7795a9e16fdcaa829686d57792df27690 Reviewed-by: Adrian Herrmann <[email protected]>
* QtAsyncio: Let examples handle SIGINTAdrian Herrmann2024-04-242-2/+2
| | | | | | | | | | Make the two QtAsyncio examples handle the Ctrl + C interrupt for a more natural user experience. Pick-to: 6.7 Task-number: PYSIDE-769 Change-Id: I1dd87227fd1f1b70684476087f776ccc82da9571 Reviewed-by: Friedemann Kleint <[email protected]>
* examples: Simplify minimal_asyncioAdrian Herrmann2024-02-161-24/+2
| | | | | | | | | | | | For historical reasons, the minimal asyncio example was unnecessarily complicated (as it tried to follow the trio example's approach of an AsyncHelper class). Simplify the code to make it more straightforward and understandable. Pick-to: 6.6 Task-number: PYSIDE-769 Change-Id: I376b73356f7e46f640db482a9e149f1a6fa54dd6 Reviewed-by: Christian Tismer <[email protected]>
* QtAsyncio: Add QtAsyncio.run() functionAdrian Herrmann2023-12-202-7/+4
| | | | | | | | | | | | | | | | | 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 <[email protected]> Reviewed-by: Cristian Maureira-Fredes <[email protected]>
* QtAsyncio: Catch keyboard interruptsAdrian Herrmann2023-12-192-6/+0
| | | | | | | | | | | | | Catch keyboard interrupts by catching the SIGINT signal and handling it with the default handler. Register the handler with the QAsyncioEventLoopPolicy so that this is always done when using QtAsyncio. Pick-to: 6.6 Task-number: PYSIDE-769 Change-Id: I7b35367a50ab03eb014faabf6b6a3b21a6a3cd6c Reviewed-by: Cristian Maureira-Fredes <[email protected]> Reviewed-by: Friedemann Kleint <[email protected]>
* doc: Use different titles for async examplesAdrian Herrmann2023-11-242-4/+4
| | | | | | | | | Give the two async examples different titles in documentation so they don't appear with the same name in navigation. Pick-to: 6.6 Change-Id: I342a5b611e3d2b6cc415162c8ce5a0ee9441c8a8 Reviewed-by: Cristian Maureira-Fredes <[email protected]>
* async: Remove unneeded signal from exampleAdrian Herrmann2023-10-101-6/+0
| | | | | | | | | Remove the unneeded done_signal from the eratosthenes asyncio example. Pick-to: 6.6 Task-number: PYSIDE-769 Change-Id: I5cc347ebb265e55afa82d37ce07fa2c6378ce133 Reviewed-by: Friedemann Kleint <[email protected]>
* async: Revamp asyncio examplesAdrian Herrmann2023-10-024-190/+30
| | | | | | | | | | | | | The "minimal" and "eratosthenes" examples for asyncio have now been thoroughly revamped to use QtAsyncio instead of the previous experimental approach. As it so happens, this results in a significantly more streamlined and readable code. Pick-to: 6.6 Task-number: PYSIDE-769 Change-Id: If9eb2213a2a95b359d2ec3e468027c6b1edf3866 Reviewed-by: Friedemann Kleint <[email protected]> Reviewed-by: Shyamnath Premnadh <[email protected]>
* examples: Use new enums in asyncio examplesAdrian Herrmann2023-03-204-8/+8
| | | | | | | | | Use the new enum syntax in the asyncio examples instead of relying on forgiveness mode. Pick-to: 6.4 Task-number: PYSIDE-2169 Change-Id: I0faa384586e27f13643688b55ea03393da502753 Reviewed-by: Friedemann Kleint <[email protected]>
* examples: Improvements to the asyncio examplesAdrian Herrmann2023-03-026-73/+87
| | | | | | | | | | | | | | | | | - The asyncio AsyncHelper enters a quasi idle loop of switching between the asyncio event loop and the Qt event loop, where the asyncio event loop never receives new work at some point (besides yielding to Qt) and wastes memory and CPU cycles. Remedy this by signaling to AsyncHelper when asyncio's work is done. - Don't pass signals as parameters. - Fix comments in the asyncio examples that mentioned Trio. - Renamed the requirements files as only the Trio examples need them. - Remove unused imports. Pick-to: 6.4 Task-number: PYSIDE-2169 Change-Id: Ia7197ea3446dd6ae514089b0dd260214c458db6a Reviewed-by: Christian Tismer <[email protected]>
* examples: Add asyncio versions of async examplesAdrian Herrmann2022-12-098-20/+363
| | | | | | | | | | | The minimal + eratosthenes examples for async were previously based on the Trio async package, now there are also versions based on the asyncio package with minimal changes. Task-number: PYSIDE-769 Pick-to: 6.3 6.4 Change-Id: I5c1220e1c8ebeefb9a530745e52d8f907e08bb2c Reviewed-by: Cristian Maureira-Fredes <[email protected]>
* async: Fix formatting in rst documentationAdrian Herrmann2022-11-102-16/+16
| | | | | | | | | Indentations were wrong. Pick-to: 6.4 Task-number: PYSIDE-769 Change-Id: If021423787959d940e92cbc75624430adf5d03ce Reviewed-by: Friedemann Kleint <[email protected]>
* examples: Fix docstr in async/eratosthenes re:tickAdrian Herrmann2022-10-061-11/+6
| | | | | | | | | | | In the "eratosthenes" async example, the tick is not actually coordinated between subroutines as claimed, update docstring to reflect this (and streamline code slightly in the process). Task-number: PYSIDE-769 Pick-to: 6.3 Change-Id: I5f040b558851481355650c08ab15ac10e5b1a88c Reviewed-by: Friedemann Kleint <[email protected]>
* examples: Add async examplesAdrian Herrmann2022-10-0610-0/+410
Add two examples that demonstrate how to use Qt together with an async package (Trio). Task-number: PYSIDE-769 Pick-to: 6.3 Change-Id: I1514eecc0a2eb65c6bb493857d901cf8817b7b52 Reviewed-by: Cristian Maureira-Fredes <[email protected]>