[scribus] a wiki page with a script using applyMasterPage()

Gregory Pittman gpittman at iglou.com
Fri Oct 10 12:07:35 UTC 2014

On 10/10/2014 05:45 AM, a.l.e wrote:
> hi greg,
>> I can confirm that the new Scripter command does work, based on the
>> script I wrote that I show on this wiki page:
>> http://wiki.scribus.net/canvas/Using_the_new_applyMasterPage%28%29_command
> just a detail: you should not put "#!/usr/bin/env python" at the
> beginning of your scripts. it's useless (since they are always triggered
> as `python script-name.py` and gives the false impression that one can
> run them from the command line.
>> The script first shows you a list of Master Pages in your document,
>> each indexed by a number. It asks you to choose by number the MP you
>> want to assign.
>> After that, you then get a dialog asking for a list of pages to apply
>> this MP to. As written, you have to explicitly enter each page number,
>> like 1 4 8 13 and so on, only separated by white space. I do it this
>> way to make use of the Python split command to create a list out of
>> the entry. It would be nice to be able to enter something like 1 5
>> 7-10 15, but parsing that 7-10 is more challenging, and besides this
>> is just a demonstration script.
> i have not tested it, but this seems to be a very simple way of
> "exploding" the page numbers :-)
> http://stackoverflow.com/questions/5704931/parse-string-of-integer-sets-with-intervals-to-list

Whoa! Simpler than I thought... I'll add one of these to the script.

The other thing I want to do is make an example which applies MPs to
all, even, or odd, with skipping of a list of pages, which seems more
like what Jog was looking for.

One thing that people might see is that you can have the split command
split on some character like ',', but I prefer not to have to type all
the commas in the dialog...


More information about the scribus mailing list