tests/test_pdfgen_pycanvas.py
branchpy33
changeset 3721 0c93dd8ff567
parent 3617 ae5744e97c42
child 3794 398ea04239b5
equal deleted inserted replaced
3720:7a059dde5bf5 3721:0c93dd8ff567
   134         canvas.rect(x + 9, y - height + 9, 198, height - 18)
   134         canvas.rect(x + 9, y - height + 9, 198, height - 18)
   135         #boundary:
   135         #boundary:
   136         self.namespace = {'canvas':canvas,'cm': cm,'inch':inch}
   136         self.namespace = {'canvas':canvas,'cm': cm,'inch':inch}
   137         canvas.translate(x+9, y - height + 9)
   137         canvas.translate(x+9, y - height + 9)
   138         codeObj = compile(self.code, '<sample>','exec')
   138         codeObj = compile(self.code, '<sample>','exec')
   139         exec codeObj in self.namespace
   139         exec(codeObj, self.namespace)
   140 
   140 
   141         canvas.restoreState()
   141         canvas.restoreState()
   142 
   142 
   143 
   143 
   144 def drawAxes(canvas, label):
   144 def drawAxes(canvas, label):
   745     c.save()
   745     c.save()
   746     source = str(c)
   746     source = str(c)
   747     open(outputfile("test_pdfgen_pycanvas_out.txt"),"w").write(source)
   747     open(outputfile("test_pdfgen_pycanvas_out.txt"),"w").write(source)
   748     import reportlab.rl_config
   748     import reportlab.rl_config
   749     if reportlab.rl_config.verbose:
   749     if reportlab.rl_config.verbose:
   750         print source
   750         print(source)
   751 
   751 
   752 
   752 
   753 def pageShapes(c):
   753 def pageShapes(c):
   754     """Demonstrates the basic lines and shapes"""
   754     """Demonstrates the basic lines and shapes"""
   755 
   755 
   762 
   762 
   763     y = 9 * inch
   763     y = 9 * inch
   764     d = DocBlock()
   764     d = DocBlock()
   765     d.comment1 = 'Lesson one'
   765     d.comment1 = 'Lesson one'
   766     d.code = "canvas.textOut('hello, world')"
   766     d.code = "canvas.textOut('hello, world')"
   767     print d.code
   767     print(d.code)
   768 
   768 
   769     d.comment2 = 'Lesson two'
   769     d.comment2 = 'Lesson two'
   770 
   770 
   771     d.draw(c, inch, 9 * inch)
   771     d.draw(c, inch, 9 * inch)
   772 
   772