Investigate PythonQt based scripting
Closed, ResolvedPublic

Description

PythonQt library uses Qt introspection to interface python and Qt+C++ code.

  1. Create a plugin to investigate feasibility.
  2. Test performance.
  3. Work out details of building on 3 platforms.

This may be an easier and more complete alternative for python scripting in krita.

eingerman created this task.Sep 3 2016, 5:00 PM
eingerman updated the task description. (Show Details)
rempt added a subscriber: rempt.Sep 7 2016, 1:09 PM

PyQt is actually (together with PySide, for license reasons) the industry standard in the vfx world. I'd like to check out PythonQt, and see what it can do for us, but there's already a working prototype for PyQt...

rempt added a comment.Sep 7 2016, 1:12 PM

Fails to build because I don't have qt-multimedia... Let's hack.

This comment was removed by eingerman.

I did a bit of testing and I think I can kill the PythonQt idea. PythonQt seems to have limited capability of automatically wrapping C++ objects.

This statement on PythonQt page seems to be false advertisement: "No preprocessing/wrapping tool needs to be started, PythonQt can script any QObject without prior knowledge about it (except for the MetaObject information from the moc)"

moc files contain introspection information only for signals/slots/and explicitly tagged "invokable" functions. Which means most class members for main krita classes won't be accessible. That's too bad :(

Actually, I'm going to change my mind. PythonQt may still be the simplest path to enabling krita scripting.

First step is to use Q_INVOKABLE decorator to mark member functions that should be accessible from pythonqt. I did a bit of research and even QML scripting requires using this decorator. Using decorators is probably simpler than using shiboken or sip.

Current problem: How to auto-wrap smart pointers e.g. KisImageWSP and KisImageSP.

rempt added a comment.Sep 9 2016, 5:58 AM

We probably should not expose the existing classes to Python in any case -- they often rely on templates and other C++ features. In the berger-scripting branch we've already got a working prototype of a python scripting plugin, which defines a separate API for scripting.

rempt closed this task as Resolved.Dec 14 2016, 1:16 PM

I've tried both this and the mikro.py approach that automatically wraps a QOBject from the Scribus scripter, and the cmake-based method where the build system generates the sip files -- I'm still going for the manual sip approach, that seems the most stable.