Open aoloe opened 10 years ago
Some alternatives are:
jain says:
I was exploring on this part for past few days -- pythonize is not being maintained for a long time.
By default, QtScript supports javascript only.
I also saw this library named PythonQt (http://pythonqt.sourceforge.net/) which is used to embed python scripting into C++ Qt applications.
One other method is to handle the embedding in our own way -- https://docs.python.org/3/extending/embedding.html. This is will help us to depend only on python dev library rather than adding anyother 3rd party one.
That being said, more research has to be done before we finalize on this.
@jainbasil what are your thoughts on this?
I am now playing around with PythonQt to see how it will fit into scribus. I feel that it is better to remove pythonize and go ahead with PythonQt.
@jainbasil, can you share your tryings?
@jainbasil what have you noticed in PythonQt specifically? any examples ?
it would be most ideal if the articles I do come across online about scribus scripting for once wouldn't mention deciphering the scripting API. http://ankursinha.in/blog/2015/06/26/scripting-in-scribus.html @sanjayankur31 (author of that blog post). I hope some work can be made to step up scripter to the next level soon.
What does musescore use ?
Edit: they don't use python. Just QML and javascript for scripting.
Freecad:
8:57 PM <danielfalck> It uses PySide now
8:57 PM <danielfalck> for the Gui in Draft and a lot of other workbenches
8:58 PM <danielfalck> on Linux, I think it uses the system python install of Python2.7
8:58 PM <danielfalck> in Windows it comes bundled with 2.7 in FreeCAD itself
8:58 PM <danielfalck> I don't know about OS X
as far as i know pyside (while having a nicer license) does not support qt5, yet.
... and it seems that freecad is still based on qt4
http://forum.freecadweb.org/viewtopic.php?t=5685
it does not say so directly, but at the end the come to the pyside/qt5 issue...
CC @pbrunet maybe you can offer some feedback about this topic ?
@jainbasil please deliver https://github.com/aoloe/scribus-plugin-scripter/issues/3#issuecomment-112081784
SIP could be a way of getting c++ code to use python scripts.
pyqt is using it. calibre, too.
It's a code generator that generates c++ code that can be then put into the code.
bump
pyside for qt5 is coming:
a further alternative would be
pyside may be the better option because of brand recognition. There is also a freecad contributor, Peter Lama (in the discussion thread that is interested in integrating pyside2 in to Freecad. Maybe we can also chime in with our presence?
personally, i'd prefer pyside's license (pyside being a library i prefer lgpl... )... but at the end, i don't really care what is used as long as:
and, yes, you're welcome to state on the psyside2 list that scribus contribution are also interested in using it :-)
Sidenote: Pyside uses Shiboken to map C++ <--> Python (Pyside itself is only the Qt bindings generated using shiboken). Qt5 support is in the works, but for extending with C++, you can use Shiboken as it is.
I tested this with Win (7, 8, 8.1 and 10), Linux (Ubuntu, Debian) and MacOSX without problems, so yes, main platforms are supported.
@jainbasil any thoughts?
@davidanes can you share your test files?
@aoloe FYI https://gitter.im/PySide/pyside2
@davidanes please respond
... which -- among other things -- is linking to http://piratepad.net/pyside with the -- current -- content:
"""
C++ binding generators:
"""
i should also check cffi, presented in https://chaobin.github.io/2015/05/13/interoperate-with-c-cpp-in-python/ example in: https://gist.github.com/tonyseek/7821993
Wop! Sorry for the hiatus since the last comment.
I would recommend using pybind11 as of today, as @aoloe pointed out.
http://pybind11.readthedocs.io/en/latest/
It is A LOT easier than using any other solution, check the docs.
http://www.henning-schroeder.de/embeddedpyqt/ might give some hints...
@davidanes i have been toying with pybind11 for the last few weeks and despite having struggled a bit with it, i still like it : - )
the embedding of python in c++ is really under (or even un) documented, but with the precious help from the pybind11 community, i have managed to use it in the way i wanted to. and the result looks very clean.
i will finish with probably last experiment, document the whole process and the it's very likely that i'll start a scripter3 based on pybind11.
it will be not so brillant with the scripter2, but it will be based on supported libraries and i will be able to understand how it works!
at its core, the new scripter is using the pythonize library by Jim Bublitz.
the library has not been updated for the last 10 years.
question: as we go to pyqt5 and python3, is there a better way to load and run the python code inside of scribus?
Some links: