~openerp-groupes/openobject-server/6.0-fix-setup-windows

« back to all changes in this revision

Viewing changes to bin/reportlab/tools/pythonpoint/styles/standard.py

  • Committer: pinky
  • Date: 2006-12-07 13:41:40 UTC
  • Revision ID: pinky-3f10ee12cea3c4c75cef44ab04ad33ef47432907
New trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from reportlab.lib import styles
 
2
from reportlab.lib import colors
 
3
from reportlab.lib.units import cm
 
4
from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_RIGHT, TA_JUSTIFY
 
5
from reportlab.platypus import Preformatted, Paragraph, Frame, \
 
6
     Image, Table, TableStyle, Spacer
 
7
 
 
8
 
 
9
def getParagraphStyles():
 
10
    """Returns a dictionary of styles to get you started.
 
11
 
 
12
    We will provide a way to specify a module of these.  Note that
 
13
    this just includes TableStyles as well as ParagraphStyles for any
 
14
    tables you wish to use.
 
15
    """
 
16
 
 
17
    stylesheet = {}
 
18
    ParagraphStyle = styles.ParagraphStyle
 
19
 
 
20
    para = ParagraphStyle('Normal', None)   #the ancestor of all
 
21
    para.fontName = 'Times-Roman'
 
22
    para.fontSize = 24
 
23
    para.leading = 28
 
24
    stylesheet['Normal'] = para
 
25
 
 
26
    #This one is spaced out a bit...
 
27
    para = ParagraphStyle('BodyText', stylesheet['Normal'])
 
28
    para.spaceBefore = 12
 
29
    stylesheet['BodyText'] = para
 
30
 
 
31
    #Indented, for lists
 
32
    para = ParagraphStyle('Indent', stylesheet['Normal'])
 
33
    para.leftIndent = 36
 
34
    para.firstLineIndent = 0
 
35
    stylesheet['Indent'] = para
 
36
 
 
37
    para = ParagraphStyle('Centered', stylesheet['Normal'])
 
38
    para.alignment = TA_CENTER
 
39
    stylesheet['Centered'] = para
 
40
 
 
41
    para = ParagraphStyle('BigCentered', stylesheet['Normal'])
 
42
    para.spaceBefore = 12
 
43
    para.alignment = TA_CENTER
 
44
    stylesheet['BigCentered'] = para
 
45
 
 
46
    para = ParagraphStyle('Italic', stylesheet['BodyText'])
 
47
    para.fontName = 'Times-Italic'
 
48
    stylesheet['Italic'] = para
 
49
 
 
50
    para = ParagraphStyle('Title', stylesheet['Normal'])
 
51
    para.fontName = 'Times-Roman'
 
52
    para.fontSize = 48
 
53
    para.leading = 58
 
54
    para.alignment = TA_CENTER
 
55
    stylesheet['Title'] = para
 
56
 
 
57
    para = ParagraphStyle('Heading1', stylesheet['Normal'])
 
58
    para.fontName = 'Times-Bold'
 
59
    para.fontSize = 36
 
60
    para.leading = 44
 
61
    para.alignment = TA_CENTER
 
62
    stylesheet['Heading1'] = para
 
63
 
 
64
    para = ParagraphStyle('Heading2', stylesheet['Normal'])
 
65
    para.fontName = 'Times-Bold'
 
66
    para.fontSize = 28
 
67
    para.leading = 34
 
68
    para.spaceBefore = 24
 
69
    stylesheet['Heading2'] = para
 
70
 
 
71
    para = ParagraphStyle('Heading3', stylesheet['Normal'])
 
72
    para.fontName = 'Times-BoldItalic'
 
73
    para.spaceBefore = 24
 
74
    stylesheet['Heading3'] = para
 
75
 
 
76
    para = ParagraphStyle('Heading4', stylesheet['Normal'])
 
77
    para.fontName = 'Times-BoldItalic'
 
78
    para.spaceBefore = 6
 
79
    stylesheet['Heading4'] = para
 
80
 
 
81
    para = ParagraphStyle('Bullet', stylesheet['Normal'])
 
82
    para.firstLineIndent = 0
 
83
    para.leftIndent = 56
 
84
    para.spaceBefore = 6
 
85
    para.bulletFontName = 'Symbol'
 
86
    para.bulletFontSize = 24
 
87
    para.bulletIndent = 20
 
88
    stylesheet['Bullet'] = para
 
89
 
 
90
    para = ParagraphStyle('Definition', stylesheet['Normal'])
 
91
    #use this for definition lists
 
92
    para.firstLineIndent = 0
 
93
    para.leftIndent = 72
 
94
    para.bulletIndent = 0
 
95
    para.spaceBefore = 12
 
96
    para.bulletFontName = 'Helvetica-BoldOblique'
 
97
    para.bulletFontSize = 24
 
98
    stylesheet['Definition'] = para
 
99
 
 
100
    para = ParagraphStyle('Code', stylesheet['Normal'])
 
101
    para.fontName = 'Courier'
 
102
    para.fontSize = 16
 
103
    para.leading = 18
 
104
    para.leftIndent = 36
 
105
    stylesheet['Code'] = para
 
106
 
 
107
    para = ParagraphStyle('PythonCode', stylesheet['Normal'])
 
108
    para.fontName = 'Courier'
 
109
    para.fontSize = 16
 
110
    para.leading = 18
 
111
    para.leftIndent = 36
 
112
    stylesheet['PythonCode'] = para
 
113
 
 
114
    para = ParagraphStyle('Small', stylesheet['Normal'])
 
115
    para.fontSize = 12
 
116
    para.leading = 14
 
117
    stylesheet['Small'] = para
 
118
 
 
119
    #now for a table
 
120
    ts = TableStyle([
 
121
         ('FONT', (0,0), (-1,-1), 'Times-Roman', 24),
 
122
         ('LINEABOVE', (0,0), (-1,0), 2, colors.green),
 
123
         ('LINEABOVE', (0,1), (-1,-1), 0.25, colors.black),
 
124
         ('LINEBELOW', (0,-1), (-1,-1), 2, colors.green),
 
125
         ('LINEBEFORE', (-1,0), (-1,-1), 2, colors.black),
 
126
         ('ALIGN', (1,1), (-1,-1), 'RIGHT'),   #all numeric cells right aligned
 
127
         ('TEXTCOLOR', (0,1), (0,-1), colors.red),
 
128
         ('BACKGROUND', (0,0), (-1,0), colors.Color(0,0.7,0.7))
 
129
         ])
 
130
    stylesheet['table1'] = ts
 
131
 
 
132
    return stylesheet