reportlab/platypus/tables.py
author rgbecker
Fri, 14 Apr 2000 12:17:05 +0000
changeset 129 623baa767856
parent 128 a0676f013314
child 168 02bac1346c69
permissions -rwxr-xr-x
Splitting layout.py
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
     1
###############################################################################
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
     2
#
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
     3
#	ReportLab Public License Version 1.0
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
     4
#
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
     5
#   Except for the change of names the spirit and intention of this
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
     6
#   license is the same as that of Python
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
     7
#
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
     8
#	(C) Copyright ReportLab Inc. 1998-2000.
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
     9
#
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    10
#
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    11
# All Rights Reserved
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    12
#
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    13
# Permission to use, copy, modify, and distribute this software and its
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    14
# documentation for any purpose and without fee is hereby granted, provided
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    15
# that the above copyright notice appear in all copies and that both that
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    16
# copyright notice and this permission notice appear in supporting
7
ca9eb4f68eab License text fixes
rgbecker
parents: 6
diff changeset
    17
# documentation, and that the name of ReportLab not be used
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    18
# in advertising or publicity pertaining to distribution of the software
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    19
# without specific, written prior permission. 
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    20
# 
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    21
#
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    22
# Disclaimer
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    23
#
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    24
# ReportLab Inc. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    25
# SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    26
# IN NO EVENT SHALL ReportLab BE LIABLE FOR ANY SPECIAL, INDIRECT
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    27
# OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    28
# OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    29
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    30
# PERFORMANCE OF THIS SOFTWARE. 
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    31
#
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    32
###############################################################################
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    33
#	$Log: tables.py,v $
129
623baa767856 Splitting layout.py
rgbecker
parents: 128
diff changeset
    34
#	Revision 1.7  2000/04/14 12:17:05  rgbecker
623baa767856 Splitting layout.py
rgbecker
parents: 128
diff changeset
    35
#	Splitting layout.py
623baa767856 Splitting layout.py
rgbecker
parents: 128
diff changeset
    36
#
128
a0676f013314 Splitting layout.py
rgbecker
parents: 122
diff changeset
    37
#	Revision 1.6  2000/04/14 11:54:57  rgbecker
a0676f013314 Splitting layout.py
rgbecker
parents: 122
diff changeset
    38
#	Splitting layout.py
129
623baa767856 Splitting layout.py
rgbecker
parents: 128
diff changeset
    39
#	
122
fd68411f49db Drawable ==> Flowable
rgbecker
parents: 16
diff changeset
    40
#	Revision 1.5  2000/04/14 08:56:20  rgbecker
fd68411f49db Drawable ==> Flowable
rgbecker
parents: 16
diff changeset
    41
#	Drawable ==> Flowable
128
a0676f013314 Splitting layout.py
rgbecker
parents: 122
diff changeset
    42
#	
16
f9c7525619fb Docstring & other fixes
rgbecker
parents: 7
diff changeset
    43
#	Revision 1.4  2000/02/17 02:09:05  rgbecker
f9c7525619fb Docstring & other fixes
rgbecker
parents: 7
diff changeset
    44
#	Docstring & other fixes
122
fd68411f49db Drawable ==> Flowable
rgbecker
parents: 16
diff changeset
    45
#	
7
ca9eb4f68eab License text fixes
rgbecker
parents: 6
diff changeset
    46
#	Revision 1.3  2000/02/15 17:55:59  rgbecker
ca9eb4f68eab License text fixes
rgbecker
parents: 6
diff changeset
    47
#	License text fixes
16
f9c7525619fb Docstring & other fixes
rgbecker
parents: 7
diff changeset
    48
#	
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    49
#	Revision 1.2  2000/02/15 15:47:09  rgbecker
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    50
#	Added license, __version__ and Logi comment
7
ca9eb4f68eab License text fixes
rgbecker
parents: 6
diff changeset
    51
#	
129
623baa767856 Splitting layout.py
rgbecker
parents: 128
diff changeset
    52
__version__=''' $Id: tables.py,v 1.7 2000/04/14 12:17:05 rgbecker Exp $ '''
16
f9c7525619fb Docstring & other fixes
rgbecker
parents: 7
diff changeset
    53
__doc__="""
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    54
Tables are created by passing the constructor a tuple of column widths, a tuple of row heights and the data in
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    55
row order. Drawing of the table can be controlled by using a TableStyle instance. This allows control of the
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    56
color and weight of the lines (if any), and the font, alignment and padding of the text.
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    57
"""
16
f9c7525619fb Docstring & other fixes
rgbecker
parents: 7
diff changeset
    58
from reportlab.platypus import layout
129
623baa767856 Splitting layout.py
rgbecker
parents: 128
diff changeset
    59
from reportlab.platypus.paragraph import Paragraph
623baa767856 Splitting layout.py
rgbecker
parents: 128
diff changeset
    60
from reportlab.lib.styles import PropertySet, getSampleStyleSheet
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    61
import operator
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    62
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    63
_stringtype = type('')
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    64
128
a0676f013314 Splitting layout.py
rgbecker
parents: 122
diff changeset
    65
class CellStyle(PropertySet):
0
f19e0a2433ab Initial revision
gmcm
parents:
diff changeset
    66
    defaults = {
f19e0a2433ab Initial revision
gmcm
parents:
diff changeset
    67
        'fontname':'Times-Roman',
f19e0a2433ab Initial revision
gmcm
parents:
diff changeset
    68
        'fontsize':10,
f19e0a2433ab Initial revision
gmcm
parents:
diff changeset
    69
        'leading':12,
f19e0a2433ab Initial revision
gmcm
parents:
diff changeset
    70
        'leftPadding':6,
f19e0a2433ab Initial revision
gmcm
parents:
diff changeset
    71
        'rightPadding':6,
f19e0a2433ab Initial revision
gmcm
parents:
diff changeset
    72
        'topPadding':3,
f19e0a2433ab Initial revision
gmcm
parents:
diff changeset
    73
        'bottomPadding':3,
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    74
        'firstLineIndent':0,
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    75
        'color':(0,0,0),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    76
        'alignment': 'LEFT',
0
f19e0a2433ab Initial revision
gmcm
parents:
diff changeset
    77
        'background': (1,1,1),
f19e0a2433ab Initial revision
gmcm
parents:
diff changeset
    78
        }
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    79
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    80
class TableStyle:
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    81
    def __init__(self, cmds=None):
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    82
        self._cmds = cmds
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    83
        if cmds is None:
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    84
            self._cmds = []
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    85
    def add(self, *cmd):
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    86
        self._cmds.append(cmd)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    87
    def getCommands(self):
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    88
        return self._cmds
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    89
        
122
fd68411f49db Drawable ==> Flowable
rgbecker
parents: 16
diff changeset
    90
class Table(layout.Flowable):
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    91
    def __init__(self, colWidths, rowHeights, data):
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    92
        if not colWidths:
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    93
            raise ValueError, "Table must have at least 1 column"
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    94
        if not rowHeights:
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    95
            raise ValueError, "Table must have at least 1 row"
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    96
        nrows = self._nrows = len(rowHeights)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    97
        if len(data) != nrows:
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    98
            raise ValueError, "Data error - %d rows in data but %d in grid" % (len(data), nrows)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
    99
        ncols = self._ncols = len(colWidths)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   100
        for i in range(nrows):
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   101
            if len(data[i]) != ncols:
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   102
                raise ValueError, "Not enough data points in row %d!" % i
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   103
        self._rowHeights = rowHeights
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   104
        self._colWidths = colWidths
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   105
        self._cellvalues = data
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   106
        dflt = CellStyle('<default>')
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   107
        self._cellstyles = [None]*nrows
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   108
        for i in range(nrows):
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   109
            self._cellstyles[i] = [dflt]*ncols
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   110
        self._bkgrndcmds = []
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   111
        self._linecmds = []
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   112
        height = self._height = reduce(operator.add, rowHeights, 0)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   113
        self._rowpositions = [height]    # index 0 is actually topline; we skip when processing cells
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   114
        for h in rowHeights:
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   115
            height = height - h
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   116
            self._rowpositions.append(height)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   117
        assert height == 0
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   118
        width = 0
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   119
        self._colpositions = [0]        #index -1 is right side boundary; we skip when processing cells
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   120
        for w in colWidths:
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   121
            width = width + w
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   122
            self._colpositions.append(width)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   123
        self._width = width
0
f19e0a2433ab Initial revision
gmcm
parents:
diff changeset
   124
        self._curweight = self._curcolor = self._curcellstyle = None
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   125
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   126
    def setStyle(self, tblstyle):
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   127
        for cmd in tblstyle.getCommands():
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   128
            if cmd[0] == 'BACKGROUND':
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   129
                self._bkgrndcmds.append(cmd)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   130
            elif _isLineCommand(cmd):
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   131
                self._linecmds.append(cmd)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   132
            else:
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   133
                (op, (sc, sr), (ec, er)), values = cmd[:3] , cmd[3:]
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   134
                if sc < 0: sc = sc + self._ncols
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   135
                if ec < 0: ec = ec + self._ncols
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   136
                if sr < 0: sr = sr + self._nrows
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   137
                if er < 0: er = er + self._nrows
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   138
                for i in range(sr, er+1):
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   139
                    for j in range(sc, ec+1):
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   140
                        _setCellStyle(self._cellstyles, i, j, op, values)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   141
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   142
    def _drawLines(self):
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   143
        for op, (sc, sr), (ec, er), weight, color in self._linecmds:
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   144
            if sc < 0: sc = sc + self._ncols
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   145
            if ec < 0: ec = ec + self._ncols
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   146
            if sr < 0: sr = sr + self._nrows
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   147
            if er < 0: er = er + self._nrows
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   148
            if op == 'GRID':
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   149
                self._drawBox( (sc, sr), (ec, er), weight, color)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   150
                self._drawInnerGrid( (sc, sr), (ec, er), weight, color)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   151
            elif op in ('BOX',  'OUTLINE',):
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   152
                self._drawBox( (sc, sr), (ec, er), weight, color)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   153
            elif op == 'INNERGRID':
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   154
                self._drawInnerGrid( (sc, sr), (ec, er), weight, color)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   155
            elif op == 'LINEBELOW':
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   156
                self._drawHLines((sc, sr+1), (ec, er+1), weight, color)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   157
            elif op == 'LINEABOVE':
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   158
                self._drawHLines((sc, sr), (ec, er), weight, color)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   159
            elif op == 'LINEBEFORE':
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   160
                self._drawVLines((sc, sr), (ec, er), weight, color)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   161
            elif op == 'LINEAFTER':
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   162
                self._drawVLines((sc+1, sr), (ec+1, er), weight, color)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   163
            else:
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   164
                raise ValueError, "Unknown line style %s" % op
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   165
        self._curcolor = None
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   166
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   167
    def _drawBox(self,  (sc, sr), (ec, er), weight, color):
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   168
        self._drawHLines((sc, sr), (ec, sr), weight, color)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   169
        self._drawHLines((sc, er+1), (ec, er+1), weight, color)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   170
        self._drawVLines((sc, sr), (sc, er), weight, color)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   171
        self._drawVLines((ec+1, sr), (ec+1, er), weight, color)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   172
    def _drawInnerGrid(self, (sc, sr), (ec, er), weight, color):
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   173
        self._drawHLines((sc, sr+1), (ec, er), weight, color)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   174
        self._drawVLines((sc+1, sr), (ec, er), weight, color)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   175
    def _prepLine(self, weight, color):
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   176
        if type(color) is _stringtype:
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   177
            color = COLORS.get(color, (0,0,0))
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   178
        if color != self._curcolor:
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   179
            apply(self.canv.setStrokeColorRGB, color)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   180
            self._curcolor = color
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   181
        if weight != self._curweight:
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   182
            self.canv.setLineWidth(weight)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   183
            self._curweight = weight
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   184
    def _drawHLines(self, (sc, sr), (ec, er), weight, color):
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   185
        self._prepLine(weight, color)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   186
        scp = self._colpositions[sc]
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   187
        ecp = self._colpositions[ec+1]
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   188
        for rowpos in self._rowpositions[sr:er+1]:
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   189
            self.canv.line(scp, rowpos, ecp, rowpos)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   190
    def _drawVLines(self, (sc, sr), (ec, er), weight, color):
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   191
        self._prepLine(weight, color)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   192
        srp = self._rowpositions[sr]
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   193
        erp = self._rowpositions[er+1]
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   194
        for colpos in self._colpositions[sc:ec+1]:
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   195
            self.canv.line(colpos, srp, colpos, erp)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   196
0
f19e0a2433ab Initial revision
gmcm
parents:
diff changeset
   197
f19e0a2433ab Initial revision
gmcm
parents:
diff changeset
   198
    def wrap(self, availWidth, availHeight):
f19e0a2433ab Initial revision
gmcm
parents:
diff changeset
   199
        #nice and easy, since they are predetermined size
f19e0a2433ab Initial revision
gmcm
parents:
diff changeset
   200
        self.availWidth = availWidth
f19e0a2433ab Initial revision
gmcm
parents:
diff changeset
   201
        return (self._width, self._height)
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   202
                
0
f19e0a2433ab Initial revision
gmcm
parents:
diff changeset
   203
    def draw(self):
f19e0a2433ab Initial revision
gmcm
parents:
diff changeset
   204
        nudge = 0.5 * (self.availWidth - self._width)
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   205
        self.canv.translate(nudge, 0)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   206
        self._drawBkgrnd()
0
f19e0a2433ab Initial revision
gmcm
parents:
diff changeset
   207
        self._drawLines()
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   208
        for row, rowstyle, rowpos, rowheight in map(None, self._cellvalues, self._cellstyles, self._rowpositions[1:], self._rowHeights):
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   209
            for cellval, cellstyle, colpos, colwidth in map(None, row, rowstyle, self._colpositions[:-1], self._colWidths):
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   210
                self._drawCell(cellval, cellstyle, (colpos, rowpos), (colwidth, rowheight))
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   211
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   212
    def _drawBkgrnd(self):
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   213
        for cmd, (sc, sr), (ec, er), color in self._bkgrndcmds:
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   214
            if sc < 0: sc = sc + self._ncols
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   215
            if ec < 0: ec = ec + self._ncols
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   216
            if sr < 0: sr = sr + self._nrows
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   217
            if er < 0: er = er + self._nrows
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   218
            if type(color) is _stringtype:
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   219
                color = COLORS.get(values[0], (1,1,1))
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   220
            x0 = self._colpositions[sc]
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   221
            y0 = self._rowpositions[sr]
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   222
            x1 = self._colpositions[ec+1]
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   223
            y1 = self._rowpositions[er+1]
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   224
            apply(self.canv.setFillColorRGB, color)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   225
            self.canv.rect(x0, y0, x1-x0, y1-y0,stroke=0,fill=1)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   226
    def _drawCell(self, cellval, cellstyle, (colpos, rowpos), (colwidth, rowheight)):
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   227
        #print "cellstyle is ", repr(cellstyle), id(cellstyle)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   228
        if self._curcellstyle is not cellstyle:
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   229
            cur = self._curcellstyle
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   230
            if cur is None or cellstyle.color != cur.color:
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   231
                #print "setting cell color to %s" % `cellstyle.color`
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   232
                apply(self.canv.setFillColorRGB, cellstyle.color)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   233
            if cur is None or cellstyle.leading != cur.leading or cellstyle.fontname != cur.fontname or cellstyle.fontsize != cur.fontsize:
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   234
                #print "setting font: %s, %s, %s" % (cellstyle.fontname, cellstyle.fontsize, cellstyle.leading)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   235
                self.canv.setFont(cellstyle.fontname, cellstyle.fontsize, cellstyle.leading)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   236
            self._curcellstyle = cellstyle
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   237
        just = cellstyle.alignment
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   238
        #print "alignment is ", just
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   239
        if just == 'LEFT':
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   240
            draw = self.canv.drawString
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   241
            x = colpos + cellstyle.leftPadding
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   242
        elif just in ('CENTRE', 'CENTER'):
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   243
            draw = self.canv.drawCentredString
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   244
            x = colpos + colwidth * 0.5
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   245
        else:
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   246
            draw = self.canv.drawRightString
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   247
            x = colpos + colwidth - cellstyle.rightPadding
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   248
        y = rowpos + cellstyle.bottomPadding
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   249
        if type(cellval) is _stringtype:
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   250
            val = cellval
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   251
        else:
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   252
            val = str(cellval)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   253
        draw(x, y, val)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   254
        
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   255
# for text,
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   256
#   drawCentredString(self, x, y, text) where x is center
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   257
#   drawRightString(self, x, y, text) where x is right
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   258
#   drawString(self, x, y, text) where x is left
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   259
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   260
LINECOMMANDS = (
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   261
    'GRID', 'BOX', 'OUTLINE', 'INNERGRID', 'LINEBELOW', 'LINEABOVE', 'LINEBEFORE', 'LINEAFTER', )
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   262
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   263
COLORS = {
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   264
    'BLACK': (0,0,0),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   265
    'RED': (1,0,0),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   266
    'GREEN': (0,1,0),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   267
    'BLUE': (0,0,1),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   268
    'WHITE':(1,1,1),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   269
    }
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   270
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   271
def _isLineCommand(cmd):
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   272
    return cmd[0] in LINECOMMANDS
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   273
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   274
def _setCellStyle(cellstyles, i, j, op, values):
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   275
    new = CellStyle('<%d, %d>' % (i,j), cellstyles[i][j])
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   276
    cellstyles[i][j] = new
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   277
    if op == 'FONT':
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   278
        new.fontname = values[0]
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   279
        new.fontsize = values[1]
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   280
    elif op == 'TEXTCOLOR':
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   281
        if type(values[0]) is _stringtype:
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   282
            new.color = COLORS.get(values[0], (0,0,0))
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   283
        else:
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   284
            new.color = values[0]
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   285
    elif op in ('ALIGN', 'ALIGNMENT'):
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   286
        new.alignment = values[0]
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   287
    elif op == 'LEFTPADDING':
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   288
        new.leftPadding = values[0]
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   289
    elif op == 'RIGHTPADDING':
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   290
        new.rightPadding = values[0]
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   291
    elif op == 'TOPPADDING':
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   292
        new.topPadding = values[0]
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   293
    elif op == 'BOTTOMPADDING':
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   294
        new.bottomPadding = values[0]
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   295
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   296
GRID_STYLE = TableStyle(
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   297
    [('GRID', (0,0), (-1,-1), 0.25, 'BLACK'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   298
     ('ALIGN', (1,1), (-1,-1), 'RIGHT')]
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   299
    )
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   300
BOX_STYLE = TableStyle(
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   301
    [('BOX', (0,0), (-1,-1), 0.50, 'BLACK'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   302
     ('ALIGN', (1,1), (-1,-1), 'RIGHT')]
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   303
    )
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   304
LABELED_GRID_STYLE = TableStyle(
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   305
    [('INNERGRID', (0,0), (-1,-1), 0.25, 'BLACK'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   306
     ('BOX', (0,0), (-1,-1), 2, 'BLACK'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   307
     ('LINEBELOW', (0,0), (-1,0), 2, 'BLACK'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   308
     ('LINEAFTER', (0,0), (0,-1), 2, 'BLACK'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   309
     ('ALIGN', (1,1), (-1,-1), 'RIGHT')]
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   310
    )
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   311
COLORED_GRID_STYLE = TableStyle(
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   312
    [('INNERGRID', (0,0), (-1,-1), 0.25, 'BLACK'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   313
     ('BOX', (0,0), (-1,-1), 2, 'RED'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   314
     ('LINEBELOW', (0,0), (-1,0), 2, 'BLACK'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   315
     ('LINEAFTER', (0,0), (0,-1), 2, 'BLACK'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   316
     ('ALIGN', (1,1), (-1,-1), 'RIGHT')]
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   317
    )
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   318
LIST_STYLE = TableStyle(
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   319
    [('LINEABOVE', (0,0), (-1,0), 2, 'GREEN'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   320
     ('LINEABOVE', (0,1), (-1,-1), 0.25, 'BLACK'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   321
     ('LINEBELOW', (0,-1), (-1,-1), 2, 'GREEN'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   322
     ('ALIGN', (1,1), (-1,-1), 'RIGHT')]
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   323
    )
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   324
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   325
def test():
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   326
    rowheights = (24, 16, 16, 16, 16)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   327
    colwidths = (50, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   328
    data = (
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   329
        ('', 'Jan', 'Feb', 'Mar','Apr','May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   330
        ('Mugs', 0, 4, 17, 3, 21, 47, 12, 33, 2, -2, 44, 89),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   331
        ('T-Shirts', 0, 42, 9, -3, 16, 4, 72, 89, 3, 19, 32, 119),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   332
        ('Key Ring', 0,0,0,0,0,0,1,0,0,0,2,13),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   333
        ('Hats', 893, 912, '1,212', 643, 789, 159, 888, '1,298', 832, 453, '1,344','2,843')
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   334
        )
16
f9c7525619fb Docstring & other fixes
rgbecker
parents: 7
diff changeset
   335
    doc = layout.SimpleFlowDocument('testtables.pdf', layout.DEFAULT_PAGE_SIZE, 1)
129
623baa767856 Splitting layout.py
rgbecker
parents: 128
diff changeset
   336
    styleSheet = getSampleStyleSheet()
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   337
    lst = []
129
623baa767856 Splitting layout.py
rgbecker
parents: 128
diff changeset
   338
    lst.append(Paragraph("Tables", styleSheet['Heading1']))
623baa767856 Splitting layout.py
rgbecker
parents: 128
diff changeset
   339
    lst.append(Paragraph(__doc__, styleSheet['BodyText']))
623baa767856 Splitting layout.py
rgbecker
parents: 128
diff changeset
   340
    lst.append(Paragraph("The Tables (shown in different styles below) were created using the following code:", styleSheet['BodyText']))
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   341
    lst.append(layout.Preformatted("""
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   342
    colwidths = (50, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   343
    rowheights = (24, 16, 16, 16, 16)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   344
    data = (
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   345
        ('', 'Jan', 'Feb', 'Mar','Apr','May', 'Jun',
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   346
           'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   347
        ('Mugs', 0, 4, 17, 3, 21, 47, 12, 33, 2, -2, 44, 89),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   348
        ('T-Shirts', 0, 42, 9, -3, 16, 4, 72, 89, 3, 19, 32, 119),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   349
        ('Key Ring', 0,0,0,0,0,0,1,0,0,0,2,13),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   350
        ('Hats', 893, 912, '1,212', 643, 789, 159,
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   351
             888, '1,298', 832, 453, '1,344','2,843')
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   352
        )   
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   353
    t = Table(colwidths, rowheights,  data)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   354
    """, styleSheet['Code'], dedent=4))
129
623baa767856 Splitting layout.py
rgbecker
parents: 128
diff changeset
   355
    lst.append(Paragraph("""
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   356
    You can then give the Table a TableStyle object to control its format. The first TableStyle used was
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   357
    created as follows:
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   358
    """, styleSheet['BodyText']))
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   359
    lst.append(layout.Preformatted("""
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   360
GRID_STYLE = TableStyle(
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   361
    [('GRID', (0,0), (-1,-1), 0.25, 'BLACK'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   362
     ('ALIGN', (1,1), (-1,-1), 'RIGHT')]
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   363
    )
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   364
    """, styleSheet['Code']))
129
623baa767856 Splitting layout.py
rgbecker
parents: 128
diff changeset
   365
    lst.append(Paragraph("""
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   366
    TableStyles are created by passing in a list of commands. There are two types of commands - line commands
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   367
    and cell formatting commands. In all cases, the first three elements of a command are the command name,
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   368
    the starting cell and the ending cell.
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   369
    """, styleSheet['BodyText']))
129
623baa767856 Splitting layout.py
rgbecker
parents: 128
diff changeset
   370
    lst.append(Paragraph("""
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   371
    Line commands always follow this with the weight and color of the desired lines. Colors can be names,
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   372
    or they can be specified as a (R,G,B) tuple, where R, G and B are floats and (0,0,0) is black. The line
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   373
    command names are: GRID, BOX, OUTLINE, INNERGRID, LINEBELOW, LINEABOVE, LINEBEFORE
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   374
    and LINEAFTER. BOX and OUTLINE are equivalent, and GRID is the equivalent of applying both BOX and
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   375
    INNERGRID.
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   376
    """, styleSheet['BodyText']))
129
623baa767856 Splitting layout.py
rgbecker
parents: 128
diff changeset
   377
    lst.append(Paragraph("""
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   378
    Cell formatting commands are:
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   379
    """, styleSheet['BodyText']))
129
623baa767856 Splitting layout.py
rgbecker
parents: 128
diff changeset
   380
    lst.append(Paragraph("""
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   381
    FONT - takes fontname, fontsize and (optional) leading.
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   382
    """, styleSheet['Definition']))
129
623baa767856 Splitting layout.py
rgbecker
parents: 128
diff changeset
   383
    lst.append(Paragraph("""
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   384
    TEXTCOLOR - takes a color name or (R,G,B) tuple.
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   385
    """, styleSheet['Definition']))
129
623baa767856 Splitting layout.py
rgbecker
parents: 128
diff changeset
   386
    lst.append(Paragraph("""
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   387
    ALIGNMENT (or ALIGN) - takes one of LEFT, RIGHT and CENTRE (or CENTER).
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   388
    """, styleSheet['Definition']))
129
623baa767856 Splitting layout.py
rgbecker
parents: 128
diff changeset
   389
    lst.append(Paragraph("""
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   390
    LEFTPADDING - defaults to 6.
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   391
    """, styleSheet['Definition']))
129
623baa767856 Splitting layout.py
rgbecker
parents: 128
diff changeset
   392
    lst.append(Paragraph("""
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   393
    RIGHTPADDING - defaults to 6.
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   394
    """, styleSheet['Definition']))
129
623baa767856 Splitting layout.py
rgbecker
parents: 128
diff changeset
   395
    lst.append(Paragraph("""
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   396
    BOTTOMPADDING - defaults to 3.
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   397
    """, styleSheet['Definition']))
129
623baa767856 Splitting layout.py
rgbecker
parents: 128
diff changeset
   398
    lst.append(Paragraph("""
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   399
    A tablestyle is applied to a table by calling Table.setStyle(tablestyle).
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   400
    """, styleSheet['BodyText']))
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   401
    t = Table(colwidths, rowheights,  data)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   402
    t.setStyle(GRID_STYLE)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   403
    lst.append(layout.PageBreak())
129
623baa767856 Splitting layout.py
rgbecker
parents: 128
diff changeset
   404
    lst.append(Paragraph("This is GRID_STYLE\n", styleSheet['BodyText']))
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   405
    lst.append(t)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   406
    
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   407
    t = Table(colwidths, rowheights,  data)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   408
    t.setStyle(BOX_STYLE)
129
623baa767856 Splitting layout.py
rgbecker
parents: 128
diff changeset
   409
    lst.append(Paragraph("This is BOX_STYLE\n", styleSheet['BodyText']))
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   410
    lst.append(t)
129
623baa767856 Splitting layout.py
rgbecker
parents: 128
diff changeset
   411
    lst.append(Paragraph("""
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   412
    It was created as follows:
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   413
    """, styleSheet['BodyText']))
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   414
    lst.append(layout.Preformatted("""
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   415
BOX_STYLE = TableStyle(
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   416
    [('BOX', (0,0), (-1,-1), 0.50, 'BLACK'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   417
     ('ALIGN', (1,1), (-1,-1), 'RIGHT')]
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   418
    )
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   419
    """, styleSheet['Code']))
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   420
    
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   421
    t = Table(colwidths, rowheights,  data)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   422
    t.setStyle(LABELED_GRID_STYLE)
129
623baa767856 Splitting layout.py
rgbecker
parents: 128
diff changeset
   423
    lst.append(Paragraph("This is LABELED_GRID_STYLE\n", styleSheet['BodyText']))
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   424
    lst.append(t)
129
623baa767856 Splitting layout.py
rgbecker
parents: 128
diff changeset
   425
    lst.append(Paragraph("""
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   426
    It was created as follows:
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   427
    """, styleSheet['BodyText']))
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   428
    lst.append(layout.Preformatted("""
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   429
LABELED_GRID_STYLE = TableStyle(
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   430
    [('INNERGRID', (0,0), (-1,-1), 0.25, 'BLACK'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   431
     ('BOX', (0,0), (-1,-1), 2, 'BLACK'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   432
     ('LINEBELOW', (0,0), (-1,0), 2, 'BLACK'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   433
     ('LINEAFTER', (0,0), (0,-1), 2, 'BLACK'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   434
     ('ALIGN', (1,1), (-1,-1), 'RIGHT')]
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   435
    )
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   436
    """, styleSheet['Code']))
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   437
    lst.append(layout.PageBreak())
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   438
    
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   439
    t = Table(colwidths, rowheights,  data)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   440
    t.setStyle(COLORED_GRID_STYLE)
129
623baa767856 Splitting layout.py
rgbecker
parents: 128
diff changeset
   441
    lst.append(Paragraph("This is COLORED_GRID_STYLE\n", styleSheet['BodyText']))
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   442
    lst.append(t)
129
623baa767856 Splitting layout.py
rgbecker
parents: 128
diff changeset
   443
    lst.append(Paragraph("""
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   444
    It was created as follows:
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   445
    """, styleSheet['BodyText']))
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   446
    lst.append(layout.Preformatted("""
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   447
COLORED_GRID_STYLE = TableStyle(
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   448
    [('INNERGRID', (0,0), (-1,-1), 0.25, 'BLACK'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   449
     ('BOX', (0,0), (-1,-1), 2, 'RED'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   450
     ('LINEBELOW', (0,0), (-1,0), 2, 'BLACK'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   451
     ('LINEAFTER', (0,0), (0,-1), 2, 'BLACK'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   452
     ('ALIGN', (1,1), (-1,-1), 'RIGHT')]
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   453
    )
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   454
    """, styleSheet['Code']))
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   455
    
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   456
    t = Table(colwidths, rowheights,  data)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   457
    t.setStyle(LIST_STYLE)
129
623baa767856 Splitting layout.py
rgbecker
parents: 128
diff changeset
   458
    lst.append(Paragraph("This is LIST_STYLE\n", styleSheet['BodyText']))
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   459
    lst.append(t)
129
623baa767856 Splitting layout.py
rgbecker
parents: 128
diff changeset
   460
    lst.append(Paragraph("""
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   461
    It was created as follows:
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   462
    """, styleSheet['BodyText']))
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   463
    lst.append(layout.Preformatted("""
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   464
LIST_STYLE = TableStyle(
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   465
    [('LINEABOVE', (0,0), (-1,0), 2, 'GREEN'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   466
     ('LINEABOVE', (0,1), (-1,-1), 0.25, 'BLACK'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   467
     ('LINEBELOW', (0,-1), (-1,-1), 2, 'GREEN'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   468
     ('ALIGN', (1,1), (-1,-1), 'RIGHT')]
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   469
    )
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   470
    """, styleSheet['Code']))
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   471
   
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   472
    t = Table(colwidths, rowheights,  data)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   473
    ts = TableStyle(
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   474
    [('LINEABOVE', (0,0), (-1,0), 2, 'GREEN'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   475
     ('LINEABOVE', (0,1), (-1,-1), 0.25, 'BLACK'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   476
     ('LINEBELOW', (0,-1), (-1,-1), 2, 'GREEN'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   477
     ('ALIGN', (1,1), (-1,-1), 'RIGHT'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   478
     ('TEXTCOLOR', (0,1), (0,-1), 'RED'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   479
     ('BACKGROUND', (0,0), (-1,0), (0,0.7,0.7))]
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   480
    )
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   481
    t.setStyle(ts)
129
623baa767856 Splitting layout.py
rgbecker
parents: 128
diff changeset
   482
    lst.append(Paragraph("This is a custom style\n", styleSheet['BodyText']))
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   483
    lst.append(t)
129
623baa767856 Splitting layout.py
rgbecker
parents: 128
diff changeset
   484
    lst.append(Paragraph("""
6
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   485
    It was created as follows:
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   486
    """, styleSheet['BodyText']))
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   487
    lst.append(layout.Preformatted("""
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   488
   ts = TableStyle(
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   489
    [('LINEABOVE', (0,0), (-1,0), 2, 'GREEN'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   490
     ('LINEABOVE', (0,1), (-1,-1), 0.25, 'BLACK'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   491
     ('LINEBELOW', (0,-1), (-1,-1), 2, 'GREEN'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   492
     ('ALIGN', (1,1), (-1,-1), 'RIGHT'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   493
     ('TEXTCOLOR', (0,1), (0,-1), 'RED'),
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   494
     ('BACKGROUND', (0,0), (-1,0), (0,0.7,0.7))]
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   495
    )
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   496
    """, styleSheet['Code']))
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   497
    doc.build(lst)
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   498
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   499
if __name__ == '__main__':
eb791971b252 Added license, __version__ and Logi comment
rgbecker
parents: 0
diff changeset
   500
    test()