defining and calling QML functions directly from Python

Maxime Lemonnier maxime.lemonnier at gmail.com
Fri Sep 24 18:41:43 BST 2021


Hi Stefan,

A while back i coded this QMLWrapper class that should allow you to do what
you want

https://github.com/leddartech/pioneer.common.gui/blob/master/pioneer/common/gui/utils.py

On Thu., Sep. 23, 2021, 2:33 p.m. Stefan Seefeld, <stefan at seefeld.name>
wrote:

> ...and yet another follow-up:
>
> as I mentioned, I'm interacting with the main application from an attached
> Python interpreter, which - of course - runs in its own thread, to let the
> main thread take care of the Qt event loop.
>
> Looking at the PyQt5 code, I noticed that the implementation of the method
> call  (in the `pyqtMethodProxy_call()` function in
> `qpycore_pyqtmethodproxy.cpp`) calls `method.invoke()` without specifying a
> connection-type. This means the the `auto` connection-type will be chosen,
> which results in the `queued` connection-type to be chosen, given that I'm
> calling this from a secondary thread. And of course, that will fail...
>
> Thus my question: what is the reason for the above to not explicitly
> specify the `direct` connection-type argument in the `invoke()` call, given
> that the `MethodProxy` Python type will always use this as direct call, and
> thus will fail when used from non-primary threads ?
>
> [image: Stefan]
> --
>
>       ...ich hab' noch einen Koffer in Berlin...
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210924/0c8634b3/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .signature.png
Type: image/png
Size: 2754 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210924/0c8634b3/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .signature.png
Type: image/png
Size: 2754 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210924/0c8634b3/attachment-0001.png>


More information about the PyQt mailing list