Scribus Forums

Scribus => General Discussion => Topic started by: Tijo on October 09, 2023, 05:10:41 PM

Title: Script limitation
Post by: Tijo on October 09, 2023, 05:10:41 PM
Would it be possible to have access to the fields in the content properties while a script is running. because the current operation I find counterproductive to open and close a script to have access to the content properties, if anyone has an idea of how to proceed I am interested.

here are screens to illustrate my remarks

the 1st image no script activated, my text frame is selected the content property is available
(https://drive.google.com/uc?id=1eNzy3gNHT40_7imyxI4bDliie_A_C2Yk)



the 2nd image the script is activated, my text frame is selected, the content property is not available
(https://drive.google.com/uc?id=1XAKhhZR71HpluBScq5dYF2OpU8tALMyY)


 ???  ???  ???

Title: Re: Script limitation
Post by: a.l.e on October 09, 2023, 08:04:55 PM
the short answer is: you cannot interact with the scribus UI while a script is running.

the longer answer is in two parts:

extension scripts

theoretically, scribus should support what is called "extension scripts" that can create modal dialogs.
i think that in the distant past, i must have seen an example of such a script, but i would not know (or i don't want to know...) where to look for it.

on the one side, i'm not sure that extension scripts still work and, on the other side, i fear that having a document that can change while the script is running might be too complex for the current script commands.

a new way to use the scripter

extending scribus by writing c++ code is hard... and this on multiple levels.

i believe that allowing to add menu entries and dialogs through python could let much more people to contribute new features to scribus.

for various reasons (did i mention that the current scripter is based on a scripting engine that is completely abandoned and that nobody understand?) this would mean that we should first create a new scripter engine:

- with a better API that allows to write better code
- based on a framework that is well known and understood (pybind11) that we can enhance (as an example to correctly support pyside6)

i have a prototype that does work (except for the pyside part... but having now read the documentation on the "extension scripts" i think that we should be able to use the same approach and get that to work, too) but for now i don't plan to restart focusing on it... except if other people want to (actively!) join the effort.

all this having been said...

i guess that for now the short answer is the best one: just forget about it : - )

... except if a group of people want to put some real efforts to get the things to improve...