first attempt at oo-oo is done!
[o_s.git] / dingbat_spices.py
blob83636dca61d5316d68c715bf0dd5c1a3f0f14eef
1 # -*- coding: utf-8 -*-
2 # drawing hearts in the snow!
4 from odf.opendocument import OpenDocumentText
5 from odf.text import P
6 from odf.style import Style, TextProperties, ParagraphProperties, BackgroundImage, GraphicProperties
7 from odf.draw import Frame, TextBox
9 from liblove import *
11 class DingbatSpice(Spice):
12 def __init__(self, genre, style):
13 Spice.__init__(self, genre, style)
14 self.dingbats = dingbats
16 def dingbat_column(self, odt, spice):
17 ## graphic
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"]
25 ## paragraphic
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_spices(self):
39 spices = self.dingbats.keys()
40 for myspice in spices:
41 myodt = OpenDocumentText()
43 genredotstyle = self.read_stylesheet()
44 myodt.styles.addElement(genredotstyle)
45 frame_border(myodt)
47 self.text_frame(myodt)
48 self.dingbat_column(myodt, myspice)
50 self.label(myodt, myspice)
52 myname = self.genre + "/" + self.style + "/dingbat/" + self.genre + "_" + self.style + "_" + myspice
53 myodt.save(myname, True)
55 if __name__ == "__main__":
56 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"✴"],
57 "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"✼"],
58 "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"❍"]
60 directory_structure()
61 for genre in ["brief", "verhaal", "gedicht"]:
62 for style in text_style[genre].keys():
63 to_season = DingbatSpice(genre, style)
64 to_season.loop_over_spices()