1 # -*- coding: utf-8 -*-
2 # drawing hearts in the snow!
4 from odf
.opendocument
import OpenDocumentText
6 from odf
.style
import Style
, TextProperties
, ParagraphProperties
, BackgroundImage
, GraphicProperties
7 from odf
.draw
import Frame
, TextBox
11 dingbats
= {"kristallen" : [u
"✭", u
"✮", u
"✯", u
"✰", u
"✱", u
"✲", u
"✳", u
"✴", u
"✭", u
"✮", u
"✯", u
"✰", u
"✱", u
"✲", u
"✳", u
"✴", u
"✭", u
"✮", u
"✯", u
"✰", u
"✱", u
"✲", u
"✳", u
"✴", u
"✭", u
"✮", u
"✯", u
"✰", u
"✱", u
"✲", u
"✳", u
"✴",u
"✭", u
"✮", u
"✯", u
"✰", u
"✱", u
"✲", u
"✳", u
"✴", u
"✭", u
"✮", u
"✯", u
"✰", u
"✱", u
"✲", u
"✳", u
"✴", u
"✭", u
"✮", u
"✯", u
"✰", u
"✱", u
"✲", u
"✳", u
"✴", u
"✭", u
"✮", u
"✯", u
"✰", u
"✱", u
"✲", u
"✳", u
"✴"],
12 "roze" : [u
"✿", u
"❀", u
"✿", u
"❀", u
"❁", u
"✼", u
" ", u
"✿", u
"❀",u
"✿", u
"❀", u
"❁", u
"✼", u
" ", u
"✿", u
"❀", u
"✿", u
"❀", u
"❁", u
"✼", u
" ", u
"✿", u
"❀",u
"✿", u
"❀", u
"❁", u
"✼", u
" ", u
"✿", u
"❀", u
"✿", u
"❀", u
"❁", u
"✼", u
" ", u
"✿", u
"❀",u
"✿", u
"❀", u
"❁", u
"✼"],
13 "lavendel" : [u
"҈", u
"❍", u
"҈", u
"❍", u
"҈", u
"❍", u
"҈", u
"❍", u
"҈", u
"❍", u
"҈", u
"❍", u
"҈", u
"❍",u
"҈", u
"❍", u
"҈", u
"❍", u
"҈", u
"❍", u
"҈", u
"❍", u
"҈", u
"❍", u
"҈", u
"❍", u
"҈", u
"❍",u
"҈", u
"❍", u
"҈", u
"❍", u
"҈", u
"❍", u
"҈", u
"❍", u
"҈", u
"❍", u
"҈", u
"❍", u
"҈", u
"❍",u
"҈", u
"❍", u
"҈", u
"❍", u
"҈", u
"❍", u
"҈", u
"❍", u
"҈", u
"❍", u
"҈", u
"❍", u
"҈", u
"❍"]
16 def dingbat_spices(odt
, spice
):
18 graphic_style
= Style(name
="Dingbat Frame", family
="graphic")
19 graphic_properties
= GraphicProperties()
20 graphic_style
.addElement(graphic_properties
)
21 frame
= make_frame(odt
, graphic_style
, "240mm", "10mm", "0mm", "0mm", "100")
22 frameframe
= frame
["frame"]
23 textbox
= frame
["textbox"]
26 paragraphic_style
= Style(name
="Dingbats", family
="paragraph")
27 text_props
= TextProperties(fontsize
="14pt", fontfamily
="FreeSerif")
28 paragraphic_style
.addElement(text_props
)
29 paragraph_props
= ParagraphProperties()
30 paragraphic_style
.addElement(paragraph_props
)
31 odt
.styles
.addElement(paragraphic_style
)
33 for i
in dingbats
[spice
]:
34 kinda_p(paragraphic_style
, i
, textbox
)
36 odt
.text
.addElement(frameframe
)
38 def loop_over_dingbat_spices(genre
, style
):
39 spices
= dingbats
.keys()
40 for myspice
in spices
:
41 myodt
= OpenDocumentText()
43 genredotstyle
= read_stylesheet(genre
, style
)
44 myodt
.styles
.addElement(genredotstyle
)
47 text_frame(myodt
, genre
)
48 dingbat_spices(myodt
, myspice
)
50 label(myodt
, myspice
, style
)
52 myname
= genre
+ "/" + style
+ "/dingbat/" + genre
+ "_" + style
+ "_" + myspice
53 myodt
.save(myname
, True)
56 for genre
in ["brief", "verhaal", "gedicht"]:
57 for style
in text_style
[genre
].keys():
58 loop_over_dingbat_spices(genre
, style
)