rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
y = rowpos + cellstyle.bottomPadding+n*leading
y = rowpos + cellstyle.bottomPadding+n*leading-fontsize
def _drawCell(self, cellval, cellstyle, (colpos, rowpos), (colwidth, rowheight)): #print "cellstyle is ", repr(cellstyle), id(cellstyle) if self._curcellstyle is not cellstyle: cur = self._curcellstyle if cur is None or cellstyle.color != cur.color: #print "setting cell color to %s" % `cellstyle.color` self.canv.setFillColor(cellstyle.color) if cur is None or cellstyle.leading != cur.leading or cellstyle.fontname != cur.fontname or cellstyle.fontsize != cur.fontsize: #print "setting font: %s, %s, %s" % (cellstyle.fontname, cellstyle.fontsize, cellstyle.leading) self.canv.setFont(cellstyle.fontname, cellstyle.fontsize, cellstyle.leading) self._curcellstyle = cellstyle #print "leading is ", cellstyle.leading, "size is", cellstyle.fontsize just = cellstyle.alignment #print "alignment is ", just if just == 'LEFT': draw = self.canv.drawString x = colpos + cellstyle.leftPadding elif just in ('CENTRE', 'CENTER'): draw = self.canv.drawCentredString x = colpos + colwidth * 0.5 elif just == 'RIGHT': draw = self.canv.drawRightString x = colpos + colwidth - cellstyle.rightPadding else: raise ValueError, 'Invalid justification %s' % just
05bfe223624d1df66401c7f78a6ac81f78006d39 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/05bfe223624d1df66401c7f78a6ac81f78006d39/tables.py
y = rowpos + rowheight - cellstyle.topPadding - cellstyle.fontsize
y = rowpos + rowheight - cellstyle.topPadding - fontsize
def _drawCell(self, cellval, cellstyle, (colpos, rowpos), (colwidth, rowheight)): #print "cellstyle is ", repr(cellstyle), id(cellstyle) if self._curcellstyle is not cellstyle: cur = self._curcellstyle if cur is None or cellstyle.color != cur.color: #print "setting cell color to %s" % `cellstyle.color` self.canv.setFillColor(cellstyle.color) if cur is None or cellstyle.leading != cur.leading or cellstyle.fontname != cur.fontname or cellstyle.fontsize != cur.fontsize: #print "setting font: %s, %s, %s" % (cellstyle.fontname, cellstyle.fontsize, cellstyle.leading) self.canv.setFont(cellstyle.fontname, cellstyle.fontsize, cellstyle.leading) self._curcellstyle = cellstyle #print "leading is ", cellstyle.leading, "size is", cellstyle.fontsize just = cellstyle.alignment #print "alignment is ", just if just == 'LEFT': draw = self.canv.drawString x = colpos + cellstyle.leftPadding elif just in ('CENTRE', 'CENTER'): draw = self.canv.drawCentredString x = colpos + colwidth * 0.5 elif just == 'RIGHT': draw = self.canv.drawRightString x = colpos + colwidth - cellstyle.rightPadding else: raise ValueError, 'Invalid justification %s' % just
05bfe223624d1df66401c7f78a6ac81f78006d39 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/05bfe223624d1df66401c7f78a6ac81f78006d39/tables.py
y = rowpos + (cellstyle.bottomPadding + rowheight - cellstyle.topPadding+n*leading)/2.0
y = rowpos + (cellstyle.bottomPadding + rowheight-cellstyle.topPadding+(n-1)*leading)/2.0+leading-fontsize
def _drawCell(self, cellval, cellstyle, (colpos, rowpos), (colwidth, rowheight)): #print "cellstyle is ", repr(cellstyle), id(cellstyle) if self._curcellstyle is not cellstyle: cur = self._curcellstyle if cur is None or cellstyle.color != cur.color: #print "setting cell color to %s" % `cellstyle.color` self.canv.setFillColor(cellstyle.color) if cur is None or cellstyle.leading != cur.leading or cellstyle.fontname != cur.fontname or cellstyle.fontsize != cur.fontsize: #print "setting font: %s, %s, %s" % (cellstyle.fontname, cellstyle.fontsize, cellstyle.leading) self.canv.setFont(cellstyle.fontname, cellstyle.fontsize, cellstyle.leading) self._curcellstyle = cellstyle #print "leading is ", cellstyle.leading, "size is", cellstyle.fontsize just = cellstyle.alignment #print "alignment is ", just if just == 'LEFT': draw = self.canv.drawString x = colpos + cellstyle.leftPadding elif just in ('CENTRE', 'CENTER'): draw = self.canv.drawCentredString x = colpos + colwidth * 0.5 elif just == 'RIGHT': draw = self.canv.drawRightString x = colpos + colwidth - cellstyle.rightPadding else: raise ValueError, 'Invalid justification %s' % just
05bfe223624d1df66401c7f78a6ac81f78006d39 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/05bfe223624d1df66401c7f78a6ac81f78006d39/tables.py
'GRID', 'BOX', 'OUTLINE', 'INNERGRID', 'LINEBELOW', 'LINEABOVE', 'LINEBEFORE', 'LINEAFTER', )
'GRID', 'BOX', 'OUTLINE', 'INNERGRID', 'BOXGRID', 'LINEBELOW', 'LINEABOVE', 'LINEBEFORE', 'LINEAFTER', )
def _drawCell(self, cellval, cellstyle, (colpos, rowpos), (colwidth, rowheight)): #print "cellstyle is ", repr(cellstyle), id(cellstyle) if self._curcellstyle is not cellstyle: cur = self._curcellstyle if cur is None or cellstyle.color != cur.color: #print "setting cell color to %s" % `cellstyle.color` self.canv.setFillColor(cellstyle.color) if cur is None or cellstyle.leading != cur.leading or cellstyle.fontname != cur.fontname or cellstyle.fontsize != cur.fontsize: #print "setting font: %s, %s, %s" % (cellstyle.fontname, cellstyle.fontsize, cellstyle.leading) self.canv.setFont(cellstyle.fontname, cellstyle.fontsize, cellstyle.leading) self._curcellstyle = cellstyle #print "leading is ", cellstyle.leading, "size is", cellstyle.fontsize just = cellstyle.alignment #print "alignment is ", just if just == 'LEFT': draw = self.canv.drawString x = colpos + cellstyle.leftPadding elif just in ('CENTRE', 'CENTER'): draw = self.canv.drawCentredString x = colpos + colwidth * 0.5 elif just == 'RIGHT': draw = self.canv.drawRightString x = colpos + colwidth - cellstyle.rightPadding else: raise ValueError, 'Invalid justification %s' % just
05bfe223624d1df66401c7f78a6ac81f78006d39 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/05bfe223624d1df66401c7f78a6ac81f78006d39/tables.py
new.fontsize = values[1]
if n>1: new.fontsize = values[1] if n>2: new.leading = values[2] elif op in ('FONTNAME', 'FACE'): new.fontname = values[0] elif op in ('SIZE', 'FONTSIZE'): new.fontsize = values[0] elif op == 'LEADING': new.leading = values[0]
def _setCellStyle(cellStyles, i, j, op, values): new = CellStyle('<%d, %d>' % (i,j), cellStyles[i][j]) cellStyles[i][j] = new if op == 'FONT': new.fontname = values[0] new.fontsize = values[1] elif op == 'TEXTCOLOR': new.color = colors.toColor(values[0], colors.Color(0,0,0)) elif op in ('ALIGN', 'ALIGNMENT'): new.alignment = values[0] elif op == 'VALIGN': new.valign = values[0] elif op == 'LEFTPADDING': new.leftPadding = values[0] elif op == 'RIGHTPADDING': new.rightPadding = values[0] elif op == 'TOPPADDING': new.topPadding = values[0] elif op == 'BOTTOMPADDING': new.bottomPadding = values[0]
05bfe223624d1df66401c7f78a6ac81f78006d39 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/05bfe223624d1df66401c7f78a6ac81f78006d39/tables.py
data= [['X00y', 'X01y', 'X02y', 'X03y', 'X04y'],
XY = [['X00y', 'X01y', 'X02y', 'X03y', 'X04y'],
def test(): from reportlab.lib.units import inch rowheights = (24, 16, 16, 16, 16) rowheights2 = (24, 16, 16, 16, 30) colwidths = (50, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32) data = ( ('', 'Jan', 'Feb', 'Mar','Apr','May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'), ('Mugs', 0, 4, 17, 3, 21, 47, 12, 33, 2, -2, 44, 89), ('T-Shirts', 0, 42, 9, -3, 16, 4, 72, 89, 3, 19, 32, 119), ('Key Ring', 0,0,0,0,0,0,1,0,0,0,2,13), ('Hats', 893, 912, '1,212', 643, 789, 159, 888, '1,298', 832, 453, '1,344','2,843') ) data2 = ( ('', 'Jan', 'Feb', 'Mar','Apr','May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'), ('Mugs', 0, 4, 17, 3, 21, 47, 12, 33, 2, -2, 44, 89), ('T-Shirts', 0, 42, 9, -3, 16, 4, 72, 89, 3, 19, 32, 119), ('Key Ring', 0,0,0,0,0,0,1,0,0,0,2,13), ('Hats\nLarge', 893, 912, '1,212', 643, 789, 159, 888, '1,298', 832, 453, '1,344','2,843') ) styleSheet = getSampleStyleSheet() lst = [] lst.append(Paragraph("Tables", styleSheet['Heading1'])) lst.append(Paragraph(__doc__, styleSheet['BodyText'])) lst.append(Paragraph("The Tables (shown in different styles below) were created using the following code:", styleSheet['BodyText'])) lst.append(Preformatted(""" colwidths = (50, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32) rowheights = (24, 16, 16, 16, 16) data = ( ('', 'Jan', 'Feb', 'Mar','Apr','May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'), ('Mugs', 0, 4, 17, 3, 21, 47, 12, 33, 2, -2, 44, 89), ('T-Shirts', 0, 42, 9, -3, 16, 4, 72, 89, 3, 19, 32, 119), ('Key Ring', 0,0,0,0,0,0,1,0,0,0,2,13), ('Hats', 893, 912, '1,212', 643, 789, 159, 888, '1,298', 832, 453, '1,344','2,843') ) t = Table(data, colwidths, rowheights) """, styleSheet['Code'], dedent=4)) lst.append(Paragraph(""" You can then give the Table a TableStyle object to control its format. The first TableStyle used was created as follows: """, styleSheet['BodyText'])) lst.append(Preformatted("""
05bfe223624d1df66401c7f78a6ac81f78006d39 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/05bfe223624d1df66401c7f78a6ac81f78006d39/tables.py
t=Table(data, 5*[0.4*inch], 4*[0.4*inch])
t=Table(XY, 5*[0.6*inch], 4*[0.6*inch])
def test(): from reportlab.lib.units import inch rowheights = (24, 16, 16, 16, 16) rowheights2 = (24, 16, 16, 16, 30) colwidths = (50, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32) data = ( ('', 'Jan', 'Feb', 'Mar','Apr','May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'), ('Mugs', 0, 4, 17, 3, 21, 47, 12, 33, 2, -2, 44, 89), ('T-Shirts', 0, 42, 9, -3, 16, 4, 72, 89, 3, 19, 32, 119), ('Key Ring', 0,0,0,0,0,0,1,0,0,0,2,13), ('Hats', 893, 912, '1,212', 643, 789, 159, 888, '1,298', 832, 453, '1,344','2,843') ) data2 = ( ('', 'Jan', 'Feb', 'Mar','Apr','May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'), ('Mugs', 0, 4, 17, 3, 21, 47, 12, 33, 2, -2, 44, 89), ('T-Shirts', 0, 42, 9, -3, 16, 4, 72, 89, 3, 19, 32, 119), ('Key Ring', 0,0,0,0,0,0,1,0,0,0,2,13), ('Hats\nLarge', 893, 912, '1,212', 643, 789, 159, 888, '1,298', 832, 453, '1,344','2,843') ) styleSheet = getSampleStyleSheet() lst = [] lst.append(Paragraph("Tables", styleSheet['Heading1'])) lst.append(Paragraph(__doc__, styleSheet['BodyText'])) lst.append(Paragraph("The Tables (shown in different styles below) were created using the following code:", styleSheet['BodyText'])) lst.append(Preformatted(""" colwidths = (50, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32) rowheights = (24, 16, 16, 16, 16) data = ( ('', 'Jan', 'Feb', 'Mar','Apr','May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'), ('Mugs', 0, 4, 17, 3, 21, 47, 12, 33, 2, -2, 44, 89), ('T-Shirts', 0, 42, 9, -3, 16, 4, 72, 89, 3, 19, 32, 119), ('Key Ring', 0,0,0,0,0,0,1,0,0,0,2,13), ('Hats', 893, 912, '1,212', 643, 789, 159, 888, '1,298', 832, 453, '1,344','2,843') ) t = Table(data, colwidths, rowheights) """, styleSheet['Code'], dedent=4)) lst.append(Paragraph(""" You can then give the Table a TableStyle object to control its format. The first TableStyle used was created as follows: """, styleSheet['BodyText'])) lst.append(Preformatted("""
05bfe223624d1df66401c7f78a6ac81f78006d39 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/05bfe223624d1df66401c7f78a6ac81f78006d39/tables.py
exec l
exec l.strip()
def get_version(): #determine Version if __name__=='__main__': HERE=os.path.dirname(sys.argv[0]) else: HERE=os.path.dirname(__file__) #first try source FN = pjoin(HERE,'__init__') try: for l in open(pjoin(FN+'.py'),'r').readlines(): if l.startswith('Version'): exec l return Version except: pass #don't have source, try import import imp for desc in ('.pyc', 'rb', 2), ('.pyo', 'rb', 2): try: fn = FN+desc[0] f = open(fn,desc[1]) m = imp.load_module('reportlab',f,fn,desc) return m.Version except: pass raise ValueError('Cannot determine ReportLab Version')
a482c58cb8390df2edbbbf27c553ce7458a23016 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/a482c58cb8390df2edbbbf27c553ce7458a23016/setup.py
if path=='None': path = [] if (isinstance (path, str)): path = [path]
if path=='None': path = [] if type(path) not in SeqTypes: path = [path]
def start_stylesheet(self, args): #makes it the current style sheet. path = self._arg('stylesheet',args,'path') if path=='None': path = [] if (isinstance (path, str)): path = [path] path.append('styles') path.append(os.getcwd()) modulename = self._arg('stylesheet', args, 'module') funcname = self._arg('stylesheet', args, 'function') try: found = imp.find_module(modulename, path) (file, pathname, description) = found mod = imp.load_module(modulename, file, pathname, description) except ImportError: #last gasp mod = getModule(modulename)
fb695223da6edd6cfa5b2f5fbbf090bf46c38f49 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/fb695223da6edd6cfa5b2f5fbbf090bf46c38f49/stdparser.py
platypus.Image('file://'+gif.replace('\\','/'))])
platypus.Image(furl)])
def wrap(self, availWidth, availHeight): """This will be called by the enclosing frame before objects are asked their size, drawn or whatever. It returns the size actually used.""" return (self.width, self.height)
2268c5c7ad194035cb61402c9f8b7a32bc1035c8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/2268c5c7ad194035cb61402c9f8b7a32bc1035c8/test_platypus_general.py
if sys.platform=='win32': S = ['c:\\Program Files\\Adobe\\Acrobat 4.0\\Resource\\Font'] elif sys.platform in ('linux2','freebsd4',): S = ['/usr/lib/Acrobat4/Resource/Font'] elif sys.platform=='mac': diskName = string.split(os.getcwd(), ':')[0] fontDir = diskName + ':Applications:Python %s:reportlab:fonts' % sys_version S = [fontDir] globals()['PIL_warnings'] = 0 else: S=[] S.append(os.path.abspath(os.path.join(os.path.dirname(__file__),'lib','fontDir')))
import reportlab D = {'REPORTLAB_DIR': os.path.dirname(reportlab.__file__), 'disk': string.split(os.getcwd(), ':')[0], 'sys_version': sys_version, }
def _setOpt(name, value, conv=None): '''set a module level value from environ/default''' from os import environ ename = 'RL_'+name if environ.has_key(ename): value = environ[ename] if conv: value = conv(value) globals()[name] = value
4eab5ff078e87c4c118f06540f8181f05ce375c5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/4eab5ff078e87c4c118f06540f8181f05ce375c5/rl_config.py
for p in S: if os.path.isdir(p): P.append(p)
for p in T1SearchPath: d = apply(os.path.join,string.split(p % D,'/')) if os.path.isdir(d): P.append(d)
def _setOpt(name, value, conv=None): '''set a module level value from environ/default''' from os import environ ename = 'RL_'+name if environ.has_key(ename): value = environ[ename] if conv: value = conv(value) globals()[name] = value
4eab5ff078e87c4c118f06540f8181f05ce375c5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/4eab5ff078e87c4c118f06540f8181f05ce375c5/rl_config.py
if type(cap) is not type(int):
if not isinstance(cap,int):
def _addCommand(self,cmd): if cmd[0] in ('BACKGROUND','ROWBACKGROUNDS','COLBACKGROUNDS'): self._bkgrndcmds.append(cmd) elif cmd[0] == 'SPAN': self._spanCmds.append(cmd) elif _isLineCommand(cmd): # we expect op, start, stop, weight, colour, cap, dashes, join cmd = tuple(cmd) if len(cmd)<5: raise ValueError('bad line command '+str(cmd))
255ca0769f581869e21f0653db9d81fb66048941 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/255ca0769f581869e21f0653db9d81fb66048941/tables.py
ValueError('Bad cap value %s in %s'%(cap,str(cmd)))
raise ValueError('Bad cap value %s in %s'%(cap,str(cmd)))
def _addCommand(self,cmd): if cmd[0] in ('BACKGROUND','ROWBACKGROUNDS','COLBACKGROUNDS'): self._bkgrndcmds.append(cmd) elif cmd[0] == 'SPAN': self._spanCmds.append(cmd) elif _isLineCommand(cmd): # we expect op, start, stop, weight, colour, cap, dashes, join cmd = tuple(cmd) if len(cmd)<5: raise ValueError('bad line command '+str(cmd))
255ca0769f581869e21f0653db9d81fb66048941 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/255ca0769f581869e21f0653db9d81fb66048941/tables.py
if len(cmd)<7: cmd = cmd+(None,)
if len(cmd)<7: cmd += (None,)
def _addCommand(self,cmd): if cmd[0] in ('BACKGROUND','ROWBACKGROUNDS','COLBACKGROUNDS'): self._bkgrndcmds.append(cmd) elif cmd[0] == 'SPAN': self._spanCmds.append(cmd) elif _isLineCommand(cmd): # we expect op, start, stop, weight, colour, cap, dashes, join cmd = tuple(cmd) if len(cmd)<5: raise ValueError('bad line command '+str(cmd))
255ca0769f581869e21f0653db9d81fb66048941 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/255ca0769f581869e21f0653db9d81fb66048941/tables.py
if type(join) is not type(int):
if not isinstance(join,int):
def _addCommand(self,cmd): if cmd[0] in ('BACKGROUND','ROWBACKGROUNDS','COLBACKGROUNDS'): self._bkgrndcmds.append(cmd) elif cmd[0] == 'SPAN': self._spanCmds.append(cmd) elif _isLineCommand(cmd): # we expect op, start, stop, weight, colour, cap, dashes, join cmd = tuple(cmd) if len(cmd)<5: raise ValueError('bad line command '+str(cmd))
255ca0769f581869e21f0653db9d81fb66048941 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/255ca0769f581869e21f0653db9d81fb66048941/tables.py
cmd = cmd + (lineCount,)
cmd += (lineCount,)
def _addCommand(self,cmd): if cmd[0] in ('BACKGROUND','ROWBACKGROUNDS','COLBACKGROUNDS'): self._bkgrndcmds.append(cmd) elif cmd[0] == 'SPAN': self._spanCmds.append(cmd) elif _isLineCommand(cmd): # we expect op, start, stop, weight, colour, cap, dashes, join cmd = tuple(cmd) if len(cmd)<5: raise ValueError('bad line command '+str(cmd))
255ca0769f581869e21f0653db9d81fb66048941 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/255ca0769f581869e21f0653db9d81fb66048941/tables.py
if maxx>400 or maxyy>200: _,_,D = drawit(F,maxx,maxy)
if maxx>400 or maxy>200: _,_,D = drawit(F,maxx,maxy)
def drawit(F,w=400,h=200,fontSize=12,slack=2,gap=5): D = Drawing(w,h) th = 2*gap + fontSize*1.2 gh = gap + .2*fontSize y = h maxx = 0 for fontName in F: y -= th text = fontName+": I should be totally horizontal and enclosed in a box" textWidth = stringWidth(text, fontName, fontSize) maxx = max(maxx,textWidth+20) D.add( Group(Rect(8, y-gh, textWidth + 4, th, strokeColor=colors.red, strokeWidth=.5, fillColor=colors.lightgrey), String(10, y, text, fontName=fontName, fontSize = fontSize))) y -= 5 return maxx, h-y+gap, D
ffd6c439cc73c4d1b74b2cef92c3f17e52fa1fed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/ffd6c439cc73c4d1b74b2cef92c3f17e52fa1fed/renderPM.py
do_exec(cvs+(' rtag %s' % release), 'the tag phase')
def cvs_checkout(d): os.chdir(d) recursive_rmdir(cvsdir) cvs = find_exe('cvs') if cvs is None: print "Can't find cvs anywhere on the path" os.exit(1) if release: print release os.environ['CVSROOT']=':ext:%s@cvs1:/cvsroot/reportlab' % USER #do_exec(cvs+(' rtag %s' % release), 'the tag phase') do_exec(cvs+(' co -r %s reportlab'%release), 'the download phase') else: os.environ['CVSROOT']=':pserver:%s@cvs1:/cvsroot/reportlab' % USER do_exec(cvs+' co reportlab', 'the download phase')
94e1adbcb01afd92e6b1384bad8547579bd09de0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/94e1adbcb01afd92e6b1384bad8547579bd09de0/daily.py
self._x = x self._y = y self._x0 = x
self._x0 = self._x = x self._y0 = self._y = y
def setTextOrigin(self, x, y): if self._canvas.bottomup: self._code.append('1 0 0 1 %s Tm' % fp_str(x, y)) #bottom up else: self._code.append('1 0 0 -1 %s Tm' % fp_str(x, y)) #top down self._x = x self._y = y self._x0 = x #the margin
c8807bcce56d0da528e6e56ed9baa7e7f4382f44 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/c8807bcce56d0da528e6e56ed9baa7e7f4382f44/textobject.py
self._x = e self._y = f
self._x0 = self._x = e self._y0 = self._y = f
def setTextTransform(self, a, b, c, d, e, f): "Like setTextOrigin, but does rotation, scaling etc." if not self._canvas.bottomup: c = -c #reverse bottom row of the 2D Transform d = -d self._code.append('%s Tm' % fp_str(a, b, c, d, e, f)) #we only measure coords relative to present text matrix self._x = e self._y = f
c8807bcce56d0da528e6e56ed9baa7e7f4382f44 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/c8807bcce56d0da528e6e56ed9baa7e7f4382f44/textobject.py
"""Moves to a point dx, dy away from the start of the current line - NOT from the current point! So if you call it in mid-sentence, watch out."""
"""Starts a new line at an offset dx,dy from the start of the current line. This does not move the cursor relative to the current position, and it changes the current offset of every future line drawn (i.e. if you next do a textLine() call, it will move the cursor to a position one line lower than the position specificied in this call. """
def moveCursor(self, dx, dy): """Moves to a point dx, dy away from the start of the current line - NOT from the current point! So if you call it in mid-sentence, watch out.""" if self._code and self._code[-1][-3:]==' Td': L = string.split(self._code[-1]) if len(L)==3: del self._code[-1] else: self._code[-1] = string.join(L[:-4]) dx = dx + float(L[-3]) dy = dy - float(L[-2]) self._code.append('%s Td' % fp_str(dx, -dy))
c8807bcce56d0da528e6e56ed9baa7e7f4382f44 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/c8807bcce56d0da528e6e56ed9baa7e7f4382f44/textobject.py
dx = dx + float(L[-3]) dy = dy - float(L[-2])
lastDx = float(L[-3]) lastDy = float(L[-2]) dx += lastDx dy -= lastDy self._x0 -= lastDx self._y0 -= lastDy
def moveCursor(self, dx, dy): """Moves to a point dx, dy away from the start of the current line - NOT from the current point! So if you call it in mid-sentence, watch out.""" if self._code and self._code[-1][-3:]==' Td': L = string.split(self._code[-1]) if len(L)==3: del self._code[-1] else: self._code[-1] = string.join(L[:-4]) dx = dx + float(L[-3]) dy = dy - float(L[-2]) self._code.append('%s Td' % fp_str(dx, -dy))
c8807bcce56d0da528e6e56ed9baa7e7f4382f44 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/c8807bcce56d0da528e6e56ed9baa7e7f4382f44/textobject.py
"""Moves to a point dx away from the start of the
"""Starts a new line dx away from the start of the
def setXPos(self, dx): """Moves to a point dx away from the start of the current line - NOT from the current point! So if you call it in mid-sentence, watch out.""" self.moveCursor(dx,0)
c8807bcce56d0da528e6e56ed9baa7e7f4382f44 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/c8807bcce56d0da528e6e56ed9baa7e7f4382f44/textobject.py
self._code.append('%s T*' % self._formatText(line)) if self._canvas.bottomup: self._y = self._y - self._leading else: self._y = self._y + self._leading self._x = self._x0
self.textLine(line)
def textLines(self, stuff, trim=1): """prints multi-line or newlined strings, moving down. One comon use is to quote a multi-line block in your Python code; since this may be indented, by default it trims whitespace off each line and from the beginning; set trim=0 to preserve whitespace.""" if type(stuff) == StringType: lines = string.split(string.strip(stuff), '\n') if trim==1: lines = map(string.strip,lines) elif type(stuff) == ListType: lines = stuff elif type(stuff) == TupleType: lines = stuff else: assert 1==0, "argument to textlines must be string,, list or tuple"
c8807bcce56d0da528e6e56ed9baa7e7f4382f44 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/c8807bcce56d0da528e6e56ed9baa7e7f4382f44/textobject.py
if sys.platform in ('linux2',) and ext='.pfb': ext = ''
if sys.platform in ('linux2',) and ext=='.pfb': ext = ''
def findT1File(fontName,ext='.pfb'): from reportlab.rl_config import T1SearchPath assert T1SearchPath!=[], "No Type-1 font search path" if sys.platform in ('linux2',) and ext='.pfb': ext = '' n = _findFNR(fontName)+ext for d in T1SearchPath: f = os.path.join(d,n) if os.path.isfile(f): return f return None
86c144f547aa52f5fce5ffe512be07f17692600b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/86c144f547aa52f5fce5ffe512be07f17692600b/_fontdata.py
direction = AttrMapValue( OneOf('clockwise', 'anticlockwise'), desc="'clockwise' or 'anticlockwise'"),
direction = AttrMapValue(OneOf('clockwise', 'anticlockwise'), desc="'clockwise' or 'anticlockwise'"),
def __init__(self): self.strokeWidth = 0 self.fillColor = None self.strokeColor = STATE_DEFAULTS["strokeColor"] self.strokeDashArray = STATE_DEFAULTS["strokeDashArray"] self.popout = 0 self.fontName = STATE_DEFAULTS["fontName"] self.fontSize = STATE_DEFAULTS["fontSize"] self.fontColor = STATE_DEFAULTS["fillColor"] self.labelRadius = 1.2
b438bde47b2309e20663aa3f63d5d6100ed6cbed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/b438bde47b2309e20663aa3f63d5d6100ed6cbed/doughnut.py
theSector = Wedge(cx, cy, xradius, a1, a2, yradius=yradius, iradius=iradius)
theSector = Wedge(cx, cy, xradius, a1, a2, yradius=yradius, radius1=iradius)
def makeSectors(self): # normalize slice data if type(self.data) in (ListType, TupleType) and type(self.data[0]) in (ListType, TupleType): #it's a nested list, more than one sequence normData = [] for l in self.data: t = self.normalizeData(l) normData.append(t) else: normData = self.normalizeData(self.data) n = len(normData)
b438bde47b2309e20663aa3f63d5d6100ed6cbed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/b438bde47b2309e20663aa3f63d5d6100ed6cbed/doughnut.py
if I and inname not in I: continue
if I and zipname not in I: continue
def buildup_test(cls=test_pyRXPU,I=[]): ''' Add test methods to the TestCase ''' cls.valid = [] cls.invalid = [] cls.notwf = [] testdir = os.path.dirname(__file__) try: zipf = zipfile.ZipFile(os.path.join(testdir,'xmltest.zip')) except: print >> sys.stderr, "Can't locate file xmltest.zip\nPerhaps it should be downloaded from\nhttp://www.reportlab.com/ftp/xmltest.zip\nor\nftp://ftp.jclark.com/pub/xml/xmltest.zip\n" raise for zipname in zipf.namelist(): # Extract the files if they don't alrady exist osname = os.path.join(*zipname.split('/')) # For non-unixes osname = os.path.join(testdir,osname) dir = os.path.dirname(osname) if not os.path.isdir(dir): os.makedirs(dir) if not os.path.isfile(osname): f = open(osname,'wb') f.write(zipf.read(zipname)) f.close() if I and inname not in I: continue # Add input files to our lists if os.path.splitext(osname)[1] == '.xml' and zipname.find('out') == -1: if zipname.find('invalid') != -1: cls.invalid.append(osname) elif zipname.find('not-wf') != -1: cls.notwf.append(osname) elif zipname.find('valid') != -1: outname = os.path.join(dir,'out',os.path.basename(osname)) cls.valid.append( (osname,outname) ) # Add 'valid' tests for inname,outname in cls.valid: num = int(os.path.splitext(os.path.basename(inname))[0]) dir = os.path.split(os.path.split(inname)[0])[1] mname = 'test_Valid_%s_%03d' % (dir,num) def doTest(self,inname=inname,outname=outname): self._test_valid(inname,outname) setattr(cls,mname,doTest) # Add 'invalid' tests for inname in cls.invalid: num = int(os.path.splitext(os.path.basename(inname))[0]) mname = 'test_InvalidParse_%03d' % (num) def doTest(self,inname=inname): self._test_invalid_parse(inname) setattr(cls,mname,doTest) mname = 'test_InvalidValidate_%03d' % (num) def doTest(self,inname=inname): self._test_invalid_validate(inname) setattr(cls,mname,doTest) # Add 'not wellformed' tests for inname in cls.notwf: num = int(os.path.splitext(os.path.basename(inname))[0]) dir = os.path.split(os.path.split(inname)[0])[1] mname = 'test_NotWellFormed_%s_%03d' % (dir,num) def doTest(self,inname=inname): self._test_notwf(inname) setattr(cls,mname,doTest)
0ce3ff81e6425eca835acd954b2c33a56a879644 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/0ce3ff81e6425eca835acd954b2c33a56a879644/test_xmltestsuite.py
if type(f)==type(''):
if type(filename)==type(''):
def SaveToFile(self, filename,canvas): """Open a file, and ask each object in turn to write itself to the file. Keep track of the file position at each point for use in the index at the end"""
82bb606c4e39f4d24dcf58f52ac19fcdcdbe9df2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/82bb606c4e39f4d24dcf58f52ac19fcdcdbe9df2/pdfdoc.py
f = filename
f = filename
def SaveToFile(self, filename,canvas): """Open a file, and ask each object in turn to write itself to the file. Keep track of the file position at each point for use in the index at the end"""
82bb606c4e39f4d24dcf58f52ac19fcdcdbe9df2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/82bb606c4e39f4d24dcf58f52ac19fcdcdbe9df2/pdfdoc.py
def Reference(self, object, name=None): ### note references may "grow" during the final formatting pass: don't use d.keys()! # don't make references to other references, or non instances from types import InstanceType #print"object type is ", type(object) tob = type(object) if (tob is not InstanceType) or (tob is InstanceType and object.__class__ is PDFObjectReference): return object idToObject = self.idToObject if hasattr(object, __InternalName__): # already registered intname = object.__InternalName__ if name is not None and name!=intname: raise ValueError, "attempt to reregister object %s with new name %s" % ( repr(intname), repr(name)) if not idToObject.has_key(intname): raise ValueError, "object named but not registered" return PDFObjectReference(intname) # otherwise register the new object objectcounter = self.objectcounter = self.objectcounter+1 if name is None: name = "R"+repr(objectcounter) if idToObject.has_key(name): raise ValueError, "redefining named object: "+repr(name) object.__InternalName__ = name #print "name", name, "counter", objectcounter self.idToObjectNumberAndVersion[name] = (objectcounter, 0) self.numberToId[objectcounter] = name idToObject[name] = object return PDFObjectReference(name)
569507e0d40372288ba9538f94ddbda68231d460 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/569507e0d40372288ba9538f94ddbda68231d460/pdfdoc.py
if (tob is not InstanceType) or (tob is InstanceType and object.__class__ is PDFObjectReference):
idToObject = self.idToObject if name is None and ( (tob is not InstanceType) or (tob is InstanceType and object.__class__ is PDFObjectReference)):
def Reference(self, object, name=None): ### note references may "grow" during the final formatting pass: don't use d.keys()! # don't make references to other references, or non instances from types import InstanceType #print"object type is ", type(object) tob = type(object) if (tob is not InstanceType) or (tob is InstanceType and object.__class__ is PDFObjectReference): return object idToObject = self.idToObject if hasattr(object, __InternalName__): # already registered intname = object.__InternalName__ if name is not None and name!=intname: raise ValueError, "attempt to reregister object %s with new name %s" % ( repr(intname), repr(name)) if not idToObject.has_key(intname): raise ValueError, "object named but not registered" return PDFObjectReference(intname) # otherwise register the new object objectcounter = self.objectcounter = self.objectcounter+1 if name is None: name = "R"+repr(objectcounter) if idToObject.has_key(name): raise ValueError, "redefining named object: "+repr(name) object.__InternalName__ = name #print "name", name, "counter", objectcounter self.idToObjectNumberAndVersion[name] = (objectcounter, 0) self.numberToId[objectcounter] = name idToObject[name] = object return PDFObjectReference(name)
569507e0d40372288ba9538f94ddbda68231d460 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/569507e0d40372288ba9538f94ddbda68231d460/pdfdoc.py
idToObject = self.idToObject
def Reference(self, object, name=None): ### note references may "grow" during the final formatting pass: don't use d.keys()! # don't make references to other references, or non instances from types import InstanceType #print"object type is ", type(object) tob = type(object) if (tob is not InstanceType) or (tob is InstanceType and object.__class__ is PDFObjectReference): return object idToObject = self.idToObject if hasattr(object, __InternalName__): # already registered intname = object.__InternalName__ if name is not None and name!=intname: raise ValueError, "attempt to reregister object %s with new name %s" % ( repr(intname), repr(name)) if not idToObject.has_key(intname): raise ValueError, "object named but not registered" return PDFObjectReference(intname) # otherwise register the new object objectcounter = self.objectcounter = self.objectcounter+1 if name is None: name = "R"+repr(objectcounter) if idToObject.has_key(name): raise ValueError, "redefining named object: "+repr(name) object.__InternalName__ = name #print "name", name, "counter", objectcounter self.idToObjectNumberAndVersion[name] = (objectcounter, 0) self.numberToId[objectcounter] = name idToObject[name] = object return PDFObjectReference(name)
569507e0d40372288ba9538f94ddbda68231d460 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/569507e0d40372288ba9538f94ddbda68231d460/pdfdoc.py
raise ValueError, "redefining named object: "+repr(name) object.__InternalName__ = name
other = idToObject[name] if other!=object: raise ValueError, "redefining named object: "+repr(name) return PDFObjectReference(name) if tob is InstanceType: object.__InternalName__ = name
def Reference(self, object, name=None): ### note references may "grow" during the final formatting pass: don't use d.keys()! # don't make references to other references, or non instances from types import InstanceType #print"object type is ", type(object) tob = type(object) if (tob is not InstanceType) or (tob is InstanceType and object.__class__ is PDFObjectReference): return object idToObject = self.idToObject if hasattr(object, __InternalName__): # already registered intname = object.__InternalName__ if name is not None and name!=intname: raise ValueError, "attempt to reregister object %s with new name %s" % ( repr(intname), repr(name)) if not idToObject.has_key(intname): raise ValueError, "object named but not registered" return PDFObjectReference(intname) # otherwise register the new object objectcounter = self.objectcounter = self.objectcounter+1 if name is None: name = "R"+repr(objectcounter) if idToObject.has_key(name): raise ValueError, "redefining named object: "+repr(name) object.__InternalName__ = name #print "name", name, "counter", objectcounter self.idToObjectNumberAndVersion[name] = (objectcounter, 0) self.numberToId[objectcounter] = name idToObject[name] = object return PDFObjectReference(name)
569507e0d40372288ba9538f94ddbda68231d460 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/569507e0d40372288ba9538f94ddbda68231d460/pdfdoc.py
self._cellvalues = data
def __init__(self, data, colWidths=None, rowHeights=None, style=None, repeatRows=0, repeatCols=0, splitByRow=1, emptyTableAction=None): #print "colWidths", colWidths self.hAlign = 'CENTER' self.vAlign = 'MIDDLE' if type(data) not in _SeqTypes: raise ValueError, "%s invalid data type" % self.identity() self._nrows = nrows = len(data) if nrows: self._ncols = ncols = max(map(_rowLen,data)) elif colWidths: ncols = len(colWidths) else: ncols = 0 if not emptyTableAction: emptyTableAction = rl_config.emptyTableAction if not (nrows and ncols): if emptyTableAction=='error': raise ValueError, "%s must have at least a row and column" % self.identity() elif emptyTableAction=='indicate': self.__class__ = Preformatted global _emptyTableStyle if '_emptyTableStyle' not in globals().keys(): _emptyTableStyle = ParagraphStyle('_emptyTableStyle') _emptyTableStyle.textColor = colors.red _emptyTableStyle.backColor = colors.yellow Preformatted.__init__(self,'Table(%d,%d)' % (nrows,ncols), _emptyTableStyle) elif emptyTableAction=='ignore': self.__class__ = Spacer Spacer.__init__(self,0,0) else: raise ValueError, '%s bad emptyTableAction: "%s"' % (self.identity(),emptyTableAction) return
8ed66da0ceaadd59ed327da835a49ed4dcb03b9d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/8ed66da0ceaadd59ed327da835a49ed4dcb03b9d/tables.py
nr = self._nrows if not hasattr(self,'_ncols'): nc = 'unknown' else: nc = self._ncols cv = self._cellvalues
nr = getattr(self,'_nrows','unknown') nc = getattr(self,'_ncols','unknown') cv = self._cellvalues if cv and 'unknown' not in (nr,nc):
def identity(self, maxLen=30): '''Identify our selves as well as possible''' vx = None nr = self._nrows if not hasattr(self,'_ncols'): nc = 'unknown' else: nc = self._ncols cv = self._cellvalues b = 0 for i in xrange(nr): for j in xrange(nc): v = cv[i][j] t = type(v) if t in _SeqTypes or isinstance(v,Flowable): if not t in _SeqTypes: v = (v,) r = '' for vij in v: r = vij.identity(maxLen) if r and r[-4:]!='>...': break if r and r[-4:]!='>...': ix, jx, vx, b = i, j, r, 1 else: v = v is None and '' or str(v) ix, jx, vx = i, j, v b = (vx and t is StringType) and 1 or 0 if maxLen: vx = vx[:maxLen] if b: break if b: break if vx: vx = ' with cell(%d,%d) containing\n%s' % (ix,jx,repr(vx)) else: vx = '...'
8ed66da0ceaadd59ed327da835a49ed4dcb03b9d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/8ed66da0ceaadd59ed327da835a49ed4dcb03b9d/tables.py
like the default verifiction strategy, or the way
like the default verification strategy, or the way
def checkMood(moodName): return (moodName in ('happy','sad','ok'))
480ddc7ee60644c7eb01e84635ac95a989b25e42 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/480ddc7ee60644c7eb01e84635ac95a989b25e42/ch2_graphics.py
existence depends on other propereties' values :-)""")
existence depends on other properties' values :-)""")
def checkMood(moodName): return (moodName in ('happy','sad','ok'))
480ddc7ee60644c7eb01e84635ac95a989b25e42 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/480ddc7ee60644c7eb01e84635ac95a989b25e42/ch2_graphics.py
people will experimate with push-down, pull-down and pattern-matching
people will experiment with push-down, pull-down and pattern-matching
def checkMood(moodName): return (moodName in ('happy','sad','ok'))
480ddc7ee60644c7eb01e84635ac95a989b25e42 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/480ddc7ee60644c7eb01e84635ac95a989b25e42/ch2_graphics.py
This chapter presents a treament of the ideas behind our charting
This chapter presents a treatment of the ideas behind our charting
def checkMood(moodName): return (moodName in ('happy','sad','ok'))
480ddc7ee60644c7eb01e84635ac95a989b25e42 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/480ddc7ee60644c7eb01e84635ac95a989b25e42/ch2_graphics.py
revious section; these are all optional and are there to let the end user configire the appearance. Things which must be set for a chart to
previous section; these are all optional and are there to let the end user configure the appearance. Things which must be set for a chart to
def checkMood(moodName): return (moodName in ('happy','sad','ok'))
480ddc7ee60644c7eb01e84635ac95a989b25e42 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/480ddc7ee60644c7eb01e84635ac95a989b25e42/ch2_graphics.py
its positon relative to this origin and all of its formatting.""")
its position relative to this origin and all of its formatting.""")
def checkMood(moodName): return (moodName in ('happy','sad','ok'))
480ddc7ee60644c7eb01e84635ac95a989b25e42 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/480ddc7ee60644c7eb01e84635ac95a989b25e42/ch2_graphics.py
def checkMood(moodName): return (moodName in ('happy','sad','ok'))
480ddc7ee60644c7eb01e84635ac95a989b25e42 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/480ddc7ee60644c7eb01e84635ac95a989b25e42/ch2_graphics.py
rectangle' because it makes it vey easy to lay out multiple charts
rectangle' because it makes it very easy to lay out multiple charts
def checkMood(moodName): return (moodName in ('happy','sad','ok'))
480ddc7ee60644c7eb01e84635ac95a989b25e42 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/480ddc7ee60644c7eb01e84635ac95a989b25e42/ch2_graphics.py
they are relative quantities and indicate the proprotional
they are relative quantities and indicate the proportional
def checkMood(moodName): return (moodName in ('happy','sad','ok'))
480ddc7ee60644c7eb01e84635ac95a989b25e42 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/480ddc7ee60644c7eb01e84635ac95a989b25e42/ch2_graphics.py
def checkMood(moodName): return (moodName in ('happy','sad','ok'))
480ddc7ee60644c7eb01e84635ac95a989b25e42 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/480ddc7ee60644c7eb01e84635ac95a989b25e42/ch2_graphics.py
def checkMood(moodName): return (moodName in ('happy','sad','ok'))
480ddc7ee60644c7eb01e84635ac95a989b25e42 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/480ddc7ee60644c7eb01e84635ac95a989b25e42/ch2_graphics.py
def func(x): W, H = _listWrapOn(self._content,x*availWidth,self.canv) W /= x H /= x return W, H
df62114a66aabb69f0c57c86b5869b68d72705c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/df62114a66aabb69f0c57c86b5869b68d72705c2/flowables.py
if H<=maxHeight: self.width = W self.height = H
if H<=maxHeight+_FUZZ: self.width = W-_FUZZ self.height = H-_FUZZ
def func(x): W, H = _listWrapOn(self._content,x*availWidth,self.canv) W /= x H /= x return W, H
df62114a66aabb69f0c57c86b5869b68d72705c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/df62114a66aabb69f0c57c86b5869b68d72705c2/flowables.py
self.width = W self.height = H
self.width = W-_FUZZ self.height = H-_FUZZ
def func(x): W, H = _listWrapOn(self._content,x*availWidth,self.canv) W /= x H /= x return W, H
df62114a66aabb69f0c57c86b5869b68d72705c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/df62114a66aabb69f0c57c86b5869b68d72705c2/flowables.py
if H<min(0.95*maxHeight,maxHeight-10):
if H<min(0.95*maxHeight,maxHeight-10) or H>=maxHeight+_FUZZ:
def func(x): W, H = _listWrapOn(self._content,x*availWidth,self.canv) W /= x H /= x return W, H
df62114a66aabb69f0c57c86b5869b68d72705c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/df62114a66aabb69f0c57c86b5869b68d72705c2/flowables.py
if H<=maxHeight-_FUZZ: self.width = W self.height = H
if H<=maxHeight+_FUZZ and W<=maxWidth+_FUZZ: self.width = W-_FUZZ self.height = H-_FUZZ
def func(x): W, H = _listWrapOn(self._content,x*availWidth,self.canv) W /= x H /= x return W, H
df62114a66aabb69f0c57c86b5869b68d72705c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/df62114a66aabb69f0c57c86b5869b68d72705c2/flowables.py
for x in xrange(self.x + self.delta0, self.x + self.width, self.delta): line = Line(x, self.y, x, self.y + self.height)
for x in frange(self.x + self.delta0, self.x + w, self.delta): line = Line(x, self.y, x, self.y + h)
def makeInnerLines(self): # inner grid lines group = Group() if self.useLines == 1: if self.orientation == 'vertical': for x in xrange(self.x + self.delta0, self.x + self.width, self.delta): line = Line(x, self.y, x, self.y + self.height) line.strokeColor = self.strokeColor line.strokeWidth = self.strokeWidth group.add(line) elif self.orientation == 'horizontal': for y in xrange(self.y + self.delta0, self.y + self.height, self.delta): line = Line(self.x, y, self.x + self.width, y) line.strokeColor = self.strokeColor line.strokeWidth = self.strokeWidth group.add(line)
2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab/grids.py
elif self.orientation == 'horizontal': for y in xrange(self.y + self.delta0, self.y + self.height, self.delta): line = Line(self.x, y, self.x + self.width, y)
if self.delta0 != 0: line = Line(self.x, self.y, self.x, self.y + h)
def makeInnerLines(self): # inner grid lines group = Group() if self.useLines == 1: if self.orientation == 'vertical': for x in xrange(self.x + self.delta0, self.x + self.width, self.delta): line = Line(x, self.y, x, self.y + self.height) line.strokeColor = self.strokeColor line.strokeWidth = self.strokeWidth group.add(line) elif self.orientation == 'horizontal': for y in xrange(self.y + self.delta0, self.y + self.height, self.delta): line = Line(self.x, y, self.x + self.width, y) line.strokeColor = self.strokeColor line.strokeWidth = self.strokeWidth group.add(line)
2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab/grids.py
r = range(self.x + self.delta0, self.x + self.width, self.delta) for j in xrange(len(r)):
r = frange(self.x + self.delta0, self.x + w, self.delta) for j in frange(len(r)):
def makeInnerTiles(self): # inner grid lines group = Group()
2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab/grids.py
stripe = Rect(x, self.y, r[j+1]-x, self.height)
stripe = Rect(x, self.y, r[j+1]-x, h)
def makeInnerTiles(self): # inner grid lines group = Group()
2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab/grids.py
stripe = Rect(x, self.y, self.delta, self.height)
stripe = Rect(x, self.y, self.delta, h)
def makeInnerTiles(self): # inner grid lines group = Group()
2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab/grids.py
lmStripe = Rect(self.x, self.y, self.delta0, self.height)
lmStripe = Rect(self.x, self.y, self.delta0, h)
def makeInnerTiles(self): # inner grid lines group = Group()
2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab/grids.py
rmStripe = Rect(self.x + self.width - self.delta0, self.y, self.delta0, self.height)
rmStripe = Rect(self.x + w - self.delta0, self.y, self.delta0, h)
def makeInnerTiles(self): # inner grid lines group = Group()
2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab/grids.py
r = range(self.y + self.delta0, self.y + self.height, self.delta) for j in xrange(len(r)):
r = frange(self.y + self.delta0, self.y + h, self.delta) for j in frange(len(r)):
def makeInnerTiles(self): # inner grid lines group = Group()
2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab/grids.py
stripe = Rect(self.x, y, self.width, r[j+1]-y)
stripe = Rect(self.x, y, w, r[j+1]-y)
def makeInnerTiles(self): # inner grid lines group = Group()
2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab/grids.py
stripe = Rect(self.x, y, self.width, self.delta)
stripe = Rect(self.x, y, w, self.delta)
def makeInnerTiles(self): # inner grid lines group = Group()
2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab/grids.py
lmStripe = Rect(self.x, self.y, self.width, self.delta0)
lmStripe = Rect(self.x, self.y, w, self.delta0)
def makeInnerTiles(self): # inner grid lines group = Group()
2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab/grids.py
umStripe = Rect(self.x, self.y + self.width - self.delta0, self.width, self.delta0)
umStripe = Rect(self.x, self.y + w - self.delta0, w, self.delta0)
def makeInnerTiles(self): # inner grid lines group = Group()
2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab/grids.py
self.numShades = 20.0
self.numShades = 20
def __init__(self): self.x = 0 self.y = 0 self.width = 100 self.height = 100 self.orientation = 'vertical' self.numShades = 20.0 self.fillColorStart = colors.pink self.fillColorEnd = colors.black self.strokeColor = colors.black self.strokeWidth = 2
2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab/grids.py
rect = Rect(self.x, self.y, self.width, self.height)
w, h = self.width, self.height rect = Rect(self.x, self.y, w, h)
def draw(self): # general widget bits group = Group() rect = Rect(self.x, self.y, self.width, self.height) rect.strokeColor = self.strokeColor rect.strokeWidth = self.strokeWidth rect.fillColor = None group.add(rect)
2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab/grids.py
num = self.numShades
num = float(self.numShades)
def draw(self): # general widget bits group = Group() rect = Rect(self.x, self.y, self.width, self.height) rect.strokeColor = self.strokeColor rect.strokeWidth = self.strokeWidth rect.fillColor = None group.add(rect)
2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab/grids.py
for x in xrange(self.x, self.x + self.width, self.width/num): line = Rect(x, self.y, self.width/num, self.height)
if num == 1: xVals = [self.x] else: xVals = frange(self.x, self.x + w, w/num) for x in xVals: stripe = Rect(x, self.y, w/num, h)
def draw(self): # general widget bits group = Group() rect = Rect(self.x, self.y, self.width, self.height) rect.strokeColor = self.strokeColor rect.strokeWidth = self.strokeWidth rect.fillColor = None group.add(rect)
2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab/grids.py
line.fillColor = col line.strokeColor = None line.strokeWidth = 0 group.add(line) r = r + (c1.red - c0.red)/num g = g + (c1.green - c0.green)/num b = b + (c1.blue - c0.blue)/num
stripe.fillColor = col stripe.strokeColor = None stripe.strokeWidth = 0 group.add(stripe) if num > 1: r = r + (c1.red - c0.red) / (num-1) g = g + (c1.green - c0.green) / (num-1) b = b + (c1.blue - c0.blue) / (num-1)
def draw(self): # general widget bits group = Group() rect = Rect(self.x, self.y, self.width, self.height) rect.strokeColor = self.strokeColor rect.strokeWidth = self.strokeWidth rect.fillColor = None group.add(rect)
2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab/grids.py
for y in xrange(self.y, self.y + self.height, self.height/num): line = Rect(self.x, y, self.width, self.height/num)
if num == 1: yVals = [self.y] else: yVals = frange(self.y, self.y + h, h/num) for y in yVals: stripe = Rect(self.x, y, w, h/num)
def draw(self): # general widget bits group = Group() rect = Rect(self.x, self.y, self.width, self.height) rect.strokeColor = self.strokeColor rect.strokeWidth = self.strokeWidth rect.fillColor = None group.add(rect)
2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab/grids.py
line.fillColor = col line.strokeColor = None line.strokeWidth = 0 group.add(line) r = r + (c1.red - c0.red)/num g = g + (c1.green - c0.green)/num b = b + (c1.blue - c0.blue)/num
stripe.fillColor = col stripe.strokeColor = None stripe.strokeWidth = 0 group.add(stripe) if num > 1: r = r + (c1.red - c0.red) / (num-1) g = g + (c1.green - c0.green) / (num-1) b = b + (c1.blue - c0.blue) / (num-1)
def draw(self): # general widget bits group = Group() rect = Rect(self.x, self.y, self.width, self.height) rect.strokeColor = self.strokeColor rect.strokeWidth = self.strokeWidth rect.fillColor = None group.add(rect)
2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab/grids.py
g = Grid0() g.x = 20 g.y = 530 g.demo() D.add(g) g = Grid0() g.x = 140 g.y = 530 g.delta0 = 10 g.demo() D.add(g) g = Grid0() g.x = 260 g.y = 530 g.orientation = 'horizontal' g.demo() D.add(g) sr = ShadedRect0() sr.x = 20 sr.y = 390 sr.fillColorStart = colors.Color(0, 0, 0) sr.fillColorEnd = colors.Color(1, 1, 1) sr.demo() D.add(sr) sr = ShadedRect0() sr.x = 140 sr.y = 390 sr.fillColorStart = colors.Color(1, 1, 1) sr.fillColorEnd = colors.Color(0, 0, 0) sr.demo() D.add(sr) sr = ShadedRect0() sr.x = 20 sr.y = 250 sr.numShades = 10 sr.fillColorStart = colors.red sr.fillColorEnd = colors.blue sr.orientation = 'horizontal' sr.demo() D.add(sr) sr = ShadedRect0() sr.x = 140 sr.y = 250 sr.numShades = 20 sr.fillColorStart = colors.red sr.fillColorEnd = colors.blue sr.orientation = 'horizontal' sr.demo() D.add(sr) sr = ShadedRect0() sr.x = 260 sr.y = 250 sr.numShades = 50 sr.fillColorStart = colors.red sr.fillColorEnd = colors.blue sr.orientation = 'horizontal' sr.demo() D.add(sr) g = Grid0() g.x = 20 g.y = 110 g.useLines = 1 g.demo() D.add(g) g = Grid0() g.x = 140 g.y = 110 g.delta0 = 10 g.useLines = 1 g.useRects = 0 g.demo() D.add(g) g = Grid0() g.x = 260 g.y = 110 g.orientation = 'horizontal' g.useLines = 1 g.demo() D.add(g)
for row in range(5): y = 530 - row*120 if row == 0: for col in range(3): x = 20 + col*120 g = Grid0() g.x = x g.y = y g.useRects = 0 g.useLines = 1 if col == 0: pass elif col == 1: g.delta0 = 10 elif col == 2: g.orientation = 'horizontal' g.demo() D.add(g) elif row == 1: for col in range(3): x = 20 + col*120 g = Grid0() g.y = y g.x = x if col == 0: pass elif col == 1: g.delta0 = 10 elif col == 2: g.orientation = 'horizontal' g.demo() D.add(g) elif row == 2: for col in range(3): x = 20 + col*120 g = Grid0() g.x = x g.y = y g.useLines = 1 g.useRects = 1 if col == 0: pass elif col == 1: g.delta0 = 10 elif col == 2: g.orientation = 'horizontal' g.demo() D.add(g) elif row == 3: for col in range(3): x = 20 + col*120 sr = ShadedRect0() sr.x = x sr.y = y sr.fillColorStart = colors.Color(0, 0, 0) sr.fillColorEnd = colors.Color(1, 1, 1) if col == 0: sr.numShades = 5 elif col == 1: sr.numShades = 2 elif col == 2: sr.numShades = 1 sr.demo() D.add(sr) elif row == 4: for col in range(3): x = 20 + col*120 sr = ShadedRect0() sr.x = x sr.y = y sr.fillColorStart = colors.red sr.fillColorEnd = colors.blue sr.orientation = 'horizontal' if col == 0: sr.numShades = 10 elif col == 1: sr.numShades = 20 elif col == 2: sr.numShades = 50 sr.demo() D.add(sr)
def test(): D = Drawing(450,650) g = Grid0() g.x = 20 g.y = 530 g.demo() D.add(g) g = Grid0() g.x = 140 g.y = 530 g.delta0 = 10 g.demo() D.add(g) g = Grid0() g.x = 260 g.y = 530 g.orientation = 'horizontal' g.demo() D.add(g) sr = ShadedRect0() sr.x = 20 sr.y = 390 sr.fillColorStart = colors.Color(0, 0, 0) sr.fillColorEnd = colors.Color(1, 1, 1) sr.demo() D.add(sr) sr = ShadedRect0() sr.x = 140 sr.y = 390 sr.fillColorStart = colors.Color(1, 1, 1) sr.fillColorEnd = colors.Color(0, 0, 0) sr.demo() D.add(sr) sr = ShadedRect0() sr.x = 20 sr.y = 250 sr.numShades = 10 sr.fillColorStart = colors.red sr.fillColorEnd = colors.blue sr.orientation = 'horizontal' sr.demo() D.add(sr) sr = ShadedRect0() sr.x = 140 sr.y = 250 sr.numShades = 20 sr.fillColorStart = colors.red sr.fillColorEnd = colors.blue sr.orientation = 'horizontal' sr.demo() D.add(sr) sr = ShadedRect0() sr.x = 260 sr.y = 250 sr.numShades = 50 sr.fillColorStart = colors.red sr.fillColorEnd = colors.blue sr.orientation = 'horizontal' sr.demo() D.add(sr) g = Grid0() g.x = 20 g.y = 110 g.useLines = 1 g.demo() D.add(g) g = Grid0() g.x = 140 g.y = 110 g.delta0 = 10 g.useLines = 1 g.useRects = 0 g.demo() D.add(g) g = Grid0() g.x = 260 g.y = 110 g.orientation = 'horizontal' g.useLines = 1 g.demo() D.add(g) renderPDF.drawToFile(D, 'grids.pdf', 'grids.py') print 'wrote file: grids.pdf'
2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/2a3e6fc48d80b9c6c5c11a9c8c3f597a854a27ab/grids.py
self._rowHeghts = H
self._rowHeights = H
def _calc(self): H = self._rowHeights W = self._colWidths
2f6641518b448ba2f15dcaa4d1369f726c8704b8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/2f6641518b448ba2f15dcaa4d1369f726c8704b8/tables.py
('BOX', (0,0), (-1,-1), 0.25, colors.black),
('BOX', (0,0), (-1,-1), 0.25, colors.black),
def test(): from reportlab.lib.units import inch rowheights = (24, 16, 16, 16, 16) rowheights2 = (24, 16, 16, 16, 30) colwidths = (50, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32) data = ( ('', 'Jan', 'Feb', 'Mar','Apr','May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'), ('Mugs', 0, 4, 17, 3, 21, 47, 12, 33, 2, -2, 44, 89), ('T-Shirts', 0, 42, 9, -3, 16, 4, 72, 89, 3, 19, 32, 119), ('Key Ring', 0,0,0,0,0,0,1,0,0,0,2,13), ('Hats', 893, 912, '1,212', 643, 789, 159, 888, '1,298', 832, 453, '1,344','2,843') ) data2 = ( ('', 'Jan', 'Feb', 'Mar','Apr','May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'), ('Mugs', 0, 4, 17, 3, 21, 47, 12, 33, 2, -2, 44, 89), ('T-Shirts', 0, 42, 9, -3, 16, 4, 72, 89, 3, 19, 32, 119), ('Key Ring', 0,0,0,0,0,0,1,0,0,0,2,13), ('Hats\nLarge', 893, 912, '1,212', 643, 789, 159, 888, '1,298', 832, 453, '1,344','2,843') ) styleSheet = getSampleStyleSheet() lst = [] lst.append(Paragraph("Tables", styleSheet['Heading1'])) lst.append(Paragraph(__doc__, styleSheet['BodyText'])) lst.append(Paragraph("The Tables (shown in different styles below) were created using the following code:", styleSheet['BodyText'])) lst.append(Preformatted(""" colwidths = (50, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32) rowheights = (24, 16, 16, 16, 16) data = ( ('', 'Jan', 'Feb', 'Mar','Apr','May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'), ('Mugs', 0, 4, 17, 3, 21, 47, 12, 33, 2, -2, 44, 89), ('T-Shirts', 0, 42, 9, -3, 16, 4, 72, 89, 3, 19, 32, 119), ('Key Ring', 0,0,0,0,0,0,1,0,0,0,2,13), ('Hats', 893, 912, '1,212', 643, 789, 159, 888, '1,298', 832, 453, '1,344','2,843') ) t = Table(colwidths, rowheights, data) """, styleSheet['Code'], dedent=4)) lst.append(Paragraph(""" You can then give the Table a TableStyle object to control its format. The first TableStyle used was created as follows: """, styleSheet['BodyText'])) lst.append(Preformatted("""
2f6641518b448ba2f15dcaa4d1369f726c8704b8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/2f6641518b448ba2f15dcaa4d1369f726c8704b8/tables.py
if sys.argv.len()!=3 or sys.argv[1]!='-release':
if len(sys.argv)!=3 or sys.argv[1]!='-release':
def find_src_files(L,d,N): if string.upper(os.path.basename(d))=='CVS': return #ignore all CVS for n in N: fn = os.path.normcase(os.path.normpath(os.path.join(d,n))) if os.path.isfile(fn): L.append(fn)
fb7fffa535194ba899ec911fe92a6cb29e2dbb7f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/fb7fffa535194ba899ec911fe92a6cb29e2dbb7f/daily.py
c.drawInlineImage('pythonpowered.gif',2*inch, 7*inch)
gif = os.path.join(os.path.dirname(unittest.__file__),'pythonpowered.gif') c.drawInlineImage(gif,2*inch, 7*inch)
def makeDocument(filename, pageCallBack=None): #the extra arg is a hack added later, so other #tests can get hold of the canvas just before it is #saved global titlelist, closeit titlelist = [] closeit = 0 c = canvas.Canvas(filename) c.setPageCompression(0) c.setPageCallBack(pageCallBack) framePageForm(c) # define the frame form c.showOutline() framePage(c, 'PDFgen graphics API test script') makesubsection(c, "PDFgen", 10*inch) t = c.beginText(inch, 10*inch) t.setFont('Times-Roman', 10) drawCrossHairs(c, t.getX(),t.getY()) t.textLines("""
b4dc02db9b5691ba384e69ee2eb2525c4c1d354f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/b4dc02db9b5691ba384e69ee2eb2525c4c1d354f/test_pdfgen_general.py
c.drawInlineImage('pythonpowered.gif',2*inch, 5*inch, inch, inch)
c.drawInlineImage(gif,2*inch, 5*inch, inch, inch)
def makeDocument(filename, pageCallBack=None): #the extra arg is a hack added later, so other #tests can get hold of the canvas just before it is #saved global titlelist, closeit titlelist = [] closeit = 0 c = canvas.Canvas(filename) c.setPageCompression(0) c.setPageCallBack(pageCallBack) framePageForm(c) # define the frame form c.showOutline() framePage(c, 'PDFgen graphics API test script') makesubsection(c, "PDFgen", 10*inch) t = c.beginText(inch, 10*inch) t.setFont('Times-Roman', 10) drawCrossHairs(c, t.getX(),t.getY()) t.textLines("""
b4dc02db9b5691ba384e69ee2eb2525c4c1d354f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/b4dc02db9b5691ba384e69ee2eb2525c4c1d354f/test_pdfgen_general.py
(w, h) = c.drawImage('pythonpowered.gif', (1.5 + i)*inch, 3*inch)
(w, h) = c.drawImage(gif, (1.5 + i)*inch, 3*inch)
def makeDocument(filename, pageCallBack=None): #the extra arg is a hack added later, so other #tests can get hold of the canvas just before it is #saved global titlelist, closeit titlelist = [] closeit = 0 c = canvas.Canvas(filename) c.setPageCompression(0) c.setPageCallBack(pageCallBack) framePageForm(c) # define the frame form c.showOutline() framePage(c, 'PDFgen graphics API test script') makesubsection(c, "PDFgen", 10*inch) t = c.beginText(inch, 10*inch) t.setFont('Times-Roman', 10) drawCrossHairs(c, t.getX(),t.getY()) t.textLines("""
b4dc02db9b5691ba384e69ee2eb2525c4c1d354f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/b4dc02db9b5691ba384e69ee2eb2525c4c1d354f/test_pdfgen_general.py
c.drawImage('pythonpowered.gif', 3*inch, 1.2*inch, w, h, mask=myMask)
c.drawImage(gif, 3*inch, 1.2*inch, w, h, mask=myMask)
def makeDocument(filename, pageCallBack=None): #the extra arg is a hack added later, so other #tests can get hold of the canvas just before it is #saved global titlelist, closeit titlelist = [] closeit = 0 c = canvas.Canvas(filename) c.setPageCompression(0) c.setPageCallBack(pageCallBack) framePageForm(c) # define the frame form c.showOutline() framePage(c, 'PDFgen graphics API test script') makesubsection(c, "PDFgen", 10*inch) t = c.beginText(inch, 10*inch) t.setFont('Times-Roman', 10) drawCrossHairs(c, t.getX(),t.getY()) t.textLines("""
b4dc02db9b5691ba384e69ee2eb2525c4c1d354f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/b4dc02db9b5691ba384e69ee2eb2525c4c1d354f/test_pdfgen_general.py
"""This draws a right-angled triangle. possible attributes: 'x', 'y', 'size', 'color', 'strokeColor' """ def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.color = colors.green self.strokeColor = None def demo(self): D = shapes.Drawing(200, 100) et = RTriangle0() et.x=50 et.y=0 et.draw() D.add(et) labelFontSize = 10 D.add(shapes.String(et.x+(et.size/2),(et.y-(1.2*labelFontSize)), self.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) return D def draw(self): s = self.size g = shapes.Group() ae = s*0.125 triangle = shapes.Polygon(points = [ self.x, self.y, self.x+s, self.y, self.x,self.y+s], fillColor = self.color, strokeColor = self.strokeColor, strokeWidth=s/50.) g.add(triangle) return g
"""This draws a right-angled triangle. possible attributes: 'x', 'y', 'size', 'color', 'strokeColor' """ def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.color = colors.green self.strokeColor = None def draw(self): s = float(self.size) g = shapes.Group() ae = s*0.125 triangle = shapes.Polygon(points = [ self.x, self.y, self.x+s, self.y, self.x,self.y+s], fillColor = self.color, strokeColor = self.strokeColor, strokeWidth=s/50.) g.add(triangle) return g
def draw(self): # general widget bits s = self.size # abbreviate as we will use this a lot g = shapes.Group() # Triangle specific bits ae = s*0.125 #(ae = 'an eighth') triangle = shapes.Polygon(points = [ self.x, self.y, self.x+s, self.y, self.x+(s/2),self.y+s], fillColor = self.color, strokeColor = self.strokeColor, strokeWidth=s/50.) g.add(triangle) return g
a94ee8176f1eaa19b5cc320daa2067dbafd93acd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/a94ee8176f1eaa19b5cc320daa2067dbafd93acd/signsandsymbols.py
"""This widget draws an Octagon. possible attributes: 'x', 'y', 'size', 'color', 'strokeColor' """ def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.color = colors.yellow self.strokeColor = None def demo(self): D = shapes.Drawing(200, 100) o = Octagon0() o.x=50 o.y=0 o.draw() D.add(o) labelFontSize = 10 D.add(shapes.String(o.x+(o.size/2),(o.y-(1.2*labelFontSize)), self.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) return D def draw(self): s = self.size g = shapes.Group() athird=s/3 octagon = shapes.Polygon(points=[self.x+athird, self.y, self.x, self.y+athird, self.x, self.y+(athird*2), self.x+athird, self.y+s, self.x+(athird*2), self.y+s, self.x+s, self.y+(athird*2), self.x+s, self.y+athird, self.x+(athird*2), self.y], strokeColor = self.strokeColor, fillColor = self.color, strokeWidth=10) g.add(octagon) return g
"""This widget draws an Octagon. possible attributes: 'x', 'y', 'size', 'color', 'strokeColor' """ def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.color = colors.yellow self.strokeColor = None def draw(self): s = float(self.size) g = shapes.Group() athird=s/3 octagon = shapes.Polygon(points=[self.x+athird, self.y, self.x, self.y+athird, self.x, self.y+(athird*2), self.x+athird, self.y+s, self.x+(athird*2), self.y+s, self.x+s, self.y+(athird*2), self.x+s, self.y+athird, self.x+(athird*2), self.y], strokeColor = self.strokeColor, fillColor = self.color, strokeWidth=10) g.add(octagon) return g
def draw(self): # general widget bits s = self.size # abbreviate as we will use this a lot g = shapes.Group() # Triangle specific bits ae = s*0.125 #(ae = 'an eighth') triangle = shapes.Polygon(points = [ self.x, self.y, self.x+s, self.y, self.x,self.y+s], fillColor = self.color, strokeColor = self.strokeColor, strokeWidth=s/50.) g.add(triangle) return g
a94ee8176f1eaa19b5cc320daa2067dbafd93acd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/a94ee8176f1eaa19b5cc320daa2067dbafd93acd/signsandsymbols.py
"""This draws a black box with a red cross in it - a 'checkbox'. possible attributes: 'x', 'y', 'size', 'crossColor', 'boxColor', 'crosswidth' """ _attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor', 'color'), crossColor = AttrMapValue(isColorOrNone), boxColor = AttrMapValue(isColorOrNone), crosswidth = AttrMapValue(isNumber), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.crossColor = colors.red self.boxColor = colors.black self.crosswidth = 10 def demo(self): D = shapes.Drawing(200, 100) labelFontSize = 10 cb = Crossbox0() cb.x=50 cb.y=0 cb.draw() D.add(cb) D.add(shapes.String(cb.x+(cb.size/2),(cb.y-(1.2*labelFontSize)), self.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) return D def draw(self): s = self.size g = shapes.Group() box = shapes.Rect(self.x+1, self.y+1, s-2, s-2, fillColor = None, strokeColor = self.boxColor, strokeWidth=2) g.add(box) crossLine1 = shapes.Line(self.x+(s*0.15), self.y+(s*0.15), self.x+(s*0.85), self.y+(s*0.85), fillColor = self.crossColor, strokeColor = self.crossColor, strokeWidth = self.crosswidth) g.add(crossLine1) crossLine2 = shapes.Line(self.x+(s*0.15), self.y+(s*0.85), self.x+(s*0.85) ,self.y+(s*0.15), fillColor = self.crossColor, strokeColor = self.crossColor, strokeWidth = self.crosswidth) g.add(crossLine2) return g
"""This draws a black box with a red cross in it - a 'checkbox'. possible attributes: 'x', 'y', 'size', 'crossColor', 'boxColor', 'crosswidth' """ _attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor', 'color'), crossColor = AttrMapValue(isColorOrNone), boxColor = AttrMapValue(isColorOrNone), crosswidth = AttrMapValue(isNumber), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.crossColor = colors.red self.boxColor = colors.black self.crosswidth = 10 def draw(self): s = float(self.size) g = shapes.Group() box = shapes.Rect(self.x+1, self.y+1, s-2, s-2, fillColor = None, strokeColor = self.boxColor, strokeWidth=2) g.add(box) crossLine1 = shapes.Line(self.x+(s*0.15), self.y+(s*0.15), self.x+(s*0.85), self.y+(s*0.85), fillColor = self.crossColor, strokeColor = self.crossColor, strokeWidth = self.crosswidth) g.add(crossLine1) crossLine2 = shapes.Line(self.x+(s*0.15), self.y+(s*0.85), self.x+(s*0.85) ,self.y+(s*0.15), fillColor = self.crossColor, strokeColor = self.crossColor, strokeWidth = self.crosswidth) g.add(crossLine2) return g
def draw(self): # general widget bits s = self.size # abbreviate as we will use this a lot g = shapes.Group() # Octagon specific bits athird=s/3
a94ee8176f1eaa19b5cc320daa2067dbafd93acd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/a94ee8176f1eaa19b5cc320daa2067dbafd93acd/signsandsymbols.py
"""This draws a black box with a red tick in it - another 'checkbox'. possible attributes: 'x', 'y', 'size', 'tickColor', 'boxColor', 'tickwidth' """ _attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor', 'color'), tickColor = AttrMapValue(isColorOrNone), boxColor = AttrMapValue(isColorOrNone), tickwidth = AttrMapValue(isNumber), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.tickColor = colors.red self.boxColor = colors.black self.tickwidth = 10 def demo(self): D = shapes.Drawing(200, 100) tb = Tickbox0() tb.x=50 tb.y=0 tb.draw() D.add(tb) labelFontSize = 10 D.add(shapes.String(tb.x+(tb.size/2),(tb.y-(1.2*labelFontSize)), self.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) return D def draw(self): s = self.size g = shapes.Group() box = shapes.Rect(self.x+1, self.y+1, s-2, s-2, fillColor = None, strokeColor = self.boxColor, strokeWidth=2) g.add(box) tickLine = shapes.PolyLine(points = [self.x+(s*0.15), self.y+(s*0.35), self.x+(s*0.35), self.y+(s*0.15), self.x+(s*0.35), self.y+(s*0.15), self.x+(s*0.85) ,self.y+(s*0.85)], fillColor = self.tickColor, strokeColor = self.tickColor, strokeWidth = self.tickwidth) g.add(tickLine) return g
"""This draws a black box with a red tick in it - another 'checkbox'. possible attributes: 'x', 'y', 'size', 'tickColor', 'boxColor', 'tickwidth' """ _attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor', 'color'), tickColor = AttrMapValue(isColorOrNone), boxColor = AttrMapValue(isColorOrNone), tickwidth = AttrMapValue(isNumber), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.tickColor = colors.red self.boxColor = colors.black self.tickwidth = 10 def draw(self): s = float(self.size) g = shapes.Group() box = shapes.Rect(self.x+1, self.y+1, s-2, s-2, fillColor = None, strokeColor = self.boxColor, strokeWidth=2) g.add(box) tickLine = shapes.PolyLine(points = [self.x+(s*0.15), self.y+(s*0.35), self.x+(s*0.35), self.y+(s*0.15), self.x+(s*0.35), self.y+(s*0.15), self.x+(s*0.85) ,self.y+(s*0.85)], fillColor = self.tickColor, strokeColor = self.tickColor, strokeWidth = self.tickwidth) g.add(tickLine) return g
def draw(self): # general widget bits s = self.size # abbreviate as we will use this a lot g = shapes.Group() # crossbox specific bits box = shapes.Rect(self.x+1, self.y+1, s-2, s-2, fillColor = None, strokeColor = self.boxColor, strokeWidth=2) g.add(box) crossLine1 = shapes.Line(self.x+(s*0.15), self.y+(s*0.15), self.x+(s*0.85), self.y+(s*0.85), fillColor = self.crossColor, strokeColor = self.crossColor, strokeWidth = self.crosswidth) g.add(crossLine1) crossLine2 = shapes.Line(self.x+(s*0.15), self.y+(s*0.85), self.x+(s*0.85) ,self.y+(s*0.15), fillColor = self.crossColor, strokeColor = self.crossColor, strokeWidth = self.crosswidth) g.add(crossLine2)
a94ee8176f1eaa19b5cc320daa2067dbafd93acd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/a94ee8176f1eaa19b5cc320daa2067dbafd93acd/signsandsymbols.py
"""This draws a classic smiley face. possible attributes: 'x', 'y', 'size', 'color' """ _attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor',), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.color = colors.yellow def demo(self): D = shapes.Drawing(200, 100) sf = SmileyFace0() sf.x=50 sf.y=0 sf.draw() D.add(sf) labelFontSize = 10 D.add(shapes.String(sf.x+(sf.size/2),(sf.y-(1.2*labelFontSize)), self.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) return D def draw(self): s = self.size g = shapes.Group() outerCircle = shapes.Circle(cx = (self.x+(s/2)), cy = (self.y+(s/2)), r = s/2, fillColor = self.color, strokeColor = colors.black, strokeWidth=s/38.) g.add(outerCircle) leftEye = shapes.Ellipse(self.x+(s/3),self.y+(s/3)*2, s/30, s/10, fillColor=colors.black) g.add(leftEye) rightEye = shapes.Ellipse(self.x+(s/3)*2, self.y+(s/3)*2, s/30, s/10, fillColor=colors.black) g.add(rightEye) centerx=self.x+(s/2) centery=self.y+(s/2) radius=s/3 yradius = radius xradius = radius startangledegrees=200 endangledegrees=340 degreedelta = 1 pointslist = [] a = pointslist.append from math import sin, cos, pi degreestoradians = pi/180.0 radiansdelta = degreedelta*degreestoradians startangle = startangledegrees*degreestoradians endangle = endangledegrees*degreestoradians while endangle<startangle: endangle = endangle+2*pi angle = startangle while angle<endangle: x = centerx + cos(angle)*radius y = centery + sin(angle)*yradius a(x); a(y) angle = angle+radiansdelta smile = shapes.PolyLine(pointslist, fillColor = colors.black, strokeColor = colors.black, strokeWidth = s/40.) g.add(smile) return g
"""This draws a classic smiley face. possible attributes: 'x', 'y', 'size', 'color' """ _attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor',), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.color = colors.yellow def draw(self): s = float(self.size) g = shapes.Group() outerCircle = shapes.Circle(cx = (self.x+(s/2)), cy = (self.y+(s/2)), r = s/2, fillColor = self.color, strokeColor = colors.black, strokeWidth=s/38.) g.add(outerCircle) leftEye = shapes.Ellipse(self.x+(s/3),self.y+(s/3)*2, s/30, s/10, fillColor=colors.black) g.add(leftEye) rightEye = shapes.Ellipse(self.x+(s/3)*2, self.y+(s/3)*2, s/30, s/10, fillColor=colors.black) g.add(rightEye) centerx=self.x+(s/2) centery=self.y+(s/2) radius=s/3 yradius = radius xradius = radius startangledegrees=200 endangledegrees=340 degreedelta = 1 pointslist = [] a = pointslist.append from math import sin, cos, pi degreestoradians = pi/180.0 radiansdelta = degreedelta*degreestoradians startangle = startangledegrees*degreestoradians endangle = endangledegrees*degreestoradians while endangle<startangle: endangle = endangle+2*pi angle = startangle while angle<endangle: x = centerx + cos(angle)*radius y = centery + sin(angle)*yradius a(x); a(y) angle = angle+radiansdelta smile = shapes.PolyLine(pointslist, fillColor = colors.black, strokeColor = colors.black, strokeWidth = s/40) g.add(smile) return g
def draw(self): # general widget bits s = self.size # abbreviate as we will use this a lot g = shapes.Group() # tickbox specific bits box = shapes.Rect(self.x+1, self.y+1, s-2, s-2, fillColor = None, strokeColor = self.boxColor, strokeWidth=2) g.add(box)
a94ee8176f1eaa19b5cc320daa2067dbafd93acd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/a94ee8176f1eaa19b5cc320daa2067dbafd93acd/signsandsymbols.py
"""This draws a (British) stop sign. possible attributes: 'x', 'y', 'size' """ _attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor', 'color'), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 def demo(self): D = shapes.Drawing(200, 100) ss = StopSign0() ss.x=50 ss.y=0 ss.draw() D.add(ss) labelFontSize = 10 D.add(shapes.String(ss.x+(ss.size/2),(ss.y-(1.2*labelFontSize)), self.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) return D def draw(self): s = self.size g = shapes.Group() athird=s/3 outerOctagon = shapes.Polygon(points=[self.x+athird, self.y, self.x, self.y+athird, self.x, self.y+(athird*2), self.x+athird, self.y+s, self.x+(athird*2), self.y+s, self.x+s, self.y+(athird*2), self.x+s, self.y+athird, self.x+(athird*2), self.y], strokeColor = colors.black, fillColor = None, strokeWidth=1) g.add(outerOctagon) innerOctagon = shapes.Polygon(points=[self.x+athird+(s/75), self.y+(s/75), self.x+(s/75), self.y+athird+(s/75), self.x+(s/75), self.y+(athird*2)-(s/75), self.x+athird+(s/75), self.y+s-(s/75), self.x+(athird*2)-(s/75), (self.y+s)-(s/75), (self.x+s)-(s/75), self.y+(athird*2)-(s/75), (self.x+s)-(s/75), self.y+athird+(s/75), self.x+(athird*2)-(s/75), self.y+(s/75)], strokeColor = None, fillColor = colors.orangered, strokeWidth=0) g.add(innerOctagon) g.add(shapes.String(self.x+(s*0.5),self.y+(s*0.4), 'STOP', fillColor=colors.ghostwhite, textAnchor='middle', fontSize=s/3, fontName="Helvetica-Bold")) return g
"""This draws a (British) stop sign. possible attributes: 'x', 'y', 'size' """ _attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor', 'color'), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 def draw(self): s = float(self.size) g = shapes.Group() athird=s/3 outerOctagon = shapes.Polygon(points=[self.x+athird, self.y, self.x, self.y+athird, self.x, self.y+(athird*2), self.x+athird, self.y+s, self.x+(athird*2), self.y+s, self.x+s, self.y+(athird*2), self.x+s, self.y+athird, self.x+(athird*2), self.y], strokeColor = colors.black, fillColor = None, strokeWidth=1) g.add(outerOctagon) innerOctagon = shapes.Polygon(points=[self.x+athird+(s/75), self.y+(s/75), self.x+(s/75), self.y+athird+(s/75), self.x+(s/75), self.y+(athird*2)-(s/75), self.x+athird+(s/75), self.y+s-(s/75), self.x+(athird*2)-(s/75), (self.y+s)-(s/75), (self.x+s)-(s/75), self.y+(athird*2)-(s/75), (self.x+s)-(s/75), self.y+athird+(s/75), self.x+(athird*2)-(s/75), self.y+(s/75)], strokeColor = None, fillColor = colors.orangered, strokeWidth=0) g.add(innerOctagon) g.add(shapes.String(self.x+(s*0.5),self.y+(s*0.4), 'STOP', fillColor=colors.ghostwhite, textAnchor='middle', fontSize=s/3, fontName="Helvetica-Bold")) return g
def draw(self): # general widget bits s = self.size # abbreviate as we will use this a lot g = shapes.Group() # SmileyFace specific bits outerCircle = shapes.Circle(cx = (self.x+(s/2)), cy = (self.y+(s/2)), r = s/2, fillColor = self.color, strokeColor = colors.black, strokeWidth=s/38.) g.add(outerCircle)
a94ee8176f1eaa19b5cc320daa2067dbafd93acd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/a94ee8176f1eaa19b5cc320daa2067dbafd93acd/signsandsymbols.py
"""This draws a (British) No Entry sign - a red circle with a white line on it. possible attributes: 'x', 'y', 'size' """ _attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor', 'color'), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 def demo(self): D = shapes.Drawing(200, 100) ne = NoEntry0() ne.x=50 ne.y=0 ne.draw() D.add(ne) labelFontSize = 10 D.add(shapes.String(ne.x+(ne.size/2),(ne.y-(1.2*labelFontSize)), self.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) return D def draw(self): s = self.size g = shapes.Group() outerCircle = shapes.Circle(cx = (self.x+(s/2)), cy = (self.y+(s/2)), r = s/2, fillColor = None, strokeColor = colors.black, strokeWidth=1) g.add(outerCircle) innerCircle = shapes.Circle(cx = (self.x+(s/2)), cy =(self.y+(s/2)), r = ((s/2)-(s/50)), fillColor = colors.orangered, strokeColor = None, strokeWidth=0) g.add(innerCircle) innerBar = shapes.Rect(self.x+(s*0.1), self.y+(s*0.4), width=s*0.8, height=s*0.2, fillColor = colors.ghostwhite, strokeColor = colors.ghostwhite, strokeLineCap = 1, strokeWidth = 0) g.add(innerBar) return g
"""This draws a (British) No Entry sign - a red circle with a white line on it. possible attributes: 'x', 'y', 'size' """ _attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor', 'color'), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 def draw(self): s = float(self.size) g = shapes.Group() outerCircle = shapes.Circle(cx = (self.x+(s/2)), cy = (self.y+(s/2)), r = s/2, fillColor = None, strokeColor = colors.black, strokeWidth=1) g.add(outerCircle) innerCircle = shapes.Circle(cx = (self.x+(s/2)), cy =(self.y+(s/2)), r = ((s/2)-(s/50)), fillColor = colors.orangered, strokeColor = None, strokeWidth=0) g.add(innerCircle) innerBar = shapes.Rect(self.x+(s*0.1), self.y+(s*0.4), width=s*0.8, height=s*0.2, fillColor = colors.ghostwhite, strokeColor = colors.ghostwhite, strokeLineCap = 1, strokeWidth = 0) g.add(innerBar) return g
def draw(self): # general widget bits s = self.size # abbreviate as we will use this a lot g = shapes.Group() # stop-sign specific bits athird=s/3
a94ee8176f1eaa19b5cc320daa2067dbafd93acd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/a94ee8176f1eaa19b5cc320daa2067dbafd93acd/signsandsymbols.py
"""This draws a 'forbidden' roundel (as used in the no-smoking sign). possible attributes: 'x', 'y', 'size' """ _attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor', 'color'), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 def demo(self): D = shapes.Drawing(200, 100) na = NotAllowed0() na.x=50 na.y=0 na.draw() D.add(na) labelFontSize = 10 D.add(shapes.String(na.x+(na.size/2),(na.y-(1.2*labelFontSize)), self.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) return D def draw(self): s = self.size g = shapes.Group() outerCircle = shapes.Circle(cx = (self.x+(s/2)), cy = (self.y+(s/2)), r = (s/2)-(s/10), fillColor = None, strokeColor = colors.red, strokeWidth=s/10.) g.add(outerCircle) centerx=self.x+s centery=self.y+(s/2)-(s/6) radius=s-(s/6) yradius = radius/2 xradius = radius/2 startangledegrees=100 endangledegrees=-80 degreedelta = 90 pointslist = [] a = pointslist.append from math import sin, cos, pi degreestoradians = pi/180.0 radiansdelta = degreedelta*degreestoradians startangle = startangledegrees*degreestoradians endangle = endangledegrees*degreestoradians while endangle<startangle: endangle = endangle+2*pi angle = startangle while angle<endangle: x = centerx + cos(angle)*radius y = centery + sin(angle)*yradius a(x); a(y) angle = angle+radiansdelta crossbar = shapes.PolyLine(pointslist, fillColor = colors.red, strokeColor = colors.red, strokeWidth = s/10.) g.add(crossbar) return g
"""This draws a 'forbidden' roundel (as used in the no-smoking sign). possible attributes: 'x', 'y', 'size' """ _attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor', 'color'), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 def draw(self): s = float(self.size) g = shapes.Group() outerCircle = shapes.Circle(cx = (self.x+(s/2)), cy = (self.y+(s/2)), r = (s/2)-(s/10), fillColor = None, strokeColor = colors.red, strokeWidth=s/10.) g.add(outerCircle) centerx=self.x+s centery=self.y+(s/2)-(s/6) radius=s-(s/6) yradius = radius/2 xradius = radius/2 startangledegrees=100 endangledegrees=-80 degreedelta = 90 pointslist = [] a = pointslist.append from math import sin, cos, pi degreestoradians = pi/180.0 radiansdelta = degreedelta*degreestoradians startangle = startangledegrees*degreestoradians endangle = endangledegrees*degreestoradians while endangle<startangle: endangle = endangle+2*pi angle = startangle while angle<endangle: x = centerx + cos(angle)*radius y = centery + sin(angle)*yradius a(x); a(y) angle = angle+radiansdelta crossbar = shapes.PolyLine(pointslist, fillColor = colors.red, strokeColor = colors.red, strokeWidth = s/10.) g.add(crossbar) return g
def draw(self): # general widget bits s = self.size # abbreviate as we will use this a lot g = shapes.Group() # no-entry-sign specific bits outerCircle = shapes.Circle(cx = (self.x+(s/2)), cy = (self.y+(s/2)), r = s/2, fillColor = None, strokeColor = colors.black, strokeWidth=1) g.add(outerCircle)
a94ee8176f1eaa19b5cc320daa2067dbafd93acd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/a94ee8176f1eaa19b5cc320daa2067dbafd93acd/signsandsymbols.py
"""This draws a no-smoking sign. possible attributes: 'x', 'y', 'size' """ def __init__(self): self.x = 0 self.y = 0 self.size = 100 def demo(self): D = shapes.Drawing(200, 100) ns = NoSmoking0() ns.x=50 ns.y=0 ns.draw() D.add(ns) labelFontSize = 10 D.add(shapes.String(ns.x+(ns.size/2),(ns.y-(1.2*labelFontSize)), self.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) return D def draw(self): s = self.size g = shapes.Group() newx = self.x+(s/2)-(s/3.5) newy = self.y+(s/2)-(s/32) cigarrette1 = shapes.Rect(x = newx, y = newy, width = (s/2), height =(s/16), fillColor = colors.ghostwhite, strokeColor = colors.gray, strokeWidth=0) newx=newx+(s/2)+(s/64) g.add(cigarrette1) cigarrette2 = shapes.Rect(x = newx, y = newy, width = (s/80), height =(s/16), fillColor = colors.orangered, strokeColor = None, strokeWidth=0) newx= newx+(s/35) g.add(cigarrette2) cigarrette3 = shapes.Rect(x = newx, y = newy, width = (s/80), height =(s/16), fillColor = colors.orangered, strokeColor = None, strokeWidth=0) newx= newx+(s/35) g.add(cigarrette3) cigarrette4 = shapes.Rect(x = newx, y = newy, width = (s/80), height =(s/16), fillColor = colors.orangered, strokeColor = None, strokeWidth=0) newx= newx+(s/35) g.add(cigarrette4) roundel = NotAllowed0() roundel.draw() roundel.x = self.x roundel.y = self.y roundel.size = self.size g.add(roundel) return g
"""This draws a no-smoking sign. possible attributes: 'x', 'y', 'size' """ def __init__(self): self.x = 0 self.y = 0 self.size = 100 def draw(self): s = float(self.size) g = shapes.Group() newx = self.x+(s/2)-(s/3.5) newy = self.y+(s/2)-(s/32) cigarrette1 = shapes.Rect(x = newx, y = newy, width = (s/2), height =(s/16), fillColor = colors.ghostwhite, strokeColor = colors.gray, strokeWidth=0) newx=newx+(s/2)+(s/64) g.add(cigarrette1) cigarrette2 = shapes.Rect(x = newx, y = newy, width = (s/80), height =(s/16), fillColor = colors.orangered, strokeColor = None, strokeWidth=0) newx= newx+(s/35) g.add(cigarrette2) cigarrette3 = shapes.Rect(x = newx, y = newy, width = (s/80), height =(s/16), fillColor = colors.orangered, strokeColor = None, strokeWidth=0) newx= newx+(s/35) g.add(cigarrette3) cigarrette4 = shapes.Rect(x = newx, y = newy, width = (s/80), height =(s/16), fillColor = colors.orangered, strokeColor = None, strokeWidth=0) newx= newx+(s/35) g.add(cigarrette4) roundel = NotAllowed0() roundel.draw() roundel.x = self.x roundel.y = self.y roundel.size = self.size g.add(roundel) return g
def draw(self): # general widget bits s = self.size # abbreviate as we will use this a lot g = shapes.Group() # not=allowed specific bits outerCircle = shapes.Circle(cx = (self.x+(s/2)), cy = (self.y+(s/2)), r = (s/2)-(s/10), fillColor = None, strokeColor = colors.red, strokeWidth=s/10.) g.add(outerCircle) centerx=self.x+s centery=self.y+(s/2)-(s/6) radius=s-(s/6) yradius = radius/2 xradius = radius/2 startangledegrees=100 endangledegrees=-80 degreedelta = 90 pointslist = [] a = pointslist.append from math import sin, cos, pi degreestoradians = pi/180.0 radiansdelta = degreedelta*degreestoradians startangle = startangledegrees*degreestoradians endangle = endangledegrees*degreestoradians while endangle<startangle: endangle = endangle+2*pi angle = startangle while angle<endangle: x = centerx + cos(angle)*radius y = centery + sin(angle)*yradius a(x); a(y) angle = angle+radiansdelta crossbar = shapes.PolyLine(pointslist, fillColor = colors.red, strokeColor = colors.red, strokeWidth = s/10.)
a94ee8176f1eaa19b5cc320daa2067dbafd93acd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/a94ee8176f1eaa19b5cc320daa2067dbafd93acd/signsandsymbols.py
"""This draws a 'danger' sign: a yellow box with a black exclamation point. possible attributes: 'x', 'y', 'size', 'exmarkColor', 'backColor', 'exmarkWidth' """ _attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor', 'color'), exmarkColor = AttrMapValue( isColorOrNone), backColor = AttrMapValue( isColorOrNone), exmarkWidth = AttrMapValue( isNumber), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.exmarkColor = colors.black self.backColor = colors.gold self.exmarkWidth = self.size*0.125 def demo(self): D = shapes.Drawing(200, 100) ds = DangerSign0() ds.x=50 ds.y=0 ds.draw() D.add(ds) labelFontSize = 10 D.add(shapes.String(ds.x+(ds.size/2),(ds.y-(1.2*labelFontSize)), self.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) return D def draw(self): s = self.size g = shapes.Group() ew = self.exmarkWidth ae = s*0.125 ew = self.exmarkWidth ae = s*0.125 outerTriangle = shapes.Polygon(points = [ self.x, self.y, self.x+s, self.y, self.x+(s/2),self.y+s], fillColor = None, strokeColor = self.exmarkColor, strokeWidth=0) g.add(outerTriangle) innerTriangle = shapes.Polygon(points = [ self.x+(s/50), self.y+(s/75), (self.x+s)-(s/50), self.y+(s/75), self.x+(s/2),(self.y+s)-(s/50)], fillColor = self.backColor, strokeColor = None, strokeWidth=0) g.add(innerTriangle) exmark = shapes.Polygon(points=[ ((self.x+s/2)-ew/2), self.y+ae*2.5, ((self.x+s/2)+ew/2), self.y+ae*2.5, ((self.x+s/2)+((ew/2))+(ew/6)), self.y+ae*5.5, ((self.x+s/2)-((ew/2))-(ew/6)), self.y+ae*5.5], fillColor = self.exmarkColor, strokeColor = None) g.add(exmark) exdot = shapes.Polygon(points=[ ((self.x+s/2)-ew/2), self.y+ae, ((self.x+s/2)+ew/2), self.y+ae, ((self.x+s/2)+ew/2), self.y+ae*2, ((self.x+s/2)-ew/2), self.y+ae*2], fillColor = self.exmarkColor, strokeColor = None) g.add(exdot) return g
"""This draws a 'danger' sign: a yellow box with a black exclamation point. possible attributes: 'x', 'y', 'size', 'exmarkColor', 'backColor', 'exmarkWidth' """ _attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor', 'color'), exmarkColor = AttrMapValue( isColorOrNone), backColor = AttrMapValue( isColorOrNone), exmarkWidth = AttrMapValue( isNumber), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.exmarkColor = colors.black self.backColor = colors.gold self.exmarkWidth = self.size*0.125 def draw(self): s = float(self.size) g = shapes.Group() ew = self.exmarkWidth ae = s*0.125 ew = self.exmarkWidth ae = s*0.125 outerTriangle = shapes.Polygon(points = [ self.x, self.y, self.x+s, self.y, self.x+(s/2),self.y+s], fillColor = None, strokeColor = self.exmarkColor, strokeWidth=0) g.add(outerTriangle) innerTriangle = shapes.Polygon(points = [ self.x+(s/50), self.y+(s/75), (self.x+s)-(s/50), self.y+(s/75), self.x+(s/2),(self.y+s)-(s/50)], fillColor = self.backColor, strokeColor = None, strokeWidth=0) g.add(innerTriangle) exmark = shapes.Polygon(points=[ ((self.x+s/2)-ew/2), self.y+ae*2.5, ((self.x+s/2)+ew/2), self.y+ae*2.5, ((self.x+s/2)+((ew/2))+(ew/6)), self.y+ae*5.5, ((self.x+s/2)-((ew/2))-(ew/6)), self.y+ae*5.5], fillColor = self.exmarkColor, strokeColor = None) g.add(exmark) exdot = shapes.Polygon(points=[ ((self.x+s/2)-ew/2), self.y+ae, ((self.x+s/2)+ew/2), self.y+ae, ((self.x+s/2)+ew/2), self.y+ae*2, ((self.x+s/2)-ew/2), self.y+ae*2], fillColor = self.exmarkColor, strokeColor = None) g.add(exdot) return g
def draw(self): # general widget bits s = self.size # abbreviate as we will use this a lot g = shapes.Group() # no-smoking-sign specific bits newx = self.x+(s/2)-(s/3.5) newy = self.y+(s/2)-(s/32) cigarrette1 = shapes.Rect(x = newx, y = newy, width = (s/2), height =(s/16), fillColor = colors.ghostwhite, strokeColor = colors.gray, strokeWidth=0) newx=newx+(s/2)+(s/64) g.add(cigarrette1) cigarrette2 = shapes.Rect(x = newx, y = newy, width = (s/80), height =(s/16), fillColor = colors.orangered, strokeColor = None, strokeWidth=0) newx= newx+(s/35) g.add(cigarrette2)
a94ee8176f1eaa19b5cc320daa2067dbafd93acd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/a94ee8176f1eaa19b5cc320daa2067dbafd93acd/signsandsymbols.py
"""This widget draw a tickbox or crossbox depending on 'testValue'. If this widget is supplied with a 'True' or 1 as a value for testValue, it will use the tickbox widget. Otherwise, it will produce a crossbox. possible attributes: 'x', 'y', 'size', 'tickcolor', 'crosscolor', 'testValue'
"""This widget draw a tickbox or crossbox depending on 'testValue'. If this widget is supplied with a 'True' or 1 as a value for testValue, it will use the tickbox widget. Otherwise, it will produce a crossbox. possible attributes: 'x', 'y', 'size', 'tickcolor', 'crosscolor', 'testValue'
def draw(self): # general widget bits s = self.size # abbreviate as we will use this a lot g = shapes.Group() ew = self.exmarkWidth ae = s*0.125 #(ae = 'an eighth')
a94ee8176f1eaa19b5cc320daa2067dbafd93acd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/a94ee8176f1eaa19b5cc320daa2067dbafd93acd/signsandsymbols.py
_attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor', 'color'), tickcolor = AttrMapValue(isColor), crosscolor = AttrMapValue(isColor), testValue = AttrMapValue(isBoolean), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.tickcolor = colors.green self.crosscolor = colors.red self.testValue = 1 def draw(self): if self.testValue: yn=Tickbox0() yn.tickColor=self.tickcolor else: yn=Crossbox0() yn.crossColor=self.crosscolor yn.x=self.x yn.y=self.y yn.size=self.size yn.draw() return yn def demo(self): D = shapes.Drawing(200, 100) yn = YesNo0() yn.x = 15 yn.y = 25 yn.size = 70 yn.testValue = 0 yn.draw() D.add(yn) yn2 = YesNo0() yn2.x = 120 yn2.y = 25 yn2.size = 70 yn2.testValue = 1 yn2.draw() D.add(yn2) labelFontSize = 8 D.add(shapes.String(yn.x+(yn.size/2),(yn.y-(1.2*labelFontSize)), 'testValue=0', fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) D.add(shapes.String(yn2.x+(yn2.size/2),(yn2.y-(1.2*labelFontSize)), 'testValue=1', fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) labelFontSize = 10 D.add(shapes.String(yn.x+85,(yn.y-20), self.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) return D
_attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor', 'color'), tickcolor = AttrMapValue(isColor), crosscolor = AttrMapValue(isColor), testValue = AttrMapValue(isBoolean), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.tickcolor = colors.green self.crosscolor = colors.red self.testValue = 1 def draw(self): if self.testValue: yn=Tickbox0() yn.tickColor=self.tickcolor else: yn=Crossbox0() yn.crossColor=self.crosscolor yn.x=self.x yn.y=self.y yn.size=self.size yn.draw() return yn def demo(self): D = shapes.Drawing(200, 100) yn = YesNo0() yn.x = 15 yn.y = 25 yn.size = 70 yn.testValue = 0 yn.draw() D.add(yn) yn2 = YesNo0() yn2.x = 120 yn2.y = 25 yn2.size = 70 yn2.testValue = 1 yn2.draw() D.add(yn2) labelFontSize = 8 D.add(shapes.String(yn.x+(yn.size/2),(yn.y-(1.2*labelFontSize)), 'testValue=0', fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) D.add(shapes.String(yn2.x+(yn2.size/2),(yn2.y-(1.2*labelFontSize)), 'testValue=1', fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) labelFontSize = 10 D.add(shapes.String(yn.x+85,(yn.y-20), self.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) return D
def draw(self): # general widget bits s = self.size # abbreviate as we will use this a lot g = shapes.Group() ew = self.exmarkWidth ae = s*0.125 #(ae = 'an eighth')
a94ee8176f1eaa19b5cc320daa2067dbafd93acd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/a94ee8176f1eaa19b5cc320daa2067dbafd93acd/signsandsymbols.py
"""This widget draws an icon of a floppy disk. possible attributes: 'x', 'y', 'size', 'diskcolor' """ _attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor', 'color'), diskColor = AttrMapValue(isColor), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.diskColor = colors.black def demo(self): D = shapes.Drawing(200, 100) fd = FloppyDisk0() fd.x=50 fd.y=0 fd.draw() D.add(fd) labelFontSize = 10 D.add(shapes.String(fd.x+(fd.size/2),(fd.y-(1.2*labelFontSize)), self.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) return D def draw(self): s = self.size g = shapes.Group() diskBody = shapes.Rect(x=self.x, y=self.y+(s/100), width=s, height=s-(s/100), fillColor = self.diskColor, strokeColor = None, strokeWidth=0) g.add(diskBody) label = shapes.Rect(x=self.x+(s*0.1), y=(self.y+s)-(s*0.5), width=s*0.8, height=s*0.48, fillColor = colors.whitesmoke, strokeColor = None, strokeWidth=0) g.add(label) labelsplash = shapes.Rect(x=self.x+(s*0.1), y=(self.y+s)-(s*0.1), width=s*0.8, height=s*0.08, fillColor = colors.royalblue, strokeColor = None, strokeWidth=0) g.add(labelsplash) line1 = shapes.Line(x1=self.x+(s*0.15), y1=self.y+(0.6*s), x2=self.x+(s*0.85), y2=self.y+(0.6*s), fillColor = colors.black, strokeColor = colors.black, strokeWidth=0) g.add(line1) line2 = shapes.Line(x1=self.x+(s*0.15), y1=self.y+(0.7*s), x2=self.x+(s*0.85), y2=self.y+(0.7*s), fillColor = colors.black, strokeColor = colors.black, strokeWidth=0) g.add(line2) line3 = shapes.Line(x1=self.x+(s*0.15), y1=self.y+(0.8*s), x2=self.x+(s*0.85), y2=self.y+(0.8*s), fillColor = colors.black, strokeColor = colors.black, strokeWidth=0) g.add(line3) metalcover = shapes.Rect(x=self.x+(s*0.2), y=(self.y), width=s*0.5, height=s*0.35, fillColor = colors.silver, strokeColor = None, strokeWidth=0) g.add(metalcover) coverslot = shapes.Rect(x=self.x+(s*0.28), y=(self.y)+(s*0.035), width=s*0.12, height=s*0.28, fillColor = self.diskColor, strokeColor = None, strokeWidth=0) g.add(coverslot) return g
"""This widget draws an icon of a floppy disk. possible attributes: 'x', 'y', 'size', 'diskcolor' """ _attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor', 'color'), diskColor = AttrMapValue(isColor), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.diskColor = colors.black def draw(self): s = float(self.size) g = shapes.Group() diskBody = shapes.Rect(x=self.x, y=self.y+(s/100), width=s, height=s-(s/100), fillColor = self.diskColor, strokeColor = None, strokeWidth=0) g.add(diskBody) label = shapes.Rect(x=self.x+(s*0.1), y=(self.y+s)-(s*0.5), width=s*0.8, height=s*0.48, fillColor = colors.whitesmoke, strokeColor = None, strokeWidth=0) g.add(label) labelsplash = shapes.Rect(x=self.x+(s*0.1), y=(self.y+s)-(s*0.1), width=s*0.8, height=s*0.08, fillColor = colors.royalblue, strokeColor = None, strokeWidth=0) g.add(labelsplash) line1 = shapes.Line(x1=self.x+(s*0.15), y1=self.y+(0.6*s), x2=self.x+(s*0.85), y2=self.y+(0.6*s), fillColor = colors.black, strokeColor = colors.black, strokeWidth=0) g.add(line1) line2 = shapes.Line(x1=self.x+(s*0.15), y1=self.y+(0.7*s), x2=self.x+(s*0.85), y2=self.y+(0.7*s), fillColor = colors.black, strokeColor = colors.black, strokeWidth=0) g.add(line2) line3 = shapes.Line(x1=self.x+(s*0.15), y1=self.y+(0.8*s), x2=self.x+(s*0.85), y2=self.y+(0.8*s), fillColor = colors.black, strokeColor = colors.black, strokeWidth=0) g.add(line3) metalcover = shapes.Rect(x=self.x+(s*0.2), y=(self.y), width=s*0.5, height=s*0.35, fillColor = colors.silver, strokeColor = None, strokeWidth=0) g.add(metalcover) coverslot = shapes.Rect(x=self.x+(s*0.28), y=(self.y)+(s*0.035), width=s*0.12, height=s*0.28, fillColor = self.diskColor, strokeColor = None, strokeWidth=0) g.add(coverslot) return g
def demo(self): D = shapes.Drawing(200, 100) yn = YesNo0() yn.x = 15 yn.y = 25 yn.size = 70 yn.testValue = 0 yn.draw() D.add(yn) yn2 = YesNo0() yn2.x = 120 yn2.y = 25 yn2.size = 70 yn2.testValue = 1 yn2.draw() D.add(yn2) labelFontSize = 8 D.add(shapes.String(yn.x+(yn.size/2),(yn.y-(1.2*labelFontSize)), 'testValue=0', fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) D.add(shapes.String(yn2.x+(yn2.size/2),(yn2.y-(1.2*labelFontSize)), 'testValue=1', fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) labelFontSize = 10 D.add(shapes.String(yn.x+85,(yn.y-20), self.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) return D
a94ee8176f1eaa19b5cc320daa2067dbafd93acd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/a94ee8176f1eaa19b5cc320daa2067dbafd93acd/signsandsymbols.py
"""This widget draws an arrow (style one). possible attributes: 'x', 'y', 'size', 'color' """ _attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor',), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.color = colors.red def demo(self): D = shapes.Drawing(200, 100) a1 = ArrowOne0() a1.x=50 a1.y=0 a1.draw() D.add(a1) labelFontSize = 10 D.add(shapes.String(a1.x+(a1.size/2),(a1.y-(1.2*labelFontSize)), self.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) return D def draw(self): s = self.size g = shapes.Group() body = shapes.Rect(x=self.x, y=(self.y+(s/2))-(s/6), width=2*(s/3), height=(s/3), fillColor = self.color, strokeColor = None, strokeWidth=0) g.add(body) head = shapes.Polygon(points = [self.x+(3*(s/6)), (self.y+(s/2)), self.x+(3*(s/6)), self.y+8*(s/10), self.x+s, self.y+(s/2), self.x+(3*(s/6)), self.y+2*(s/10)], fillColor = self.color, strokeColor = None, strokeWidth=0) g.add(head) return g
"""This widget draws an arrow (style one). possible attributes: 'x', 'y', 'size', 'color' """ _attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor',), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.color = colors.red def draw(self): s = float(self.size) g = shapes.Group() body = shapes.Rect(x=self.x, y=(self.y+(s/2))-(s/6), width=2*(s/3), height=(s/3), fillColor = self.color, strokeColor = None, strokeWidth=0) g.add(body) head = shapes.Polygon(points = [self.x+(3*(s/6)), (self.y+(s/2)), self.x+(3*(s/6)), self.y+8*(s/10), self.x+s, self.y+(s/2), self.x+(3*(s/6)), self.y+2*(s/10)], fillColor = self.color, strokeColor = None, strokeWidth=0) g.add(head) return g
def draw(self): # general widget bits s = self.size # abbreviate as we will use this a lot g = shapes.Group()
a94ee8176f1eaa19b5cc320daa2067dbafd93acd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/a94ee8176f1eaa19b5cc320daa2067dbafd93acd/signsandsymbols.py
"""This widget draws an arrow (style two). possible attributes: 'x', 'y', 'size', 'color' """ def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.color = colors.blue def demo(self): D = shapes.Drawing(200, 100) a2 = ArrowTwo0() a2.x=50 a2.y=0 a2.draw() D.add(a2) labelFontSize = 10 D.add(shapes.String(a2.x+(a2.size/2),(a2.y-(1.2*labelFontSize)), self.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) return D def draw(self): s = self.size g = shapes.Group() body = shapes.Rect(x=self.x, y=(self.y+(s/2))-(s/24), width=9*(s/10), height=(s/12), fillColor = self.color, strokeColor = None, strokeWidth=0) g.add(body) head = shapes.Polygon(points = [self.x+(2.5*(s/3)), (self.y+(s/2)), self.x+(4*(s/6)), self.y+4*(s/6), self.x+s, self.y+(s/2), self.x+(4*(s/6)), self.y+2*(s/6)], fillColor = self.color, strokeColor = None, strokeWidth=0) g.add(head) return g
"""This widget draws an arrow (style two). possible attributes: 'x', 'y', 'size', 'color' """ def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.color = colors.blue def draw(self): s = float(self.size) g = shapes.Group() body = shapes.Rect(x=self.x, y=(self.y+(s/2))-(s/24), width=9*(s/10), height=(s/12), fillColor = self.color, strokeColor = None, strokeWidth=0) g.add(body) head = shapes.Polygon(points = [self.x+(2.5*(s/3)), (self.y+(s/2)), self.x+(4*(s/6)), self.y+4*(s/6), self.x+s, self.y+(s/2), self.x+(4*(s/6)), self.y+2*(s/6)], fillColor = self.color, strokeColor = None, strokeWidth=0) g.add(head) return g
def draw(self): # general widget bits s = self.size # abbreviate as we will use this a lot g = shapes.Group()
a94ee8176f1eaa19b5cc320daa2067dbafd93acd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/a94ee8176f1eaa19b5cc320daa2067dbafd93acd/signsandsymbols.py
"""This function produces a pdf with examples of all the signs and symbols from this file. """ labelFontSize = 10 D = shapes.Drawing(450,650) cb = Crossbox0() cb.x = 20 cb.y = 530 cb.demo() D.add(cb) D.add(shapes.String(cb.x+(cb.size/2),(cb.y-(1.2*labelFontSize)), cb.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) tb = Tickbox0() tb.x = 170 tb.y = 530 tb.demo() D.add(tb) D.add(shapes.String(tb.x+(tb.size/2),(tb.y-(1.2*labelFontSize)), tb.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) yn = YesNo0() yn.x = 320 yn.y = 530 yn.demo() D.add(yn) tempstring = yn.__class__.__name__ + '*' D.add(shapes.String(yn.x+(tb.size/2),(yn.y-(1.2*labelFontSize)), tempstring, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) D.add(shapes.String(130,6, "(The 'YesNo' widget returns a tickbox if testvalue=1, and a crossbox if testvalue=0)", fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize*0.75)) ss = StopSign0() ss.x = 20 ss.y = 400 ss.demo() D.add(ss) D.add(shapes.String(ss.x+(ss.size/2), ss.y-(1.2*labelFontSize), ss.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) ne = NoEntry0() ne.x = 170 ne.y = 400 ne.demo() D.add(ne) D.add(shapes.String(ne.x+(ne.size/2),(ne.y-(1.2*labelFontSize)), ne.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) sf = SmileyFace0() sf.x = 320 sf.y = 400 sf.demo() D.add(sf) D.add(shapes.String(sf.x+(sf.size/2),(sf.y-(1.2*labelFontSize)), sf.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) ds = DangerSign0() ds.x = 20 ds.y = 270 ds.demo() D.add(ds) D.add(shapes.String(ds.x+(ds.size/2),(ds.y-(1.2*labelFontSize)), ds.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) na = NotAllowed0() na.x = 170 na.y = 270 na.demo() D.add(na) D.add(shapes.String(na.x+(na.size/2),(na.y-(1.2*labelFontSize)), na.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) ns = NoSmoking0() ns.x = 320 ns.y = 270 ns.demo() D.add(ns) D.add(shapes.String(ns.x+(ns.size/2),(ns.y-(1.2*labelFontSize)), ns.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) a1 = ArrowOne0() a1.x = 20 a1.y = 140 a1.demo() D.add(a1) D.add(shapes.String(a1.x+(a1.size/2),(a1.y-(1.2*labelFontSize)), a1.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) a2 = ArrowTwo0() a2.x = 170 a2.y = 140 a2.demo() D.add(a2) D.add(shapes.String(a2.x+(a2.size/2),(a2.y-(1.2*labelFontSize)), a2.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) fd = FloppyDisk0() fd.x = 320 fd.y = 140 fd.demo() D.add(fd) D.add(shapes.String(fd.x+(fd.size/2),(fd.y-(1.2*labelFontSize)), fd.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) renderPDF.drawToFile(D, 'signsandsymbols.pdf', 'signsandsymbols.py') print 'wrote file: signsandsymbols.pdf'
"""This function produces a pdf with examples of all the signs and symbols from this file. """ labelFontSize = 10 D = shapes.Drawing(450,650) cb = Crossbox0() cb.x = 20 cb.y = 530 cb.demo() D.add(cb) D.add(shapes.String(cb.x+(cb.size/2),(cb.y-(1.2*labelFontSize)), cb.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) tb = Tickbox0() tb.x = 170 tb.y = 530 tb.demo() D.add(tb) D.add(shapes.String(tb.x+(tb.size/2),(tb.y-(1.2*labelFontSize)), tb.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) yn = YesNo0() yn.x = 320 yn.y = 530 yn.demo() D.add(yn) tempstring = yn.__class__.__name__ + '*' D.add(shapes.String(yn.x+(tb.size/2),(yn.y-(1.2*labelFontSize)), tempstring, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) D.add(shapes.String(130,6, "(The 'YesNo' widget returns a tickbox if testvalue=1, and a crossbox if testvalue=0)", fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize*0.75)) ss = StopSign0() ss.x = 20 ss.y = 400 ss.demo() D.add(ss) D.add(shapes.String(ss.x+(ss.size/2), ss.y-(1.2*labelFontSize), ss.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) ne = NoEntry0() ne.x = 170 ne.y = 400 ne.demo() D.add(ne) D.add(shapes.String(ne.x+(ne.size/2),(ne.y-(1.2*labelFontSize)), ne.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) sf = SmileyFace0() sf.x = 320 sf.y = 400 sf.demo() D.add(sf) D.add(shapes.String(sf.x+(sf.size/2),(sf.y-(1.2*labelFontSize)), sf.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) ds = DangerSign0() ds.x = 20 ds.y = 270 ds.demo() D.add(ds) D.add(shapes.String(ds.x+(ds.size/2),(ds.y-(1.2*labelFontSize)), ds.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) na = NotAllowed0() na.x = 170 na.y = 270 na.demo() D.add(na) D.add(shapes.String(na.x+(na.size/2),(na.y-(1.2*labelFontSize)), na.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) ns = NoSmoking0() ns.x = 320 ns.y = 270 ns.demo() D.add(ns) D.add(shapes.String(ns.x+(ns.size/2),(ns.y-(1.2*labelFontSize)), ns.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) a1 = ArrowOne0() a1.x = 20 a1.y = 140 a1.demo() D.add(a1) D.add(shapes.String(a1.x+(a1.size/2),(a1.y-(1.2*labelFontSize)), a1.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) a2 = ArrowTwo0() a2.x = 170 a2.y = 140 a2.demo() D.add(a2) D.add(shapes.String(a2.x+(a2.size/2),(a2.y-(1.2*labelFontSize)), a2.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) fd = FloppyDisk0() fd.x = 320 fd.y = 140 fd.demo() D.add(fd) D.add(shapes.String(fd.x+(fd.size/2),(fd.y-(1.2*labelFontSize)), fd.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) renderPDF.drawToFile(D, 'signsandsymbols.pdf', 'signsandsymbols.py') print 'wrote file: signsandsymbols.pdf'
def test(): """This function produces a pdf with examples of all the signs and symbols from this file. """ labelFontSize = 10 D = shapes.Drawing(450,650) cb = Crossbox0() cb.x = 20 cb.y = 530 cb.demo() D.add(cb) D.add(shapes.String(cb.x+(cb.size/2),(cb.y-(1.2*labelFontSize)), cb.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) tb = Tickbox0() tb.x = 170 tb.y = 530 tb.demo() D.add(tb) D.add(shapes.String(tb.x+(tb.size/2),(tb.y-(1.2*labelFontSize)), tb.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) yn = YesNo0() yn.x = 320 yn.y = 530 yn.demo() D.add(yn) tempstring = yn.__class__.__name__ + '*' D.add(shapes.String(yn.x+(tb.size/2),(yn.y-(1.2*labelFontSize)), tempstring, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) D.add(shapes.String(130,6, "(The 'YesNo' widget returns a tickbox if testvalue=1, and a crossbox if testvalue=0)", fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize*0.75)) ss = StopSign0() ss.x = 20 ss.y = 400 ss.demo() D.add(ss) D.add(shapes.String(ss.x+(ss.size/2), ss.y-(1.2*labelFontSize), ss.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) ne = NoEntry0() ne.x = 170 ne.y = 400 ne.demo() D.add(ne) D.add(shapes.String(ne.x+(ne.size/2),(ne.y-(1.2*labelFontSize)), ne.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) sf = SmileyFace0() sf.x = 320 sf.y = 400 sf.demo() D.add(sf) D.add(shapes.String(sf.x+(sf.size/2),(sf.y-(1.2*labelFontSize)), sf.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) ds = DangerSign0() ds.x = 20 ds.y = 270 ds.demo() D.add(ds) D.add(shapes.String(ds.x+(ds.size/2),(ds.y-(1.2*labelFontSize)), ds.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) na = NotAllowed0() na.x = 170 na.y = 270 na.demo() D.add(na) D.add(shapes.String(na.x+(na.size/2),(na.y-(1.2*labelFontSize)), na.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) ns = NoSmoking0() ns.x = 320 ns.y = 270 ns.demo() D.add(ns) D.add(shapes.String(ns.x+(ns.size/2),(ns.y-(1.2*labelFontSize)), ns.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) a1 = ArrowOne0() a1.x = 20 a1.y = 140 a1.demo() D.add(a1) D.add(shapes.String(a1.x+(a1.size/2),(a1.y-(1.2*labelFontSize)), a1.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) a2 = ArrowTwo0() a2.x = 170 a2.y = 140 a2.demo() D.add(a2) D.add(shapes.String(a2.x+(a2.size/2),(a2.y-(1.2*labelFontSize)), a2.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) fd = FloppyDisk0() fd.x = 320 fd.y = 140 fd.demo() D.add(fd) D.add(shapes.String(fd.x+(fd.size/2),(fd.y-(1.2*labelFontSize)), fd.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) renderPDF.drawToFile(D, 'signsandsymbols.pdf', 'signsandsymbols.py') print 'wrote file: signsandsymbols.pdf'
a94ee8176f1eaa19b5cc320daa2067dbafd93acd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/a94ee8176f1eaa19b5cc320daa2067dbafd93acd/signsandsymbols.py
test()
test()
def test(): """This function produces a pdf with examples of all the signs and symbols from this file. """ labelFontSize = 10 D = shapes.Drawing(450,650) cb = Crossbox0() cb.x = 20 cb.y = 530 cb.demo() D.add(cb) D.add(shapes.String(cb.x+(cb.size/2),(cb.y-(1.2*labelFontSize)), cb.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) tb = Tickbox0() tb.x = 170 tb.y = 530 tb.demo() D.add(tb) D.add(shapes.String(tb.x+(tb.size/2),(tb.y-(1.2*labelFontSize)), tb.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) yn = YesNo0() yn.x = 320 yn.y = 530 yn.demo() D.add(yn) tempstring = yn.__class__.__name__ + '*' D.add(shapes.String(yn.x+(tb.size/2),(yn.y-(1.2*labelFontSize)), tempstring, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) D.add(shapes.String(130,6, "(The 'YesNo' widget returns a tickbox if testvalue=1, and a crossbox if testvalue=0)", fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize*0.75)) ss = StopSign0() ss.x = 20 ss.y = 400 ss.demo() D.add(ss) D.add(shapes.String(ss.x+(ss.size/2), ss.y-(1.2*labelFontSize), ss.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) ne = NoEntry0() ne.x = 170 ne.y = 400 ne.demo() D.add(ne) D.add(shapes.String(ne.x+(ne.size/2),(ne.y-(1.2*labelFontSize)), ne.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) sf = SmileyFace0() sf.x = 320 sf.y = 400 sf.demo() D.add(sf) D.add(shapes.String(sf.x+(sf.size/2),(sf.y-(1.2*labelFontSize)), sf.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) ds = DangerSign0() ds.x = 20 ds.y = 270 ds.demo() D.add(ds) D.add(shapes.String(ds.x+(ds.size/2),(ds.y-(1.2*labelFontSize)), ds.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) na = NotAllowed0() na.x = 170 na.y = 270 na.demo() D.add(na) D.add(shapes.String(na.x+(na.size/2),(na.y-(1.2*labelFontSize)), na.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) ns = NoSmoking0() ns.x = 320 ns.y = 270 ns.demo() D.add(ns) D.add(shapes.String(ns.x+(ns.size/2),(ns.y-(1.2*labelFontSize)), ns.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) a1 = ArrowOne0() a1.x = 20 a1.y = 140 a1.demo() D.add(a1) D.add(shapes.String(a1.x+(a1.size/2),(a1.y-(1.2*labelFontSize)), a1.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) a2 = ArrowTwo0() a2.x = 170 a2.y = 140 a2.demo() D.add(a2) D.add(shapes.String(a2.x+(a2.size/2),(a2.y-(1.2*labelFontSize)), a2.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) fd = FloppyDisk0() fd.x = 320 fd.y = 140 fd.demo() D.add(fd) D.add(shapes.String(fd.x+(fd.size/2),(fd.y-(1.2*labelFontSize)), fd.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) renderPDF.drawToFile(D, 'signsandsymbols.pdf', 'signsandsymbols.py') print 'wrote file: signsandsymbols.pdf'
a94ee8176f1eaa19b5cc320daa2067dbafd93acd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/a94ee8176f1eaa19b5cc320daa2067dbafd93acd/signsandsymbols.py
if self.vecttor[index]!=value:
if self.vector[index]!=value:
def __setitem__(self, index, value): if self.vecttor[index]!=value: L = list(self.vector) L[index] = value self.vector = tuple(L)
1fe5c2ca28f1a89e8758aa0785f65e7c5f62e022 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/1fe5c2ca28f1a89e8758aa0785f65e7c5f62e022/pdfmetrics.py
addWidths(fontName, font.getWidths())
def testMetrics(): # load the standard ones: for baseFontName in standardFonts: encoding = WinAnsiEncoding fontName = baseFontName + '-WinAnsi' font = Type1Font(fontName, baseFontName, encoding) addWidths(fontName, font.getWidths()) #test it msg = 'Hello World' w = stringWidth(msg, fontName, 10)# print 'width of "%s" in 10-point %s = %0.2f' % (msg, fontName, w)
1fe5c2ca28f1a89e8758aa0785f65e7c5f62e022 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/1fe5c2ca28f1a89e8758aa0785f65e7c5f62e022/pdfmetrics.py
zenc = SingleByteEncoding('WinAnsiEncoding')
zenc = Encoding('WinAnsiEncoding')
def testFonts(): # make a custom encoded font. import reportlab.pdfgen.canvas c = reportlab.pdfgen.canvas.Canvas('testfonts.pdf') c.setPageCompression(0) c.setFont('Helvetica', 12) c.drawString(100, 700, 'The text below should be in a custom encoding in which all vowels become "z"') # invent a new language where vowels are replaced with letter 'z' zenc = SingleByteEncoding('WinAnsiEncoding') for ch in 'aeiou': zenc[ord(ch)] = 'z' for ch in 'AEIOU': zenc[ord(ch)] = 'Z' f = Type1Font('FontWithoutVowels', 'Helvetica-Oblique', zenc) c.registerFont0(f) c.setFont('FontWithoutVowels', 12) c.drawString(125, 675, "The magic word is squamish ossifrage") # now demonstrate adding a Euro to MacRoman, which lacks one c.setFont('Helvetica', 12) c.drawString(100, 650, "MacRoman encoding lacks a Euro. We'll make a Mac font with the Euro at #219:") # WinAnsi Helvetica c.registerFont0(Type1Font('Helvetica-WinAnsi', 'Helvetica-Oblique', WinAnsiEncoding)) c.setFont('Helvetica-WinAnsi', 12) c.drawString(125, 625, 'WinAnsi with Euro: character 128 = "\200"') c.registerFont0(Type1Font('MacHelvNoEuro', 'Helvetica-Oblique', MacRomanEncoding)) c.setFont('MacHelvNoEuro', 12) c.drawString(125, 600, 'Standard MacRoman, no Euro: Character 219 = "\333"') # oct(219)=0333 # now make our hacked encoding euroMac = SingleByteEncoding('MacRomanEncoding') euroMac[219] = 'Euro' c.registerFont0(Type1Font('MacHelvWithEuro', 'Helvetica-Oblique', euroMac)) c.setFont('MacHelvWithEuro', 12) c.drawString(125, 575, 'Hacked MacRoman with Euro: Character 219 = "\333"') # oct(219)=0333 # now test width setting with and without _rl_accel - harder # make an encoding where 'm' becomes 'i' c.setFont('Helvetica', 12) c.drawString(100, 500, "Recode 'm' to 'i' and check we can measure widths. Boxes should surround letters.") sample = 'Mmmmm. ' * 6 + 'Mmmm' c.setFont('Helvetica-Oblique',12) c.drawString(125, 475, sample) w = c.stringWidth(sample, 'Helvetica-Oblique', 12) c.rect(125, 475, w, 12) narrowEnc = SingleByteEncoding('WinAnsiEncoding') narrowEnc[ord('m')] = 'i' narrowEnc[ord('M')] = 'I' c.registerFont0(Type1Font('narrow', 'Helvetica-Oblique', narrowEnc)) c.setFont('narrow', 12) c.drawString(125, 450, sample) w = c.stringWidth(sample, 'narrow', 12) c.rect(125, 450, w, 12) c.setFont('Helvetica', 12) c.drawString(100, 400, "Symbol & Dingbats fonts - check we still get valid PDF in StandardEncoding") c.setFont('Symbol', 12) c.drawString(100, 375, 'abcdefghijklmn') c.setFont('ZapfDingbats', 12) c.drawString(300, 375, 'abcdefghijklmn') c.save() print 'saved testfonts.pdf'
1fe5c2ca28f1a89e8758aa0785f65e7c5f62e022 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/1fe5c2ca28f1a89e8758aa0785f65e7c5f62e022/pdfmetrics.py