7 text
.preamble(r
"\renewcommand{\familydefault}{\ttdefault}")
10 # positioning is quite ugly ... but it works at the moment
17 # we could use (gray|rgb|cmyk).__dict__ to get the instances, but we
18 # would loose the ordering ... instead we just parse the file:
20 # TODO: code something along the lines of c.l.p post cbs38g$2kp$04$1@news.t-online.com
22 p
= re
.compile("(?P<id>(?P<model>[a-z]+)\\.(?P<name>[a-z]+)) += (?P=model)\\([0-9\\., ]+\\)\n", re
.IGNORECASE
)
23 lines
= imp
.find_module("color", pyx
.__path
__)[0].readlines()
24 for line
in lines
: # we yet don't use a file iterator
27 if lastmodel
and (m
.group("model") != lastmodel
):
29 myc
= pyx
.color
.__dict
__[m
.group("model")].__dict
__[m
.group("name")]
30 c
.stroke(path
.line(x
+ 0.1, y
+ 0.1, x
+ 0.4, y
+ 0.4), [myc
])
31 c
.stroke(path
.line(x
+ 0.4, y
+ 0.1, x
+ 0.1, y
+ 0.4), [myc
])
32 c
.fill(path
.rect(x
+ 0.5, y
, 1, 0.5), [myc
])
33 c
.stroke(path
.line(x
+ 0.6, y
+ 0.1, x
+ 0.9, y
+ 0.4), [color
.gray
.black
])
34 c
.stroke(path
.line(x
+ 0.9, y
+ 0.1, x
+ 0.6, y
+ 0.4), [color
.gray
.black
])
35 c
.stroke(path
.line(x
+ 1.1, y
+ 0.1, x
+ 1.4, y
+ 0.4), [color
.gray
.white
])
36 c
.stroke(path
.line(x
+ 1.4, y
+ 0.1, x
+ 1.1, y
+ 0.4), [color
.gray
.white
])
37 c
.text(x
+ 1.7, y
+ 0.15, m
.group("id"), [text
.size
.footnotesize
])
39 lastmodel
= m
.group("model")