[scribus] Scribus results / list of minor flaws

Andreas Hünnebeck acmh at gmx.de
Wed Dec 8 22:29:21 CET 2010


Am Dienstag, 7. Dezember 2010 schrieb John Jason Jordan:
> On Mon, 6 Dec 2010 23:43:39 +0100
> Andreas Hünnebeck <acmh at gmx.de> dijo:
> 
> >Most tables were created by Python scripts. I wrote a generic table
> >class which creates and fills frames according to some input
> >variables, and wrote one script for each table which calls the table
> >class with the appropriate input. Changing the content means changing
> >the script.
> 
> Does "most tables" include the Important Telephone Numbers on pages
> 18-19?

Yes.

> Can you give more detail about how the script functions?

The script which creates the table on page 18 looks like this:

class TabelleTelefonnummernL(Tabelle):

        w1 = 28.5
        w2 = 26.0
        w3 = 30.0
        w4 = 118.0 - w1 - w2 - w3
        std = 'Tab Telefonnummern'
        header = 'Tab Überschrift 1'
        subheader = 'Tab Telefonnummern Subheader'
        subheaderH = 'Tab Telefonnummern Subheader Umlaut'
        telefon = (
                 # Alpine Auskunft
                 ({ Text  : 'Alpine Auskunft',
                    Style : header,
                    Col   : 'Grey70' }, ),
                 
                 ({ Text  : 'DAV', Style : std },
                  { Text  : '(0 89) 29 49 40', Style : std, Width : w2+w3+w4 }),

                 ({ Text  : 'ÖAV', Style : std , Col : 'Grey10'},
                  { Text  : '00 43 (5 12) 58 78 28', Style : std ,
                    Width : w2+w3+w4, Col : 'Grey10'}),

                 ({ Text  : 'AVS', Style : std ,},
                  { Text  : '00 39 (04 71) 99 99 55', Style : std , Width : w2+w3+w4 }),

                 ({ Text  : 'OHM (Chamonix)', Style : std , Col : 'Grey10'},
                  { Text  : '00 33 (4 50) 53 22 08', Style : std ,
                    Width : w2+w3+w4, Col : 'Grey10'}),

                 ({ Lines : 2, }, ),

				.. and so on and so on:

             'Text' is the text of a cell,
             'Style' is the paragraph style, 
             'Col' is the background color (if not given defaults to white),
			'Width' is the width of the cell (if not given defaults to the width of the column)
			 w1,w2,w3,w4 are the predefined widths of columns 1,2,3,4. 

and then implements the function create:

        def create(self):
                self.createTable(self.telefon, self.stdPageDistOut, self.stdTextFrameY, Tabelle.height9pt)

createTable() is a function of the father class 'Tabelle':

class Tabelle(DavHeft):
        height9pt = 3.90
        height8pt = 3.71

        def createTable(self, table, xPos, yPos, heightOfOneLine):
                self.X = xPos
                self.Y = yPos
                self.lineH = heightOfOneLine
                if self.calcLineNum:
                        self.calculateNumLines(table)
                if self.colWs:
                        self.calculateColWidths(table)
                        
                self.objs = []
                for row in table:
                        self.createRow(row)
                scribus.groupObjects(self.objs)

In short: the variable 'telefon' specifies the data for each cell in the table, and 
createTable then goes throw each row, determines the maximum number of lines of all 
cells in this row, calculates the height accordingly for all cells and then creates
all cells. At last it groups all cells into one object.

Shall I mail the Python files to your email address?
 
> Might
> it be possible to create a GUI front end to the script where the GUI
> asks the user for input variables and data?

In principle yes. The problem is that the metrics are all hardcoded since
I don't know how to find out how high a cell must be to cover 1,2,3, ... lines
of text, depending on the chosen style for this cell. Another problem is that
I haven't written any GUI in Python yet, and first tests to do so failed miserably
(AFAIR scribus did not find the Tk modules).

bye
Andreas
-- 
Andreas Hünnebeck | email: andi at huennebeck-online.de
----- privat ---- | www  : http://www.huennebeck-online.de
Fax/Anrufbeantworter: +49 (32 12) 1 26 24 06
PGP-Key: http://www.huennebeck-online.de/public_keys/pgp_andreas.asc
GPG-Key: http://www.huennebeck-online.de/public_keys/andreas.asc

-- 
Andreas Hünnebeck | email: acmh at gmx.de
----- privat ---- | www  : http://www.huennebeck-online.de
Fax/Anrufbeantworter: +49 (32 12) 1 26 24 06
PGP-Key: http://www.huennebeck-online.de/public_keys/pgp_andreas.asc
GPG-Key: http://www.huennebeck-online.de/public_keys/andreas.asc



More information about the scribus mailing list