[scribus] Possible to use SQLite, Python and Scribus Scripting Together?

Rob Oakes LyX-Devel at oak-tree.us
Fri Mar 23 18:36:16 UTC 2012


On 3/23/2012 11:39 AM, Marc Telesha wrote:
> I work at a fairly large Head Start company. (3-5 year old pre-school) We
> need to make "Control Charts." These control charts are half sheets with a
> pictures and English and Spanish text bellow. It is such a hassle to find
> what you need and get it printed out. I would like a way to make a Database
> with the URL for the pictures, and the text boxes and then use Scribus to
> print out the charts. Could be 1 chart or 150 charts at a time.
>
> Can I query a CSV file and then have a Python script parse the CSV and
> import that information into Scribus (Template) and then have the charts
> published as PDF and then print them? If I can get this to work I will save
> or 42 classrooms hours of work every year. Thoughts or ideas of making this
> possible? Is there a better solution (Preferably Open Source)?
Hi Mark,

This sounds like a great project. To answer your general question, you
can do all of this using the Scripter interface in Scribus. Scribus has
an embedded Python interpreter and access to most of the standard
library (if you're on Linux or Mac, the complete standard library),
which includes an interface to SQLite (and interfaces to other databases
are also available). This means you can get everything set up, create
the charts and other information, process the graphics, export it to PDF
and then shut down your session.

Regarding the images and other assets, you can process them from XML or
CSV, whichever is easiest for you to work with. (I would go with XML, as
it's a little easier to parse in a controlled manner.) If you're on
Linux, you can even give the whole thing a friendly UI using PyQt. (It's
a pain to do this on Mac and Windows.)

The Scribus help documentation has some pretty good examples with how to
get started with the Scribus scripter. The wiki has additional information.

>From there, it's just experimentation. If you find yourself somewhat
lost, feel free to email me. I'd be happy to send you sample scripts
I've done which do similar things.

Cheers,

Rob Oakes




More information about the scribus mailing list