[Scribus] Extension Script

Craig Ringer craig
Wed Feb 9 02:09:44 CET 2005


On Wed, 2005-02-09 at 08:58 +1100, Owen wrote:
> In 8 Feb CVS there is "Load Extension Script" that tells me to read
> the documentation on extension scripts.

The documentation for the macro manager and the 'extension script' stuff
is still sitting partly written on my hard disk. It's in progress, and
will be included - as well as some examples - a bit later.

The purpose of "Load Extension Script" is to enable you to use the
scripter for a few things that its standard mode cannot do, such as
create non-modal graphical windows that can be kept open while you work.
With luck it'll also be possible to extend the user interface later (but
currently doing so involves scary delving with PyQt, so I wouldn't
recommend it) and perform tasks periodically or on certain events.

Load Extension Script is basically the same as "Execute script" but does
not run your script in a temporary sub-interpreter. This means that your
script can create objects that still exist after it exits, and make
changes that remain in effect after it exits. For example, it can create
modeless palette windows using PyQt that will be fully functional after
the script finishes setting them up and exits.

There are a few things to be careful of, such as modifying the global
interpeter settings (because that'll affect later script runs), and it's
best to avoid filling the global namespace with various working
variables by doing most of your work inside a function/class. Another
thing to be aware of is that if the user runs your script more than
once, the second invocation may overwrite the first invocation's names,
causing the associated objects to be deleted by the interpreter (so
windows created by the first script will disappear, etc). If this may be
an issue, consider defining a global and checking to see that it exits
on subsequent runs, refusing to run again (or prompting the user first)
if it does.

So long as you code a little more carefully, you should be fine, abngh
vnd you'll be able to do things like define new windows (currently only
with PyQt, but I think I can make Tkinter and PyGtk work too) that can
be used while you work with Scribus normally. I'm looking at doing a
demo that lists stories in a database and lets you place them on the
page, complete with optional associated image, from a floating helper
window. Sound good?

If you have any specific questions, please ask away - since that'll help
me improve the documentation I'm writing, too.

> Just wondering if the documentation is there and I should keep
looking?

As noted above ... "it's on the way".

--
Craig Ringer

> 

> 
> 
> Owen
>  
> _______________________________________________
> Scribus mailing list
> Scribus at nashi.altmuehlnet.de
> http://nashi.altmuehlnet.de/mailman/listinfo/scribus





More information about the scribus mailing list