2 # -*- coding: ISO-8859-1 -*-
3 import sys
; sys
.path
[:0] = ["../.."]
7 from pyx
.font
.font
import PDFTimesBold
8 from pyx
.pdfextra
import *
15 llx
, lly
, w
, h
= 0, 0, 5, 1
16 c
.text(llx
, lly
+h
, "first textfield:", [text
.vshift(-0.5)])
17 c
.stroke(path
.rect(llx
-d
, lly
-d
, w
+2*d
, h
+2*d
))
18 c
.insert(textfield(llx
, lly
, w
, h
, name
="textfield", defaultvalue
="hallo", multiline
=1,
21 llx
, lly
, w
, h
= 0, -2, 1, 1
22 c
.text(llx
, lly
+h
, "second textfield:", [text
.vshift(-0.5)])
23 c
.stroke(path
.rect(llx
-d
, lly
-d
, w
+2*d
, h
+2*d
))
24 c
.insert(textfield(llx
, lly
, w
, h
, name
="another"))
31 c
.text(0, 0, "first checkbox:", [text
.vshift(-0.5)])
32 c
.insert(checkbox(0, -0.5, name
="checkbox", defaulton
=1))
39 c
.text(0, 0, "first radiobuttons:", [text
.vshift(-0.5)])
40 pos
= [(0, -0.5), (0, -1.0), (0, -1.5)]
41 values
= ["One", "Two", "Three"]
42 for (x
, y
), value
in zip(pos
, values
):
43 c
.text(x
+12*unit
.x_pt
, y
, value
)
44 c
.insert(radiobuttons(pos
, name
="button", values
=values
, defaultvalue
=values
[0]))
46 # XXX : default entry is activated with the others
54 llx
, lly
, w
, h
= 0, 0, 5, 1
55 values
= ["One", "Two", "Three"]
56 c
.text(llx
, lly
+h
, "first choicefield:", [text
.vshift(-0.5)])
57 c
.stroke(path
.rect(llx
-d
, lly
-d
, w
+2*d
, h
+2*d
))
58 c
.insert(choicefield(llx
, lly
, w
, h
, name
="choicefield", values
=values
, defaultvalue
=values
[0],
63 # write all test into one canvas
65 for cc
in [texttest(), checkboxtest(), radiotest(), choicetest()]:
69 t
= [trafo
.translate(0, c
.bbox().bottom() - cc
.bbox().top() - 1)]
71 #c.stroke(cc.bbox().path(), t + [color.rgb.red, style.linestyle.dotted])
73 # test the transformation behaviour:
74 cc
= canvas
.canvas([trafo
.scale(0.3)])#, trafo.rotate(90)])
75 cc
.fill(c
.bbox().path(), [color
.gray(0.9)])
77 d
= document
.document([document
.page(cc
, bboxenlarge
=1)])
78 d
.writePDFfile("test_pdfextra", compress
=0)
81 # vim:fdm=marker:fmr=<<<,>>>: