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