aboutsummaryrefslogtreecommitdiffstats
path: root/examples/async/minimal
Commit message (Collapse)AuthorAgeFilesLines
* Python-3.10: Allow the new syntax for Python 3.9Christian Tismer5 days2-0/+2
| | | | | | | | 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: Let examples handle SIGINTAdrian Herrmann2024-04-241-1/+1
| | | | | | | | | | 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 <Friedemann.Kleint@qt.io>
* 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 <tismer@stackless.com>
* QtAsyncio: Add QtAsyncio.run() functionAdrian Herrmann2023-12-201-3/+2
| | | | | | | | | | | | | | | | | 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>
* QtAsyncio: Catch keyboard interruptsAdrian Herrmann2023-12-191-3/+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 <cristian.maureira-fredes@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* doc: Use different titles for async examplesAdrian Herrmann2023-11-241-2/+2
| | | | | | | | | 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 <cristian.maureira-fredes@qt.io>
* async: Revamp asyncio examplesAdrian Herrmann2023-10-022-86/+15
| | | | | | | | | | | | | 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 <Friedemann.Kleint@qt.io> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* examples: Use new enums in asyncio examplesAdrian Herrmann2023-03-202-4/+4
| | | | | | | | | 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 <Friedemann.Kleint@qt.io>
* examples: Improvements to the asyncio examplesAdrian Herrmann2023-03-023-45/+42
| | | | | | | | | | | | | | | | | - 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 <tismer@stackless.com>
* examples: Add asyncio versions of async examplesAdrian Herrmann2022-12-094-10/+139
| | | | | | | | | | | 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 <cristian.maureira-fredes@qt.io>
* async: Fix formatting in rst documentationAdrian Herrmann2022-11-101-8/+8
| | | | | | | | | Indentations were wrong. Pick-to: 6.4 Task-number: PYSIDE-769 Change-Id: If021423787959d940e92cbc75624430adf5d03ce Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* examples: Add async examplesAdrian Herrmann2022-10-065-0/+160
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 <cristian.maureira-fredes@qt.io>