author | robin <robin@reportlab.com> |
Fri, 23 Mar 2018 16:02:08 +0000 | |
changeset 4389 | 61a7f0840d00 |
parent 4370 | 823a8c33ce43 |
child 4410 | bd848827483f |
permissions | -rw-r--r-- |
4330 | 1 |
#Copyright ReportLab Europe Ltd. 2000-2017 |
494 | 2 |
#see license.txt for license details |
4370
823a8c33ce43
fix history urls contribution by Ben Weiner <ben@readingtype.org.uk>; version-->3.4.17
robin <robin@reportlab.com>
parents:
4330
diff
changeset
|
3 |
#history https://bitbucket.org/rptlab/reportlab/history-node/tip/src/reportlab/lib/styles.py |
4252 | 4 |
__version__='3.3.0' |
3029 | 5 |
__doc__='''Classes for ParagraphStyle and similar things. |
125 | 6 |
|
3029 | 7 |
A style is a collection of attributes, but with some extra features |
8 |
to allow 'inheritance' from a parent, and to ensure nobody makes |
|
9 |
changes after construction. |
|
10 |
||
11 |
ParagraphStyle shows all the attributes available for formatting |
|
12 |
paragraphs. |
|
13 |
||
14 |
getSampleStyleSheet() returns a stylesheet you can use for initial |
|
15 |
development, with a few basic heading and text styles. |
|
16 |
''' |
|
3368
afa025c34493
reportlab: new base font mechanism more fully applied
rgbecker
parents:
3326
diff
changeset
|
17 |
__all__=( |
afa025c34493
reportlab: new base font mechanism more fully applied
rgbecker
parents:
3326
diff
changeset
|
18 |
'PropertySet', |
afa025c34493
reportlab: new base font mechanism more fully applied
rgbecker
parents:
3326
diff
changeset
|
19 |
'ParagraphStyle', |
afa025c34493
reportlab: new base font mechanism more fully applied
rgbecker
parents:
3326
diff
changeset
|
20 |
'LineStyle', |
3479 | 21 |
'ListStyle', |
3368
afa025c34493
reportlab: new base font mechanism more fully applied
rgbecker
parents:
3326
diff
changeset
|
22 |
'StyleSheet1', |
afa025c34493
reportlab: new base font mechanism more fully applied
rgbecker
parents:
3326
diff
changeset
|
23 |
'getSampleStyleSheet', |
afa025c34493
reportlab: new base font mechanism more fully applied
rgbecker
parents:
3326
diff
changeset
|
24 |
) |
128 | 25 |
from reportlab.lib.colors import white, black |
530 | 26 |
from reportlab.lib.enums import TA_LEFT, TA_CENTER |
3368
afa025c34493
reportlab: new base font mechanism more fully applied
rgbecker
parents:
3326
diff
changeset
|
27 |
from reportlab.lib.fonts import tt2ps |
4277 | 28 |
from reportlab.rl_config import canvas_basefontname as _baseFontName, \ |
4389
61a7f0840d00
more controllable under and strike lines; fix for issue 137 contributed by Tom Alexander @ bitbucket; version-->3.4.30
robin <robin@reportlab.com>
parents:
4370
diff
changeset
|
29 |
underlineWidth as _baseUnderlineWidth, \ |
61a7f0840d00
more controllable under and strike lines; fix for issue 137 contributed by Tom Alexander @ bitbucket; version-->3.4.30
robin <robin@reportlab.com>
parents:
4370
diff
changeset
|
30 |
underlineOffset as _baseUnderlineOffset, \ |
61a7f0840d00
more controllable under and strike lines; fix for issue 137 contributed by Tom Alexander @ bitbucket; version-->3.4.30
robin <robin@reportlab.com>
parents:
4370
diff
changeset
|
31 |
underlineGap as _baseUnderlineGap, \ |
61a7f0840d00
more controllable under and strike lines; fix for issue 137 contributed by Tom Alexander @ bitbucket; version-->3.4.30
robin <robin@reportlab.com>
parents:
4370
diff
changeset
|
32 |
strikeWidth as _baseStrikeWidth, \ |
61a7f0840d00
more controllable under and strike lines; fix for issue 137 contributed by Tom Alexander @ bitbucket; version-->3.4.30
robin <robin@reportlab.com>
parents:
4370
diff
changeset
|
33 |
strikeOffset as _baseStrikeOffset, \ |
61a7f0840d00
more controllable under and strike lines; fix for issue 137 contributed by Tom Alexander @ bitbucket; version-->3.4.30
robin <robin@reportlab.com>
parents:
4370
diff
changeset
|
34 |
strikeGap as _baseStrikeGap, \ |
61a7f0840d00
more controllable under and strike lines; fix for issue 137 contributed by Tom Alexander @ bitbucket; version-->3.4.30
robin <robin@reportlab.com>
parents:
4370
diff
changeset
|
35 |
spaceShrinkage, platypus_link_underline |
3368
afa025c34493
reportlab: new base font mechanism more fully applied
rgbecker
parents:
3326
diff
changeset
|
36 |
_baseFontNameB = tt2ps(_baseFontName,1,0) |
afa025c34493
reportlab: new base font mechanism more fully applied
rgbecker
parents:
3326
diff
changeset
|
37 |
_baseFontNameI = tt2ps(_baseFontName,0,1) |
afa025c34493
reportlab: new base font mechanism more fully applied
rgbecker
parents:
3326
diff
changeset
|
38 |
_baseFontNameBI = tt2ps(_baseFontName,1,1) |
125 | 39 |
|
40 |
########################################################### |
|
41 |
# This class provides an 'instance inheritance' |
|
42 |
# mechanism for its descendants, simpler than acquisition |
|
43 |
# but not as far-reaching |
|
44 |
########################################################### |
|
45 |
class PropertySet: |
|
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
46 |
defaults = {} |
125 | 47 |
|
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
48 |
def __init__(self, name, parent=None, **kw): |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
49 |
"""When initialized, it copies the class defaults; |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
50 |
then takes a copy of the attributes of the parent |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
51 |
if any. All the work is done in init - styles |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
52 |
should cost little to use at runtime.""" |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
53 |
# step one - validate the hell out of it |
3326 | 54 |
assert 'name' not in self.defaults, "Class Defaults may not contain a 'name' attribute" |
55 |
assert 'parent' not in self.defaults, "Class Defaults may not contain a 'parent' attribute" |
|
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
56 |
if parent: |
3506 | 57 |
assert parent.__class__ == self.__class__, "Parent style %s must have same class as new style %s" % (parent.__class__.__name__,self.__class__.__name__) |
125 | 58 |
|
1683 | 59 |
#step two |
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
60 |
self.name = name |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
61 |
self.parent = parent |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
62 |
self.__dict__.update(self.defaults) |
125 | 63 |
|
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
64 |
#step two - copy from parent if any. Try to be |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
65 |
# very strict that only keys in class defaults are |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
66 |
# allowed, so they cannot inherit |
224 | 67 |
self.refresh() |
3479 | 68 |
self._setKwds(**kw) |
1683 | 69 |
|
3479 | 70 |
def _setKwds(self,**kw): |
1683 | 71 |
#step three - copy keywords if any |
3723
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
72 |
for key, value in kw.items(): |
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
73 |
self.__dict__[key] = value |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
74 |
|
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
75 |
def __repr__(self): |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
76 |
return "<%s '%s'>" % (self.__class__.__name__, self.name) |
125 | 77 |
|
224 | 78 |
def refresh(self): |
79 |
"""re-fetches attributes from the parent on demand; |
|
80 |
use if you have been hacking the styles. This is |
|
81 |
used by __init__""" |
|
82 |
if self.parent: |
|
3723
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
83 |
for key, value in self.parent.__dict__.items(): |
224 | 84 |
if (key not in ['name','parent']): |
85 |
self.__dict__[key] = value |
|
86 |
||
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
87 |
def listAttrs(self, indent=''): |
3721 | 88 |
print(indent + 'name =', self.name) |
89 |
print(indent + 'parent =', self.parent) |
|
90 |
keylist = list(self.__dict__.keys()) |
|
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
91 |
keylist.sort() |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
92 |
keylist.remove('name') |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
93 |
keylist.remove('parent') |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
94 |
for key in keylist: |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
95 |
value = self.__dict__.get(key, None) |
3721 | 96 |
print(indent + '%s = %s' % (key, value)) |
1683 | 97 |
|
3479 | 98 |
def clone(self, name, parent=None, **kwds): |
99 |
r = self.__class__(name,parent) |
|
100 |
r.__dict__ = self.__dict__.copy() |
|
4155
107bf32f15d9
fix Propertyset.clone contributed by Greg Jones via bitbucket
robin
parents:
4136
diff
changeset
|
101 |
r.name = name |
3479 | 102 |
r.parent = parent is None and self or parent |
103 |
r._setKwds(**kwds) |
|
104 |
return r |
|
105 |
||
125 | 106 |
class ParagraphStyle(PropertySet): |
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
107 |
defaults = { |
3368
afa025c34493
reportlab: new base font mechanism more fully applied
rgbecker
parents:
3326
diff
changeset
|
108 |
'fontName':_baseFontName, |
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
109 |
'fontSize':10, |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
110 |
'leading':12, |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
111 |
'leftIndent':0, |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
112 |
'rightIndent':0, |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
113 |
'firstLineIndent':0, |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
114 |
'alignment':TA_LEFT, |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
115 |
'spaceBefore':0, |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
116 |
'spaceAfter':0, |
3368
afa025c34493
reportlab: new base font mechanism more fully applied
rgbecker
parents:
3326
diff
changeset
|
117 |
'bulletFontName':_baseFontName, |
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
118 |
'bulletFontSize':10, |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
119 |
'bulletIndent':0, |
3540 | 120 |
#'bulletColor':black, |
532 | 121 |
'textColor': black, |
2575 | 122 |
'backColor':None, |
4098
7154a8213d29
paragraph.py, textobject.py: improved support for rtl, bump version to 3.1.14
robin
parents:
4067
diff
changeset
|
123 |
'wordWrap':None, #None means do nothing special |
7154a8213d29
paragraph.py, textobject.py: improved support for rtl, bump version to 3.1.14
robin
parents:
4067
diff
changeset
|
124 |
#CJK use Chinese Line breaking |
7154a8213d29
paragraph.py, textobject.py: improved support for rtl, bump version to 3.1.14
robin
parents:
4067
diff
changeset
|
125 |
#LTR RTL use left to right / right to left |
7154a8213d29
paragraph.py, textobject.py: improved support for rtl, bump version to 3.1.14
robin
parents:
4067
diff
changeset
|
126 |
#with support from pyfribi2 if available |
2921 | 127 |
'borderWidth': 0, |
128 |
'borderPadding': 0, |
|
129 |
'borderColor': None, |
|
130 |
'borderRadius': None, |
|
131 |
'allowWidows': 1, |
|
132 |
'allowOrphans': 0, |
|
2932
bcdff7b8f469
platypus: initial try at textTransform style attribute
rgbecker
parents:
2921
diff
changeset
|
133 |
'textTransform':None, #uppercase lowercase (captitalize not yet) or None or absent |
3575
6821eb805106
reportlab: added support for endDots in paragraphs styles
rgbecker
parents:
3567
diff
changeset
|
134 |
'endDots':None, #dots on the last line of left/right justified paras |
6821eb805106
reportlab: added support for endDots in paragraphs styles
rgbecker
parents:
3567
diff
changeset
|
135 |
#string or object with text and optional fontName, fontSize, textColor & backColor |
6821eb805106
reportlab: added support for endDots in paragraphs styles
rgbecker
parents:
3567
diff
changeset
|
136 |
#dy |
3738 | 137 |
'splitLongWords':1, #make best efforts to split long words |
4389
61a7f0840d00
more controllable under and strike lines; fix for issue 137 contributed by Tom Alexander @ bitbucket; version-->3.4.30
robin <robin@reportlab.com>
parents:
4370
diff
changeset
|
138 |
'underlineWidth': _baseUnderlineWidth, #underline width |
4136
16f067cf3dae
added rl_settings.decimalSymbol & support for simple bullet anchoring, version-->3.1.35
robin
parents:
4135
diff
changeset
|
139 |
'bulletAnchor': 'start', #where the bullet is anchored ie start, middle, end or numeric |
4220
c0e82d246798
add justifyBreaks & justifyLastLine ParagraphStyle attributes; version-->3.2.7
robin
parents:
4155
diff
changeset
|
140 |
'justifyLastLine': 0, #n allow justification on the last line for more than n words 0 means don't bother |
c0e82d246798
add justifyBreaks & justifyLastLine ParagraphStyle attributes; version-->3.2.7
robin
parents:
4155
diff
changeset
|
141 |
'justifyBreaks': 0, #justify lines broken with <br/> |
4277 | 142 |
'spaceShrinkage': spaceShrinkage, #allow shrinkage of percentage of space to fit on line |
4389
61a7f0840d00
more controllable under and strike lines; fix for issue 137 contributed by Tom Alexander @ bitbucket; version-->3.4.30
robin <robin@reportlab.com>
parents:
4370
diff
changeset
|
143 |
'strikeWidth': _baseStrikeWidth, #stroke width |
61a7f0840d00
more controllable under and strike lines; fix for issue 137 contributed by Tom Alexander @ bitbucket; version-->3.4.30
robin <robin@reportlab.com>
parents:
4370
diff
changeset
|
144 |
'underlineOffset': _baseUnderlineOffset, #fraction of fontsize to offset underlines |
61a7f0840d00
more controllable under and strike lines; fix for issue 137 contributed by Tom Alexander @ bitbucket; version-->3.4.30
robin <robin@reportlab.com>
parents:
4370
diff
changeset
|
145 |
'underlineGap': _baseUnderlineGap, #gap for double/triple underline |
61a7f0840d00
more controllable under and strike lines; fix for issue 137 contributed by Tom Alexander @ bitbucket; version-->3.4.30
robin <robin@reportlab.com>
parents:
4370
diff
changeset
|
146 |
'strikeOffset': _baseStrikeOffset, #fraction of fontsize to offset strikethrough |
61a7f0840d00
more controllable under and strike lines; fix for issue 137 contributed by Tom Alexander @ bitbucket; version-->3.4.30
robin <robin@reportlab.com>
parents:
4370
diff
changeset
|
147 |
'strikeGap': _baseStrikeGap, #gap for double/triple strike |
61a7f0840d00
more controllable under and strike lines; fix for issue 137 contributed by Tom Alexander @ bitbucket; version-->3.4.30
robin <robin@reportlab.com>
parents:
4370
diff
changeset
|
148 |
'linkUnderline': platypus_link_underline, |
61a7f0840d00
more controllable under and strike lines; fix for issue 137 contributed by Tom Alexander @ bitbucket; version-->3.4.30
robin <robin@reportlab.com>
parents:
4370
diff
changeset
|
149 |
#'underlineColor': None, |
61a7f0840d00
more controllable under and strike lines; fix for issue 137 contributed by Tom Alexander @ bitbucket; version-->3.4.30
robin <robin@reportlab.com>
parents:
4370
diff
changeset
|
150 |
#'strikeColor': None, |
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
151 |
} |
125 | 152 |
|
153 |
class LineStyle(PropertySet): |
|
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
154 |
defaults = { |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
155 |
'width':1, |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
156 |
'color': black |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
157 |
} |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
158 |
def prepareCanvas(self, canvas): |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
159 |
"""You can ask a LineStyle to set up the canvas for drawing |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
160 |
the lines.""" |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
161 |
canvas.setLineWidth(1) |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
162 |
#etc. etc. |
125 | 163 |
|
3479 | 164 |
class ListStyle(PropertySet): |
165 |
defaults = dict( |
|
166 |
leftIndent=18, |
|
167 |
rightIndent=0, |
|
168 |
bulletAlign='left', |
|
169 |
bulletType='1', |
|
3502 | 170 |
bulletColor=black, |
3479 | 171 |
bulletFontName='Helvetica', |
172 |
bulletFontSize=12, |
|
173 |
bulletOffsetY=0, |
|
174 |
bulletDedent='auto', |
|
175 |
bulletDir='ltr', |
|
176 |
bulletFormat=None, |
|
4323
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
177 |
start=None, #starting value for a list; if a list then the start sequence |
3479 | 178 |
) |
179 |
||
3433
0562ca2f5155
styles.py: new Stylesheet1 methods suggested by Roberto Alsina <ralsina@netmanagers.com.ar>
rgbecker
parents:
3368
diff
changeset
|
180 |
_stylesheet1_undefined = object() |
0562ca2f5155
styles.py: new Stylesheet1 methods suggested by Roberto Alsina <ralsina@netmanagers.com.ar>
rgbecker
parents:
3368
diff
changeset
|
181 |
|
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
182 |
class StyleSheet1: |
3028
082f5208644e
docstring modifications to adhere to restructuredtext
damian
parents:
2964
diff
changeset
|
183 |
""" |
082f5208644e
docstring modifications to adhere to restructuredtext
damian
parents:
2964
diff
changeset
|
184 |
This may or may not be used. The idea is to: |
082f5208644e
docstring modifications to adhere to restructuredtext
damian
parents:
2964
diff
changeset
|
185 |
|
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
186 |
1. slightly simplify construction of stylesheets; |
3028
082f5208644e
docstring modifications to adhere to restructuredtext
damian
parents:
2964
diff
changeset
|
187 |
|
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
188 |
2. enforce rules to validate styles when added |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
189 |
(e.g. we may choose to disallow having both |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
190 |
'heading1' and 'Heading1' - actual rules are |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
191 |
open to discussion); |
3028
082f5208644e
docstring modifications to adhere to restructuredtext
damian
parents:
2964
diff
changeset
|
192 |
|
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
193 |
3. allow aliases and alternate style lookup |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
194 |
mechanisms |
3028
082f5208644e
docstring modifications to adhere to restructuredtext
damian
parents:
2964
diff
changeset
|
195 |
|
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
196 |
4. Have a place to hang style-manipulation |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
197 |
methods (save, load, maybe support a GUI |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
198 |
editor) |
3028
082f5208644e
docstring modifications to adhere to restructuredtext
damian
parents:
2964
diff
changeset
|
199 |
|
082f5208644e
docstring modifications to adhere to restructuredtext
damian
parents:
2964
diff
changeset
|
200 |
Access is via getitem, so they can be |
082f5208644e
docstring modifications to adhere to restructuredtext
damian
parents:
2964
diff
changeset
|
201 |
compatible with plain old dictionaries. |
082f5208644e
docstring modifications to adhere to restructuredtext
damian
parents:
2964
diff
changeset
|
202 |
""" |
3433
0562ca2f5155
styles.py: new Stylesheet1 methods suggested by Roberto Alsina <ralsina@netmanagers.com.ar>
rgbecker
parents:
3368
diff
changeset
|
203 |
|
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
204 |
def __init__(self): |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
205 |
self.byName = {} |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
206 |
self.byAlias = {} |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
207 |
|
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
208 |
def __getitem__(self, key): |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
209 |
try: |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
210 |
return self.byAlias[key] |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
211 |
except KeyError: |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
212 |
try: |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
213 |
return self.byName[key] |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
214 |
except KeyError: |
3368
afa025c34493
reportlab: new base font mechanism more fully applied
rgbecker
parents:
3326
diff
changeset
|
215 |
raise KeyError("Style '%s' not found in stylesheet" % key) |
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
216 |
|
3433
0562ca2f5155
styles.py: new Stylesheet1 methods suggested by Roberto Alsina <ralsina@netmanagers.com.ar>
rgbecker
parents:
3368
diff
changeset
|
217 |
def get(self,key,default=_stylesheet1_undefined): |
0562ca2f5155
styles.py: new Stylesheet1 methods suggested by Roberto Alsina <ralsina@netmanagers.com.ar>
rgbecker
parents:
3368
diff
changeset
|
218 |
try: |
0562ca2f5155
styles.py: new Stylesheet1 methods suggested by Roberto Alsina <ralsina@netmanagers.com.ar>
rgbecker
parents:
3368
diff
changeset
|
219 |
return self[key] |
0562ca2f5155
styles.py: new Stylesheet1 methods suggested by Roberto Alsina <ralsina@netmanagers.com.ar>
rgbecker
parents:
3368
diff
changeset
|
220 |
except KeyError: |
0562ca2f5155
styles.py: new Stylesheet1 methods suggested by Roberto Alsina <ralsina@netmanagers.com.ar>
rgbecker
parents:
3368
diff
changeset
|
221 |
if default!=_stylesheet1_undefined: return default |
0562ca2f5155
styles.py: new Stylesheet1 methods suggested by Roberto Alsina <ralsina@netmanagers.com.ar>
rgbecker
parents:
3368
diff
changeset
|
222 |
raise |
0562ca2f5155
styles.py: new Stylesheet1 methods suggested by Roberto Alsina <ralsina@netmanagers.com.ar>
rgbecker
parents:
3368
diff
changeset
|
223 |
|
3326 | 224 |
def __contains__(self, key): |
225 |
return key in self.byAlias or key in self.byName |
|
460 | 226 |
|
3433
0562ca2f5155
styles.py: new Stylesheet1 methods suggested by Roberto Alsina <ralsina@netmanagers.com.ar>
rgbecker
parents:
3368
diff
changeset
|
227 |
def has_key(self,key): |
0562ca2f5155
styles.py: new Stylesheet1 methods suggested by Roberto Alsina <ralsina@netmanagers.com.ar>
rgbecker
parents:
3368
diff
changeset
|
228 |
return key in self |
0562ca2f5155
styles.py: new Stylesheet1 methods suggested by Roberto Alsina <ralsina@netmanagers.com.ar>
rgbecker
parents:
3368
diff
changeset
|
229 |
|
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
230 |
def add(self, style, alias=None): |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
231 |
key = style.name |
3326 | 232 |
if key in self.byName: |
3368
afa025c34493
reportlab: new base font mechanism more fully applied
rgbecker
parents:
3326
diff
changeset
|
233 |
raise KeyError("Style '%s' already defined in stylesheet" % key) |
3326 | 234 |
if key in self.byAlias: |
3368
afa025c34493
reportlab: new base font mechanism more fully applied
rgbecker
parents:
3326
diff
changeset
|
235 |
raise KeyError("Style name '%s' is already an alias in stylesheet" % key) |
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
236 |
|
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
237 |
if alias: |
3326 | 238 |
if alias in self.byName: |
3368
afa025c34493
reportlab: new base font mechanism more fully applied
rgbecker
parents:
3326
diff
changeset
|
239 |
raise KeyError("Style '%s' already defined in stylesheet" % alias) |
3326 | 240 |
if alias in self.byAlias: |
3368
afa025c34493
reportlab: new base font mechanism more fully applied
rgbecker
parents:
3326
diff
changeset
|
241 |
raise KeyError("Alias name '%s' is already an alias in stylesheet" % alias) |
1683 | 242 |
#passed all tests? OK, add it |
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
243 |
self.byName[key] = style |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
244 |
if alias: |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
245 |
self.byAlias[alias] = style |
1683 | 246 |
|
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
247 |
def list(self): |
3721 | 248 |
styles = list(self.byName.items()) |
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
249 |
styles.sort() |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
250 |
alii = {} |
3721 | 251 |
for (alias, style) in list(self.byAlias.items()): |
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
252 |
alii[style] = alias |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
253 |
for (name, style) in styles: |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
254 |
alias = alii.get(style, None) |
3721 | 255 |
print(name, alias) |
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
256 |
style.listAttrs(' ') |
3721 | 257 |
print() |
1683 | 258 |
|
125 | 259 |
def testStyles(): |
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
260 |
pNormal = ParagraphStyle('Normal',None) |
3368
afa025c34493
reportlab: new base font mechanism more fully applied
rgbecker
parents:
3326
diff
changeset
|
261 |
pNormal.fontName = _baseFontName |
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
262 |
pNormal.fontSize = 12 |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
263 |
pNormal.leading = 14.4 |
125 | 264 |
|
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
265 |
pNormal.listAttrs() |
3721 | 266 |
print() |
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
267 |
pPre = ParagraphStyle('Literal', pNormal) |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
268 |
pPre.fontName = 'Courier' |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
269 |
pPre.listAttrs() |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
270 |
return pNormal, pPre |
125 | 271 |
|
272 |
def getSampleStyleSheet(): |
|
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
273 |
"""Returns a stylesheet object""" |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
274 |
stylesheet = StyleSheet1() |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
275 |
|
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
276 |
stylesheet.add(ParagraphStyle(name='Normal', |
3368
afa025c34493
reportlab: new base font mechanism more fully applied
rgbecker
parents:
3326
diff
changeset
|
277 |
fontName=_baseFontName, |
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
278 |
fontSize=10, |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
279 |
leading=12) |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
280 |
) |
125 | 281 |
|
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
282 |
stylesheet.add(ParagraphStyle(name='BodyText', |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
283 |
parent=stylesheet['Normal'], |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
284 |
spaceBefore=6) |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
285 |
) |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
286 |
stylesheet.add(ParagraphStyle(name='Italic', |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
287 |
parent=stylesheet['BodyText'], |
3368
afa025c34493
reportlab: new base font mechanism more fully applied
rgbecker
parents:
3326
diff
changeset
|
288 |
fontName = _baseFontNameI) |
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
289 |
) |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
290 |
|
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
291 |
stylesheet.add(ParagraphStyle(name='Heading1', |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
292 |
parent=stylesheet['Normal'], |
3368
afa025c34493
reportlab: new base font mechanism more fully applied
rgbecker
parents:
3326
diff
changeset
|
293 |
fontName = _baseFontNameB, |
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
294 |
fontSize=18, |
512 | 295 |
leading=22, |
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
296 |
spaceAfter=6), |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
297 |
alias='h1') |
125 | 298 |
|
530 | 299 |
stylesheet.add(ParagraphStyle(name='Title', |
300 |
parent=stylesheet['Normal'], |
|
3368
afa025c34493
reportlab: new base font mechanism more fully applied
rgbecker
parents:
3326
diff
changeset
|
301 |
fontName = _baseFontNameB, |
530 | 302 |
fontSize=18, |
303 |
leading=22, |
|
304 |
alignment=TA_CENTER, |
|
305 |
spaceAfter=6), |
|
306 |
alias='title') |
|
307 |
||
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
308 |
stylesheet.add(ParagraphStyle(name='Heading2', |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
309 |
parent=stylesheet['Normal'], |
3368
afa025c34493
reportlab: new base font mechanism more fully applied
rgbecker
parents:
3326
diff
changeset
|
310 |
fontName = _baseFontNameB, |
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
311 |
fontSize=14, |
512 | 312 |
leading=18, |
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
313 |
spaceBefore=12, |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
314 |
spaceAfter=6), |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
315 |
alias='h2') |
1683 | 316 |
|
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
317 |
stylesheet.add(ParagraphStyle(name='Heading3', |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
318 |
parent=stylesheet['Normal'], |
3368
afa025c34493
reportlab: new base font mechanism more fully applied
rgbecker
parents:
3326
diff
changeset
|
319 |
fontName = _baseFontNameBI, |
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
320 |
fontSize=12, |
512 | 321 |
leading=14, |
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
322 |
spaceBefore=12, |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
323 |
spaceAfter=6), |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
324 |
alias='h3') |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
325 |
|
3139 | 326 |
stylesheet.add(ParagraphStyle(name='Heading4', |
327 |
parent=stylesheet['Normal'], |
|
3368
afa025c34493
reportlab: new base font mechanism more fully applied
rgbecker
parents:
3326
diff
changeset
|
328 |
fontName = _baseFontNameBI, |
3139 | 329 |
fontSize=10, |
330 |
leading=12, |
|
331 |
spaceBefore=10, |
|
332 |
spaceAfter=4), |
|
333 |
alias='h4') |
|
334 |
||
335 |
stylesheet.add(ParagraphStyle(name='Heading5', |
|
336 |
parent=stylesheet['Normal'], |
|
3368
afa025c34493
reportlab: new base font mechanism more fully applied
rgbecker
parents:
3326
diff
changeset
|
337 |
fontName = _baseFontNameB, |
3139 | 338 |
fontSize=9, |
339 |
leading=10.8, |
|
340 |
spaceBefore=8, |
|
341 |
spaceAfter=4), |
|
342 |
alias='h5') |
|
343 |
||
344 |
stylesheet.add(ParagraphStyle(name='Heading6', |
|
345 |
parent=stylesheet['Normal'], |
|
3368
afa025c34493
reportlab: new base font mechanism more fully applied
rgbecker
parents:
3326
diff
changeset
|
346 |
fontName = _baseFontNameB, |
3139 | 347 |
fontSize=7, |
348 |
leading=8.4, |
|
349 |
spaceBefore=6, |
|
350 |
spaceAfter=2), |
|
351 |
alias='h6') |
|
352 |
||
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
353 |
stylesheet.add(ParagraphStyle(name='Bullet', |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
354 |
parent=stylesheet['Normal'], |
546 | 355 |
firstLineIndent=0, |
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
356 |
spaceBefore=3), |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
357 |
alias='bu') |
125 | 358 |
|
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
359 |
stylesheet.add(ParagraphStyle(name='Definition', |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
360 |
parent=stylesheet['Normal'], |
546 | 361 |
firstLineIndent=0, |
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
362 |
leftIndent=36, |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
363 |
bulletIndent=0, |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
364 |
spaceBefore=6, |
3368
afa025c34493
reportlab: new base font mechanism more fully applied
rgbecker
parents:
3326
diff
changeset
|
365 |
bulletFontName=_baseFontNameBI), |
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
366 |
alias='df') |
125 | 367 |
|
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
368 |
stylesheet.add(ParagraphStyle(name='Code', |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
369 |
parent=stylesheet['Normal'], |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
370 |
fontName='Courier', |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
371 |
fontSize=8, |
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
372 |
leading=8.8, |
546 | 373 |
firstLineIndent=0, |
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
374 |
leftIndent=36)) |
1683 | 375 |
|
4323
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
376 |
stylesheet.add(ListStyle(name='UnorderedList', |
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
377 |
parent=None, |
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
378 |
leftIndent=18, |
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
379 |
rightIndent=0, |
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
380 |
bulletAlign='left', |
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
381 |
bulletType='1', |
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
382 |
bulletColor=black, |
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
383 |
bulletFontName='Helvetica', |
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
384 |
bulletFontSize=12, |
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
385 |
bulletOffsetY=0, |
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
386 |
bulletDedent='auto', |
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
387 |
bulletDir='ltr', |
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
388 |
bulletFormat=None, |
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
389 |
#start='circle square blackstar sparkle disc diamond'.split(), |
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
390 |
start=None, |
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
391 |
), |
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
392 |
alias='ul') |
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
393 |
|
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
394 |
stylesheet.add(ListStyle(name='OrderedList', |
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
395 |
parent=None, |
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
396 |
leftIndent=18, |
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
397 |
rightIndent=0, |
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
398 |
bulletAlign='left', |
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
399 |
bulletType='1', |
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
400 |
bulletColor=black, |
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
401 |
bulletFontName='Helvetica', |
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
402 |
bulletFontSize=12, |
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
403 |
bulletOffsetY=0, |
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
404 |
bulletDedent='auto', |
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
405 |
bulletDir='ltr', |
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
406 |
bulletFormat=None, |
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
407 |
#start='1 a A i I'.split(), |
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
408 |
start=None, |
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
409 |
), |
fa6de076ed0b
add support for rotating bullets in ListFlowable; version-->3.3.33
robin <robin@reportlab.com>
parents:
4277
diff
changeset
|
410 |
alias='ol') |
187
1f22787ae36b
Stylesheets become classes; styles copy data on __init__
andy_robinson
parents:
142
diff
changeset
|
411 |
return stylesheet |