User:Stefan/sqlite

From Scribus Wiki
Jump to navigation Jump to search

A notebook about my scripting experiments with scribus, python, python-sqlite bindings & sqlite one-file database.

Why?

Document creation automation

Setup testing

I want to use it on Mac Snow Lep. Tested & works so far

Document Creation

What the script should do:

  • Fill a scribus document, the "workdoc", with content from a sqlite database
  • Use another scribus doc, the "template", for general layout setup eg. fonts, page sizes
  • Use sqlite database to create pages, text and image frames in workdoc
  • Import text from a wiki, where the authors edit on it
  • Export text back to wiki, with wiki markup und frame info as needed
  • Page Planning support
  • Deadlines support

Data Structure

  
  create table if not exists beitrag(
      id,
      titel,
      untertitel1,
      untertitel2,
      intro,
      outro,
      byline,
      deadline,
      notiz
   );
   create table if not exists beitragelement(
      id,
      typ,
      untertitel,
      seite,
      x,y,h,b,
      notiz
   );
   create table if not exists bildspeicher(
      id,
      rohdaten,
      arbeitskopie
   );
   create table if not exists scribuselement(
      id,
      scribusname,
      scribustyp,
      notiz
   );
   create table if not exists geschrieben_von(
      beitrag,
      autor
   );
   create table if not exists textspeicher(
      id,
      text,
      notiz
   );
   create table if not exists steht_auf(
      beitrag,
      seite
   );
   create table if not exists autor(
      id,
      name,
      nick,
      mail,
      fon,
      twitter,
      wiki,
      notiz
   );
   create table if not exists seite(
      id,
      seitenzahl,
      inhalt,
      notiz
   );
   """)

This works in scribus scripter console


Works with Windows

at least with the bundled python and sqlite in Scribus 1.4.0rc5

Works with Mac OS

Snow Leopard. The Scribus dmg package does not include working sqlite python bindings. Instead I use Scribus from Mac Ports. Scribus auto-compiled with Mac Ports, together with python and sqlite from Mac Ports.