Scribusoid

Author Topic: Working on a pybind11 new Scripter for Scribus  (Read 166 times)

a.l.e

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1851
  • Karma: 26
    • the graphics lab
Working on a pybind11 new Scripter for Scribus
« on: April 18, 2019, 10:46:33 am »
After a long preparatory phase (and a few fails at upgrading the current solutions), I think that I've finally a way to get to a new Scripter for Scribus that:

- Would have a more sane API
- Is simple to maintain
- Is more pythonic
- Works with Python 3
- Is based on PyQt5 / PySide2 rather than on Tcl/Tk

The first bits, with only two function in the API is here

https://github.com/aoloe/scribus-plugin-scripter-pybind11/

and it allows to get the current file name (if any) with this Python code:

Quote
import scribus
import sys

try:
    doc = scribus.get_current_document()
    print(doc.get_name())
except:
    print("Unexpected error:", sys.exc_info()[0])

If you have some experience with using the Scripter, are a Python programmer or otherwise feel that you have a say, I would be very interested in getting help with the planning of the new API.

As I write in the README linked above, I'd like to create a new API that is close to what the Scripter2 should have been: https://scribus-scripter.readthedocs.io/en/latest/docs/documentapi.html
(the main difference: the return values will be Python objects, not strings with the name of the resource).

Of course, help in the implementation itself would also be welcome, but i hope to be rather fast on not that part (mostly, copying  and refactoring what is already in the current Scripter...).

The plan is to have an API that can do some simple tasks ready for the next LGM

Ciao
a.l.e

P.S.: If you're wondering why: we need a new Scripter because the current solutions cannot be upgraded to Python 3 and Tcl/Tk has issues on Mac OS.

Gibbz

  • Jr. Member
  • **
  • Posts: 51
  • Karma: 0
  • Scribus User
Re: Working on a pybind11 new Scripter for Scribus
« Reply #1 on: May 10, 2019, 06:36:06 am »
Id love to see python 3 support. One thing ive noticed is that working with python is very slow in some cases. I have some scripts that can take several minutes to process....

Ive made myself a util class that has a lot of helper functions, I guess with a new scripter update we shouldnt need as many of these?

Having some better logging of script to some kind of console would be very handy. Basically a way to open the scripter console window and print to it via python.
« Last Edit: May 10, 2019, 06:40:57 am by Gibbz »

a.l.e

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1851
  • Karma: 26
    • the graphics lab
Re: Working on a pybind11 new Scripter for Scribus
« Reply #2 on: May 10, 2019, 10:46:19 am »
i've opened a ticket (for my self...) for the "output console"...

https://github.com/aoloe/scribus-plugin-scripter-pybind11/issues/13