src/reportlab/graphics/renderPDF.py
changeset 4551 d357e2acc856
parent 4528 e09377955af8
equal deleted inserted replaced
4550:80dd9e83dad9 4551:d357e2acc856
   347     #grab all drawings from the test module
   347     #grab all drawings from the test module
   348     from reportlab.graphics import testshapes
   348     from reportlab.graphics import testshapes
   349     drawings = []
   349     drawings = []
   350     for funcname in dir(testshapes):
   350     for funcname in dir(testshapes):
   351         if funcname[0:10] == 'getDrawing':
   351         if funcname[0:10] == 'getDrawing':
   352             drawing = eval('testshapes.' + funcname + '()')  #execute it
   352             func = getattr(testshapes,funcname)
   353             docstring = eval('testshapes.' + funcname + '.__doc__')
   353             drawing = func()  #execute it
       
   354             docstring = getattr(func,'__doc__','')
   354             drawings.append((drawing, docstring))
   355             drawings.append((drawing, docstring))
   355 
   356 
   356     #print in a loop, with their doc strings
   357     #print in a loop, with their doc strings
   357     c.setFont(_baseGFontName, 12)
   358     c.setFont(_baseGFontName, 12)
   358     y = 740
   359     y = 740
   379 
   380 
   380     c.save()
   381     c.save()
   381     if shout or verbose>2:
   382     if shout or verbose>2:
   382         print('saved %s' % ascii(fn))
   383         print('saved %s' % ascii(fn))
   383 
   384 
   384 ##def testFlowable():
       
   385 ##    """Makes a platypus document"""
       
   386 ##    from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer
       
   387 ##    from reportlab.lib.styles import getSampleStyleSheet
       
   388 ##    styles = getSampleStyleSheet()
       
   389 ##    styNormal = styles['Normal']
       
   390 ##
       
   391 ##    doc = SimpleDocTemplate('test_flowable.pdf')
       
   392 ##    story = []
       
   393 ##    story.append(Paragraph("This sees is a drawing can work as a flowable", styNormal))
       
   394 ##
       
   395 ##    import testdrawings
       
   396 ##    drawings = []
       
   397 ##
       
   398 ##    for funcname in dir(testdrawings):
       
   399 ##        if funcname[0:10] == 'getDrawing':
       
   400 ##            drawing = eval('testdrawings.' + funcname + '()')  #execute it
       
   401 ##            docstring = eval('testdrawings.' + funcname + '.__doc__')
       
   402 ##            story.append(Paragraph(docstring, styNormal))
       
   403 ##            story.append(Spacer(18,18))
       
   404 ##            story.append(drawing)
       
   405 ##            story.append(Spacer(36,36))
       
   406 ##
       
   407 ##    doc.build(story)
       
   408 ##    print 'saves test_flowable.pdf'
       
   409 
       
   410 if __name__=='__main__':
   385 if __name__=='__main__':
   411     test(shout=True)
   386     test(shout=True)
   412     import sys
   387     import sys
   413     if len(sys.argv)>1:
   388     if len(sys.argv)>1:
   414         outdir = sys.argv[1]
   389         outdir = sys.argv[1]