From tim37021 at gmail.com Tue Dec 1 18:39:28 2020 From: tim37021 at gmail.com (=?UTF-8?B?6Kix5Y+L57a4?=) Date: Wed, 2 Dec 2020 01:39:28 +0800 Subject: [PySide] Inherit from QQmlParserStatus interface Message-ID: Hi PySide Team, I try to create an object that need componentComplete notification, thus I inherit from QQmlParserStatus My code has no runtime error, but the method is never called. class AudioInputDevice(QObject, QQmlParserStatus): def componentComplete(self): pass def classBegin(self): pass I also find PyQt5's example, the way of inheriting from Qt's interface is almost the same. I am not sure if I am doing wrong. -Tim -------------- next part -------------- An HTML attachment was scrubbed... URL: From Cristian.Maureira-Fredes at qt.io Thu Dec 10 13:15:43 2020 From: Cristian.Maureira-Fredes at qt.io (=?UTF-8?Q?Cristi=c3=a1n_Maureira-Fredes?=) Date: Thu, 10 Dec 2020 13:15:43 +0100 Subject: [PySide] Qt for Python 6.0.0 released Message-ID: Dear Community, We are really happy to tell you that 6.0.0 is finally out. Some general information, the project was renamed to PySide6 and Shiboken6 on PyPi, to follow Qt versioning and avoid more confusion regarding the name. You can install it via: pip install pyside6 Keep in mind that not all the modules are available in Qt 6.0.0 but you can find a list here: https://www.qt.io/blog/add-on-support-in-qt-6.0-and-beyond We are still investigating how to distribute the new Qt Add-ons but we will let you know ;) You can find more information on the blog post: https://www.qt.io/blog/qt-for-python-6-released As always, let us know if you find anything not properly working https://bugreports.qt.io/projects/PYSIDE and we would love to hear from you regarding what's still missing: * more tutorials? * new functionality to the __feature__ option? * different build options? * new Python-only modules? Remember that most of the features we adopt come from the community ;) Cheers -- Dr. Cristián Maureira-Fredes R&D Manager The Qt Company GmbH Erich-Thilo-Str. 10 D-12489 Berlin Geschäftsführer: Mika Pälsi, Juha Varelius, Jouni Lintunen Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B From listes.rusconi at laposte.net Thu Dec 10 23:50:59 2020 From: listes.rusconi at laposte.net (Filippo Rusconi) Date: Thu, 10 Dec 2020 23:50:59 +0100 Subject: [PySide] Building pyside2 seems to be rocket science... Message-ID: and... it turns out that I am not a rocket scientist :-( Greetings, fellow developers, those reading this mailing list regularly know that I have been struggling with the build of Pyside2... Well, I think I finally got round of some glitches in the build system and I would like to publish some notes that might be useful to others in the same journey... These notes will also be in the net, so I can refer to these later :-) Qt 5.15 ======= Debian testing, 20201210 Python3.9, gcc (Debian 10.2.0) Note: the command lines start with % (using zsh). First off follow the instructions at https://doc.qt.io/qtforpython/gettingstarted-linux.html However some things need to be done that are not described: In order to succeed in building sphinx/qthelp doc builds: % apt install python3-sphinxcontrib.qthelp % cd pyside-setup && git checkout -b 5.15 --track origin/5.15 To make sure the pyside2-tools directory gets populated % git submodule update --init Check that the directory is no more empty: % ls sources/pyside2-tools In the virtual environment and in pyside-setup run the command: % python3 setup.py build --reuse-build --qmake=/usr/lib/x86_64-linux-gnu/qt5/bin/qmake --build-tests --ignore-git 2>&1 | tee ../pyside2-5.15-build-$(today-time).log Get error: ========== Regenerating /home/rusconi/.python-virtual-envs/pyside-setup/build/lib.linux-x86_64-3.9/PySide2/examples/opengl/textures/textures_rc.py from textures.qrc In directory /home/rusconi/.python-virtual-envs/pyside-setup: Running command: /home/rusconi/.python-virtual-envs/pyside-setup/testenv3_install/py3.9-qt5.15.1-64bit-release/bin/rcc -g python /home/rusconi/.python-virtual-envs/pyside-setup/build/lib.linux-x86_64-3.9/PySide2/examples/opengl/textures/textures.qrc -o /home/rusconi/.python-virtual-envs/pyside-setup/build/lib.linux-x86_64-3.9/PySide2/examples/opengl/textures/textures_rc.py setup.py/prepare_packages: [Errno 2] No such file or directory: '/home/rusconi/.python-virtual-envs/pyside-setup/testenv3_install/py3.9-qt5.15.1-64bit-release/bin/rcc' error: [Errno 2] No such file or directory: '/home/rusconi/.python-virtual-envs/pyside-setup/testenv3_install/py3.9-qt5.15.1-64bit-release/bin/rcc' Traceback (most recent call last): File "/home/rusconi/.python-virtual-envs/pyside-setup/setup.py", line 296, in setup_runner.run_setup() File "/home/rusconi/.python-virtual-envs/pyside-setup/build_scripts/setup_runner.py", line 168, in run_setup raise RuntimeError(msg) RuntimeError: setup.py invocation failed with exit code: 1. setup.py invocation was: /home/rusconi/.python-virtual-envs/testenv/bin/python3 setup.py build --reuse-build --qmake=/usr/lib/x86_64-linux-gnu/qt5/bin/qmake --build-tests --ignore-git --internal-build-type=pyside2 Fix: ==== % pushd /home/rusconi/.python-virtual-envs/pyside-setup/testenv3_install/py3.9-qt5.15.1-64bit-release/bin/ % ln -sf /usr/bin/qtchooser uic % ln -sf /usr/bin/qtchooser rcc % python3 setup.py build --reuse-build --qmake=/usr/lib/x86_64-linux-gnu/qt5/bin/qmake --build-tests --ignore-git 2>&1 | tee ../pyside2-5.15-build-$(today-time).log Get error: ========== In directory /home/rusconi/.python-virtual-envs/pyside-setup: Running command: /home/rusconi/.python-virtual-envs/pyside-setup/patchelf --set-rpath $ORIGIN/:/usr/lib/x86_64-linux-gnu /home/rusconi/.python-virtual-envs/pyside-setup/build/lib.linux-x86_64-3.9/PySide2/pyside2-lupdate warning: working around a Linux kernel bug by creating a hole of 94208 bytes in ‘/home/rusconi/.python-virtual-envs/pyside-setup/build/lib.linux-x86_64-3.9/PySide2/pyside2-lupdate’ Patched rpath to '$ORIGIN/' (Linux) or updated rpath (OS/X) in /home/rusconi/.python-virtual-envs/pyside-setup/build/lib.linux-x86_64-3.9/PySide2/pyside2-lupdate. running build_py package init file 'sources/pyside2/PySide2/__init__.py' not found (or not a regular file) running build_ext --- Build completed (10s) Fix: ==== % cp build/lib.linux-x86_64-3.9/PySide2/__init__.py sources/pyside2/PySide2 % python3 setup.py build --reuse-build --qmake=/usr/lib/x86_64-linux-gnu/qt5/bin/qmake --build-tests --ignore-git 2>&1 | tee ../pyside2-5.15-build-$(today-time).log Build terminates and $? is 0. Now install: ============ % python3 setup.py install --reuse-build --qmake=/usr/lib/x86_64-linux-gnu/qt5/bin/qmake --build-tests --ignore-git 2>&1 | tee ../pyside2-5.15-build-$(today-time).log The install terminates and $? is 0. Could play Tetrix using % python3 examples/widgets/widgets/tetrix.py !!! Done ! Now the hardest part: start writing code for the Python bindings of my lib. Thanks for listening. -- ⢀⣴⠾⠻⢶⣦⠀ Filippo Rusconi, PhD ⣾⠁⢠⠒⠀⣿⡁ Research scientist at CNRS ⢿⡄⠘⠷⠚⠋⠀ Debian Developer ⠈⠳⣄⠀⠀⠀⠀ http://msxpertsuite.org http://www.debian.org From goddard at sonic.net Sat Dec 12 05:09:21 2020 From: goddard at sonic.net (Tom Goddard) Date: Fri, 11 Dec 2020 20:09:21 -0800 Subject: [PySide] Is QOpenGLFunctions_3_3_Core supported in PySide2 Message-ID: <0ED956E9-46A3-42E9-A1A3-07347FF1EFE6@sonic.net> I am trying to figure out whether PySide2 offers an API for desktop OpenGL, e.g. 3.3 core profile. Currently I use PyOpenGL which is poorly maintained and would like to switch to using PySide2 OpenGL bindings if possible. Here is the Qt documentation of QOpenGLFunctions_3_3_Core that I would like to use from PySide2. https://doc.qt.io/qt-5/qopenglfunctions-3-3-core.html Here are failed attempts. I am using PySide 15.1 on macOS 10.15. 1) First the class is not in QtGui which is where the live in C++ Qt from PySide2.QtGui import QOpenGLFunctions_3_3_Core -> import error, no such name 2) But there is an undocumented QtOpenGLFunctions module that has it from PySide2.QtOpenGLFunctions import QOpenGLFunctions_3_3_Core as GL and it contains the functions, e.g. GL.glClear but does not have the constants GL.GL_COLOR_BUFFER_BIT -> attribute error dir(GL) -> shows only glXYZ functions not any GL_XYZ constants. 3) If I take my QOpenGLContext instance (that I currently use with PyOpenGL) qc and try to get the functions GL = qc.versionFunctions() it gives a QAbstractOpenGLFunctions instance with no opengl methods GL.glClear -> attribute error There is a PySide2 bug report about that from Feb 2019 with no resolution https://bugreports.qt.io/browse/PYSIDE-955 4) In PyQt5 approach 3 works GL = qc.versionFunctions() GL -> and this module has glClear and GL_COLOR_BUFFER_BIT, seems to have what is needed although I have not tried using it. Thanks for shedding any light on the using the desktop OpenGL API from PySide2. Tom Goddard ChimeraX molecular visualization developer -------------- next part -------------- An HTML attachment was scrubbed... URL: From jhihn at gmx.com Wed Dec 23 18:31:56 2020 From: jhihn at gmx.com (Jason H) Date: Wed, 23 Dec 2020 18:31:56 +0100 Subject: [PySide] Unifying Qt and Python asyncio? Message-ID: I have software projects that I am a member of, and they are using Python and python's asyncio (3.6-3.8). This now creates a problem because there are two event loops. Admittedly, I am only familiar with Qt + Python via PyQt/PySide2, which really doesn't require any asyncio event loop. So my questions are: Given that I am heavily biased for Qt's signal/slot mechanism, 1. Whose event loops should I use? 2. How do I bridge python asyncio with Qt event loops? 3. Is there a generic (not necessarily Qt) way to structure Python asyncio to look more like Qt's signal/slots? As a follow-on at some point in time (C++20 working draft), coroutines will be C++ as well. What will Qt do to interop with the standard library coroutines? Thanks! From maillist at schwertberger.de Wed Dec 23 18:55:50 2020 From: maillist at schwertberger.de (Dietmar Schwertberger) Date: Wed, 23 Dec 2020 18:55:50 +0100 Subject: [PySide] Unifying Qt and Python asyncio? In-Reply-To: References: Message-ID: <3f2e10d2-578a-9088-233d-551cc146980f@schwertberger.de> On 23.12.2020 18:31, Jason H wrote: > 2. How do I bridge python asyncio with Qt event loops? |Try qasync or asyncqt. I'm using it with PyQt. I think it should work with PySide as well.| |Regards,| |Dietmar | -------------- next part -------------- An HTML attachment was scrubbed... URL: From public at enkore.de Sun Dec 27 17:05:37 2020 From: public at enkore.de (Marian Beermann) Date: Sun, 27 Dec 2020 17:05:37 +0100 Subject: [PySide] Unifying Qt and Python asyncio? In-Reply-To: References: Message-ID: <6368da3d-17e6-0e32-1856-79966b41b018@enkore.de> There are two very different approaches to solve this problem: 1.) Run both event loops by polling one loop as a task within the other. This has numerous hard-to-fix problems, like poor/unpredictable latency, issues with unblocking tasks across the loops, logic bugs because e.g. UI events are processed in batches between batches of coroutine resumptions etc. This is what e.g. wxasync does for wxPython. Would not generally recommend doing this, has quite a lot of potential for headaches. 2.) Run Python coroutines using the "foreign" event loop. I believe asyncqt mostly implements an asyncio event loop + policy so the asyncio event loop *is* the Qt event loop. A very good solution. If asyncio itself is not needed per se, more lightweight approaches are possible (I wrote asynker a few years ago for this purpose). Cheers, Marian From jhihn at gmx.com Tue Dec 29 20:01:13 2020 From: jhihn at gmx.com (Jason H) Date: Tue, 29 Dec 2020 20:01:13 +0100 Subject: [PySide] Unifying Qt and Python asyncio? In-Reply-To: <6368da3d-17e6-0e32-1856-79966b41b018@enkore.de> References: <6368da3d-17e6-0e32-1856-79966b41b018@enkore.de> Message-ID: Thanks for that! The other question I had was how to integrate the signal/slot mechanism? Take for example the python asyncio websockets module. That core code looks like: async for message in websocket: handle(message) or in other classes: while True: message = await something() handle(something) I'd like that to change the "handle(something)" to something more "Qt-like", probably "yield something". The yield would then be something more akin to an "emit" statement, where the thing being emitted would be sent to all "connect"ed receivers. I find the Qt way to result in far better reusable code as I can connect multiple receivers to the same 'signal', and the code overall winds up more loosely coupled. What I think I need to do is pass in an array of functions, then call each one with the something: async for message in websocket: print(message) for handler in self.handlers: await handle(message) #horrible concurrency tho, should use wait() or gather() Furthermore, when dealing with python async, I found myself having to create_task() for each 'emit' of each object. This may be bad python design, or poor understanding/implementation on my part, but I think the Qt way is better. Is anyone following what I am trying to say? Is it dumb? Am I dumb? > Sent: Sunday, December 27, 2020 at 11:05 AM > From: "Marian Beermann" > To: "Jason H" , pyside at qt-project.org > Subject: Re: [PySide] Unifying Qt and Python asyncio? > > There are two very different approaches to solve this problem: > > 1.) Run both event loops by polling one loop as a task within the other. > This has numerous hard-to-fix problems, like poor/unpredictable latency, > issues with unblocking tasks across the loops, logic bugs because e.g. > UI events are processed in batches between batches of coroutine > resumptions etc. > > This is what e.g. wxasync does for wxPython. Would not generally > recommend doing this, has quite a lot of potential for headaches. > > 2.) Run Python coroutines using the "foreign" event loop. I believe > asyncqt mostly implements an asyncio event loop + policy so the asyncio > event loop *is* the Qt event loop. A very good solution. If asyncio > itself is not needed per se, more lightweight approaches are possible (I > wrote asynker a few years ago for this purpose). > > Cheers, Marian >