src/reportlab/graphics/renderSVG.py
changeset 4551 d357e2acc856
parent 4474 066480f7a206
equal deleted inserted replaced
4550:80dd9e83dad9 4551:d357e2acc856
   353 
   353 
   354         if isinstance(array,(float,int)):
   354         if isinstance(array,(float,int)):
   355             self.style['stroke-dasharray'] = ', '.join(map(str, ([array, phase])))
   355             self.style['stroke-dasharray'] = ', '.join(map(str, ([array, phase])))
   356         elif isinstance(array,(tuple,list)) and len(array) > 0:
   356         elif isinstance(array,(tuple,list)) and len(array) > 0:
   357             assert phase >= 0, "phase is a length in user space"
   357             assert phase >= 0, "phase is a length in user space"
   358             self.style['stroke-dasharray'] = ', '.join(map(str, (array+[phase])))
   358             self.style['stroke-dasharray'] = ', '.join(map(str, (list(array)+[phase])))
   359 
   359 
   360     def setStrokeColor(self, color):
   360     def setStrokeColor(self, color):
   361         self._strokeColor = color
   361         self._strokeColor = color
   362         if color == None:
   362         if color == None:
   363             self.style['stroke'] = 'none'
   363             self.style['stroke'] = 'none'
   931     #grab all drawings from the test module
   931     #grab all drawings from the test module
   932     from reportlab.graphics import testshapes
   932     from reportlab.graphics import testshapes
   933     drawings = []
   933     drawings = []
   934 
   934 
   935     for funcname in dir(testshapes):
   935     for funcname in dir(testshapes):
   936         #if funcname[0:11] == 'getDrawing2':
       
   937         #    print 'hacked to only show drawing 2'
       
   938         if funcname[0:10] == 'getDrawing':
   936         if funcname[0:10] == 'getDrawing':
   939             drawing = eval('testshapes.' + funcname + '()')
   937             func = getattr(testshapes,funcname)
   940             docstring = eval('testshapes.' + funcname + '.__doc__')
   938             drawing = func()
       
   939             docstring = getattr(func,'__doc__','')
   941             drawings.append((drawing, docstring))
   940             drawings.append((drawing, docstring))
   942 
       
   943 
   941 
   944     i = 0
   942     i = 0
   945     for (d, docstring) in drawings:
   943     for (d, docstring) in drawings:
   946         filename = os.path.join(outDir,'renderSVG_%d.svg' % i)
   944         filename = os.path.join(outDir,'renderSVG_%d.svg' % i)
   947         drawToFile(d, filename)
   945         drawToFile(d, filename)