[scribus] scribus file format / python

wibr lists at wibr.de
Mon Jul 4 18:45:41 UTC 2011


Am 04.07.2011 20:22, schrieb Gregory Pittman:
> On 07/04/2011 01:41 PM, wibr wrote:
>> Hi,
>>
>> so I would like to use Scribus to create some flashcards. It should work
>> like this:
>> 1. I have a .txt file with my flashcards
>> 2. I create two pages in Scribus how they will look like, one for each
>> side of the flashcards
>> 3. I will do some python magic, load the .txt and create many pages with
>> flashcards.
>> 4. I can edit the cards if I want or just export them to pdf.
>>
>> So here is my question: Should I manipulate the xml or let the script
>> run in Scribus?
>>
>> I think editing the xml shouldn't be too hard, but I don't completely
>> understand the file format, is there any recent documentation available?
>> Especially I would like to know how I could duplicate pages.
>> I had a look at it: <PAGE> is a page and it gets a number NUM, and
>> <PAGEOBJECT> is something on a page and it has an attribute "OwnPage".
>> So I tried to move pageobjects between pages by editing the "OwnPage"
>> number, but that didn't work...so how does Scribus know, which object
>> belongs to which page?
>>
>> Or maybe using python in Scribus would be easier? I am more familiar
>> with xml editing, though...
>>
>
> Hi Wilhelm,
>
> I would start by manually making a few cards, so that you can work out
> document page size, what sort of font, font size and style, spacing,
> etc., you want to use.
>
> After that, I would be inclined to use a script inside Scribus to make a
> document from a text file, so that you can create pages as needed, with
> frames, paragraph styles and so on.
> You might make it less demanding on the scripting end by just putting
> text into new frames on as many pages as needed, then applying the
> styles in Scribus later.
> Here is a simple script showing some of the methods:
> http://wiki.scribus.net/canvas/Importing_addresses_from_a_text_file
>
> Having said that, it's worth making a 2-page document, then looking at
> the SLA file to see how much work it would be to generate a file using
> python outside of Scribus. I sense that you have a long way to go to
> understand what parts of the file are used for various aspects of the
> document. Even if you know xml, I think you'll find an SLA file
> challenging.
>
> Another approach /might/ come from using text filters, but then I think
> you would need to deal with the problem of making new pages and frames...
>
> Greg
>
> ___
> Scribus Mailing List: scribus at lists.scribus.net
> Edit your options or unsubscribe:
> http://lists.scribus.net/mailman/listinfo/scribus
> See also:
> http://wiki.scribus.net
> http://forums.scribus.net
>

Hi Greg,

thanks for the quick reply.

To be a bit more specific:
I don't want to create the whole document in python. Let's say I want 8 
flashcards on each DinA4 page. So I create two pages in Scribus, instead 
of the flashcard text I use dummy text like $def1 and $def2, everything 
formatted nicely like I want.
The only thing I want to do with python is opening the xml, knowing 
exactly where the two pages are. Then I will just copy those pages as 
many times as needed, always replacing the dummy text with the real 
flashcards.
I did something like that with svg and Inkscape once and it worked out 
very well. So I don't need or want to understand the whole Scribus xml, 
I would just need to know how the pages work.
However, I will also look at the scripter API.

Thanks,
Wilhelm



More information about the scribus mailing list