aoloe / scribus-plugin-scripter

Development version of the new Scribus scripter
4 stars 4 forks source link

pythonize: is it state of the art? #3

Open aoloe opened 10 years ago

aoloe commented 10 years ago

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:

QuLogic commented 10 years ago

http://python.6.x6.nabble.com/Pythonize-library-td1916825.html

QuLogic commented 9 years ago

Some alternatives are:

aoloe commented 9 years ago

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.

luzpaz commented 9 years ago

@jainbasil what are your thoughts on this?

jainbasil commented 9 years ago

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.

aoloe commented 9 years ago

@jainbasil, can you share your tryings?

luzpaz commented 9 years ago

@jainbasil what have you noticed in PythonQt specifically? any examples ?

luzpaz commented 9 years ago

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.

luzpaz commented 9 years ago

What does musescore use ?

Edit: they don't use python. Just QML and javascript for scripting.

luzpaz commented 9 years ago

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
aoloe commented 9 years ago

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...

luzpaz commented 9 years ago

CC @pbrunet maybe you can offer some feedback about this topic ?

luzpaz commented 9 years ago

@jainbasil please deliver https://github.com/aoloe/scribus-plugin-scripter/issues/3#issuecomment-112081784

aoloe commented 9 years ago

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.

luzpaz commented 9 years ago

bump

aoloe commented 9 years ago

pyside for qt5 is coming:

a further alternative would be

luzpaz commented 9 years ago

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?

aoloe commented 9 years ago

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 :-)

kraptor commented 9 years ago

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.

luzpaz commented 9 years ago

@jainbasil any thoughts?

aoloe commented 9 years ago

@davidanes can you share your test files?

luzpaz commented 8 years ago

@aoloe FYI https://gitter.im/PySide/pyside2

@davidanes please respond

aoloe commented 8 years ago

... which -- among other things -- is linking to http://piratepad.net/pyside with the -- current -- content:

"""

C++ binding generators:

"""

aoloe commented 8 years ago

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

kraptor commented 8 years ago

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.

aoloe commented 7 years ago

http://www.henning-schroeder.de/embeddedpyqt/ might give some hints...

aoloe commented 7 years ago

@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!