bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def gAdd(t,g=g,fontName=fontName,fontSize=fontSize,fillColor=fillColor): t.fontName = fontName t.fontSize = fontSize t.fillColor = fillColor return g.add(t)
def gAdd(t,g=g,fontName=fontName,fontSize=fontSize,fillColor=fillColor): t.fontName = fontName t.fontSize = fontSize t.fillColor = fillColor return g.add(t)
4,400
def gAdd(t,g=g,fontName=fontName,fontSize=fontSize,fillColor=fillColor): t.fontName = fontName t.fontSize = fontSize t.fillColor = fillColor return g.add(t)
def gAdd(t,g=g,fontName=fontName,fontSize=fontSize,fillColor=fillColor): t.fontName = fontName t.fontSize = fontSize t.fillColor = fillColor return g.add(t)
4,401
def gAdd(t,g=g,fontName=fontName,fontSize=fontSize,fillColor=fillColor): t.fontName = fontName t.fontSize = fontSize t.fillColor = fillColor return g.add(t)
def gAdd(t,g=g,fontName=fontName,fontSize=fontSize,fillColor=fillColor): t.fontName = fontName t.fontSize = fontSize t.fillColor = fillColor return g.add(t)
4,402
def saveAsPresentation(self): """Write the PDF document, one slide per page.""" if self.verbose: print 'saving presentation...' pageSize = (self.pageWidth, self.pageHeight) if self.sourceFilename: filename = os.path.splitext(self.sourceFilename)[0] + '.pdf' if self.outDir: filename = os.path.join(self.outDir,os.path.ba...
def saveAsPresentation(self): """Write the PDF document, one slide per page.""" if self.verbose: print 'saving presentation...' pageSize = (self.pageWidth, self.pageHeight) if self.sourceFilename: filename = os.path.splitext(self.sourceFilename)[0] + '.pdf' if self.outDir: filename = os.path.join(self.outDir,os.path.ba...
4,403
def listAttrs(self): print 'name =', self.name print 'parent =', self.parent keylist = self.defaults.keys() keylist.sort() for key in keylist: value = self.attributes.get(key, None) if value: print '%s = %s (direct)' % (key, value) else: #try for inherited value = getattr(self.parent, key, None) if value: print '%s = %...
def listAttrs(self): print 'name =', self.name print 'parent =', self.parent keylist = self.defaults.keys() keylist.sort() for key in keylist: value = self.attributes.get(key, None) if value: print '%s = %s (direct)' % (key, value) else: #try for inherited value = getattr(self.parent, key, None) if value: print '%s = %...
4,404
def listAttrs(self): print 'name =', self.name print 'parent =', self.parent keylist = self.defaults.keys() keylist.sort() for key in keylist: value = self.attributes.get(key, None) if value: print '%s = %s (direct)' % (key, value) else: #try for inherited value = getattr(self.parent, key, None) if value: print '%s = %...
def listAttrs(self): print 'name =', self.name print 'parent =', self.parent keylist = self.defaults.keys() keylist.sort() for key in keylist: value = self.attributes.get(key, None) if value: print '%s = %s (direct)' % (key, value) else: #try for inherited value = getattr(self.parent, key, None) if value: print '%s = %...
4,405
def prepareCanvas(self, canvas): """You can ask a LineStyle to set up the canvas for drawing the lines.""" canvas.setLineWidth(1) #etc. etc.
def prepareCanvas(self, canvas): """You can ask a LineStyle to set up the canvas for drawing the lines.""" canvas.setLineWidth(1) #etc. etc.
4,406
def __init__(self, text, style, bulletText = None): self.text = cleanBlockQuotedText(text) self.style = style self.bulletText = bulletText self.debug = 0 #turn this on to see a pretty one with all the margins etc.
def __init__(self, text, style, bulletText = None): text = cleanBlockQuotedText(text) self.text = text self.style = style self.bulletText = bulletText self.debug = 0 #turn this on to see a pretty one with all the margins etc.
4,407
def drawPara(self,debug=0): """Draws a paragraph according to the given style. Returns the final y position at the bottom. Not safe for paragraphs without spaces e.g. Japanese; wrapping algorithm will go infinite.""" text = cleanBlockQuotedText(self.text)
def drawPara(self,debug=0): """Draws a paragraph according to the given style. Returns the final y position at the bottom. Not safe for paragraphs without spaces e.g. Japanese; wrapping algorithm will go infinite.""" text = cleanBlockQuotedText(self.text)
4,408
def drawPara(self,debug=0): """Draws a paragraph according to the given style. Returns the final y position at the bottom. Not safe for paragraphs without spaces e.g. Japanese; wrapping algorithm will go infinite.""" text = cleanBlockQuotedText(self.text)
def drawPara(self,debug=0): """Draws a paragraph according to the given style. Returns the final y position at the bottom. Not safe for paragraphs without spaces e.g. Japanese; wrapping algorithm will go infinite.""" text = cleanBlockQuotedText(self.text)
4,409
def drawPara(self,debug=0): """Draws a paragraph according to the given style. Returns the final y position at the bottom. Not safe for paragraphs without spaces e.g. Japanese; wrapping algorithm will go infinite.""" text = cleanBlockQuotedText(self.text)
defdrawPara(self,debug=0):"""Drawsaparagraphaccordingtothegivenstyle.Returnsthefinalypositionatthebottom.Notsafeforparagraphswithoutspacese.g.Japanese;wrappingalgorithmwillgoinfinite."""text=cleanBlockQuotedText(self.text)
4,410
def drawPara(self,debug=0): """Draws a paragraph according to the given style. Returns the final y position at the bottom. Not safe for paragraphs without spaces e.g. Japanese; wrapping algorithm will go infinite.""" text = cleanBlockQuotedText(self.text)
def drawPara(self,debug=0): """Draws a paragraph according to the given style. Returns the final y position at the bottom. Not safe for paragraphs without spaces e.g. Japanese; wrapping algorithm will go infinite.""" text = cleanBlockQuotedText(self.text)
4,411
def drawPara(self,debug=0): """Draws a paragraph according to the given style. Returns the final y position at the bottom. Not safe for paragraphs without spaces e.g. Japanese; wrapping algorithm will go infinite.""" text = cleanBlockQuotedText(self.text)
def drawPara(self,debug=0): """Draws a paragraph according to the given style. Returns the final y position at the bottom. Not safe for paragraphs without spaces e.g. Japanese; wrapping algorithm will go infinite.""" text = cleanBlockQuotedText(self.text)
4,412
def drawPara(self,debug=0): """Draws a paragraph according to the given style. Returns the final y position at the bottom. Not safe for paragraphs without spaces e.g. Japanese; wrapping algorithm will go infinite.""" text = cleanBlockQuotedText(self.text)
defdrawPara(self,debug=0):"""Drawsaparagraphaccordingtothegivenstyle.Returnsthefinalypositionatthebottom.Notsafeforparagraphswithoutspacese.g.Japanese;wrappingalgorithmwillgoinfinite."""text=cleanBlockQuotedText(self.text)
4,413
def __init__(self, text, style, bulletText = None, dedent=0): self.style = style self.bulletText = bulletText
def __init__(self, text, style, bulletText = None, dedent=0): self.style = style self.bulletText = bulletText
4,414
def draw(self): #call another method for historical reasons. Besides, I #suspect I will be playing with alternate drawing routines #so not doing it here makes it easier to switch.
def draw(self): #call another method for historical reasons. Besides, I #suspect I will be playing with alternate drawing routines #so not doing it here makes it easier to switch.
4,415
def myFirstPage(canvas, doc): canvas.saveState() canvas.setStrokeColorRGB(1,0,0) canvas.setLineWidth(5) canvas.line(66,72,66,PAGE_HEIGHT-72) canvas.setFont('Times-Bold',24) canvas.drawString(108, PAGE_HEIGHT-108, "PLATYPUS") canvas.setFont('Times-Roman',12) canvas.drawString(4 * inch, 0.75 * inch, "First Page") canvas....
def myFirstPage(canvas, doc): canvas.saveState() canvas.setStrokeColor(red) canvas.setLineWidth(5) canvas.line(66,72,66,PAGE_HEIGHT-72) canvas.setFont('Times-Bold',24) canvas.drawString(108, PAGE_HEIGHT-108, "PLATYPUS") canvas.setFont('Times-Roman',12) canvas.drawString(4 * inch, 0.75 * inch, "First Page") canvas.resto...
4,416
def myLaterPages(canvas, doc): #canvas.drawImage("snkanim.gif", 36, 36) canvas.saveState() canvas.setStrokeColorRGB(1,0,0) canvas.setLineWidth(5) canvas.line(66,72,66,PAGE_HEIGHT-72) canvas.setFont('Times-Roman',12) canvas.drawString(4 * inch, 0.75 * inch, "Page %d" % doc.page) canvas.restoreState()
def myLaterPages(canvas, doc): #canvas.drawImage("snkanim.gif", 36, 36) canvas.saveState() canvas.setStrokeColor(red) canvas.setLineWidth(5) canvas.line(66,72,66,PAGE_HEIGHT-72) canvas.setFont('Times-Roman',12) canvas.drawString(4 * inch, 0.75 * inch, "Page %d" % doc.page) canvas.restoreState()
4,417
def save(self, formats=None, verbose=None, fnRoot=None, outDir=None): "Saves copies of self in desired location and formats" ext = '' if not fnRoot: fnRoot = getattr(self,'fileNamePattern',(self.__class__.__name__+'%03d') try: fnRoot = % getattr(self,'chartId',0) except TypeError, err: if err != 'not all arguments conv...
def save(self, formats=None, verbose=None, fnRoot=None, outDir=None): "Saves copies of self in desired location and formats" ext = '' if not fnRoot: fnRoot = getattr(self,'fileNamePattern',(self.__class__.__name__+'%03d')) try: fnRoot = % getattr(self,'chartId',0) except TypeError, err: if err != 'not all arguments con...
4,418
def save(self, formats=None, verbose=None, fnRoot=None, outDir=None): "Saves copies of self in desired location and formats" ext = '' if not fnRoot: fnRoot = getattr(self,'fileNamePattern',(self.__class__.__name__+'%03d') try: fnRoot = % getattr(self,'chartId',0) except TypeError, err: if err != 'not all arguments conv...
def save(self, formats=None, verbose=None, fnRoot=None, outDir=None): "Saves copies of self in desired location and formats" ext = '' if not fnRoot: fnRoot = getattr(self,'fileNamePattern',(self.__class__.__name__+'%03d') try: fnRoot = fnRoot % getattr(self,'chartId',0) except TypeError, err: if err != 'not all argumen...
4,419
def save(self, formats=None, verbose=None, fnRoot=None, outDir=None): "Saves copies of self in desired location and formats" ext = '' if not fnRoot: fnRoot = getattr(self,'fileNamePattern',(self.__class__.__name__+'%03d') try: fnRoot = % getattr(self,'chartId',0) except TypeError, err: if err != 'not all arguments conv...
def save(self, formats=None, verbose=None, fnRoot=None, outDir=None): "Saves copies of self in desired location and formats" ext = '' if not fnRoot: fnRoot = getattr(self,'fileNamePattern',(self.__class__.__name__+'%03d') try: fnRoot = % getattr(self,'chartId',0) except TypeError, err: if err != 'not all arguments conv...
4,420
def stringWidth(self, text, size, encoding='utf-8'): "Calculate text width" if type(text) is not UnicodeType: text = unicode(text, encoding or 'utf-8') # encoding defaults to utf-8 width = lambda x,f=self.face.getCharWidth: f(ord(x)) return 0.001 * reduce(operator_add,map(width,text)) * size
def stringWidth(self, text, size, encoding='utf-8'): "Calculate text width" if type(text) is not UnicodeType: text = unicode(text, encoding or 'utf-8') # encoding defaults to utf-8 width = lambda x,f=self.face.getCharWidth: f(ord(x)) return 0.001 * reduce(operator_add,map(width,text)) * size
4,421
def __init__(self, data, colWidths=None, rowHeights=None, style=None, repeatRows=0, repeatCols=0, splitByRow=1): #print "colWidths", colWidths self.hAlign = 'CENTER' self._nrows = nrows = len(data) if len(data)==0 or type(data) not in _SeqTypes: raise ValueError, "%s must have at least 1 row" % self.identity() ncols = ...
def __init__(self, data, colWidths=None, rowHeights=None, style=None, repeatRows=0, repeatCols=0, splitByRow=1): #print "colWidths", colWidths self.hAlign = 'CENTER' self._nrows = nrows = len(data) if len(data)==0 or type(data) not in _SeqTypes: raise ValueError, "%s must have at least 1 row" % self.identity() ncols = ...
4,422
def PIL_imagedata(self): lib = import_zlib() if not zlib: return image = self.image myimage = image.convert('RGB') imgwidth, imgheight = myimage.size
def PIL_imagedata(self): zlib = import_zlib() if not zlib: return image = self.image myimage = image.convert('RGB') imgwidth, imgheight = myimage.size
4,423
def _loadGlyphs(self, pfbFileName): """Loads in binary glyph data, and finds the four length measurements needed for the font descriptor""" assert os.path.isfile(pfbFileName), 'file %s not found' % pfbFileName rawdata = open(pfbFileName, 'rb').read() self._binaryData = rawdata firstPS = string.find(rawdata, '%!PS') sel...
def _loadGlyphs(self, pfbFileName): """Loads in binary glyph data, and finds the four length measurements needed for the font descriptor""" assert os.path.isfile(pfbFileName), 'file %s not found' % pfbFileName rawdata = open(pfbFileName, 'rb').read() self._binaryData = rawdata firstPS = string.find(rawdata, '%!PS') sel...
4,424
def addObjects(self, doc): """Add whatever needed to PDF file, and return a FontDescriptor reference""" from reportlab.pdfbase import pdfdoc
def addObjects(self, doc): """Add whatever needed to PDF file, and return a FontDescriptor reference""" from reportlab.pdfbase import pdfdoc
4,425
def circle(self, x_cen, y_cen, r): """adds a circle to the path""" x1 = x_cen - r x2 = x_cen + r y1 = y_cen - r y2 = y_cen + r self.ellipse(x_cen - r, y_cen - r, x_cen + r, y_cen + r)
def circle(self, x_cen, y_cen, r): """adds a circle to the path""" x1 = x_cen - r y1 = y_cen - r y2 = y_cen + r self.ellipse(x_cen - r, y_cen - r, x_cen + r, y_cen + r)
4,426
def circle(self, x_cen, y_cen, r): """adds a circle to the path""" x1 = x_cen - r x2 = x_cen + r y1 = y_cen - r y2 = y_cen + r self.ellipse(x_cen - r, y_cen - r, x_cen + r, y_cen + r)
def circle(self, x_cen, y_cen, r): """adds a circle to the path""" x1 = x_cen - r x2 = x_cen + r y1 = y_cen - r width = height = 2*r self.ellipse(x1, y1, width, height)
4,427
def recursiveImport(modulename, baseDir=None): """Dynamically imports possible packagized module, or raises ImportError""" import imp parts = string.split(modulename, '.') part = parts[0] path = list(baseDir and (type(baseDir) not in SeqTypes and [baseDir] or filter(None,baseDir)) or None) if '.' not in path: path.inse...
def recursiveImport(modulename, baseDir=None, noCWD=0): """Dynamically imports possible packagized module, or raises ImportError""" import imp parts = string.split(modulename, '.') part = parts[0] path = list(baseDir and (type(baseDir) not in SeqTypes and [baseDir] or filter(None,baseDir)) or None) if '.' not in path: ...
4,428
def recursiveImport(modulename, baseDir=None): """Dynamically imports possible packagized module, or raises ImportError""" import imp parts = string.split(modulename, '.') part = parts[0] path = list(baseDir and (type(baseDir) not in SeqTypes and [baseDir] or filter(None,baseDir)) or None) if '.' not in path: path.inse...
def recursiveImport(modulename, baseDir=None): """Dynamically imports possible packagized module, or raises ImportError""" import imp parts = string.split(modulename, '.') part = parts[0] path = list(baseDir and (type(baseDir) not in SeqTypes and [baseDir] or filter(None,baseDir)) or None) if not noCWD and '.' not in p...
4,429
def kill(f): 'remove directory or file unconditionally' if os.path.isfile(f): os.remove(f) elif os.path.isdir(f): rmdir(f) elif '*' in f: map(kill,glob.glob(f))
def kill(f): 'remove directory or file unconditionally' if '*' in f: map(kill,glob.glob(f)) else: if verbose>=2: print 'kill(%s)' % f if os.path.isfile(f): os.remove(f) elif os.path.isdir(f): rmdir(f)
4,430
def copy(src,dst): if os.path.isdir(dst): dst = os.path.join(dst,os.path.basename(src)) if os.path.isfile(dst): kill(dst) if os.path.isfile(src): shutil.copy2(src,dst) elif os.path.isdir(src): shutil.copyTree(src,dst) elif '*' in src: map(lambda f,dst=dst: copy(f,dst),glob.glob(src))
def copy(src,dst): if '*' in src: map(lambda f,dst=dst: copy(f,dst),glob.glob(src)) else: if os.path.isdir(dst): dst = os.path.join(dst,os.path.basename(src)) if verbose>=2: print 'copy(%s,%s)' % (src,dst) if os.path.isfile(src): remove(dst) shutil.copy2(src,dst) elif os.path.isdir(src): shutil.copyTree(src,dst)
4,431
def cvs_checkout(d): os.chdir(d) cvsdir = os.path.join(d,projdir) rmdir(cvsdir) rmdir('docs') cvs = find_exe('cvs') python = find_exe('python') if cvs is None: os.exit(1) os.environ['CVSROOT']=':pserver:%s@cvs.reportlab.sourceforge.net:/cvsroot/reportlab' % USER if release: do_exec(cvs+(' export -r %s %s' % (tagname,...
def cvs_checkout(d): os.chdir(d) cvsdir = os.path.join(d,projdir) rmdir(cvsdir) rmdir('docs') cvs = find_exe('cvs') python = find_exe('python') if cvs is None: os.exit(1) os.environ['CVSROOT']=':pserver:%s@cvs.reportlab.sourceforge.net:/cvsroot/reportlab' % USER if release: do_exec(cvs+(' export -r %s %s' % (tagname,...
4,432
def cvs_checkout(d): os.chdir(d) cvsdir = os.path.join(d,projdir) rmdir(cvsdir) rmdir('docs') cvs = find_exe('cvs') python = find_exe('python') if cvs is None: os.exit(1) os.environ['CVSROOT']=':pserver:%s@cvs.reportlab.sourceforge.net:/cvsroot/reportlab' % USER if release: do_exec(cvs+(' export -r %s %s' % (tagname,...
def cvs_checkout(d): os.chdir(d) cvsdir = os.path.join(d,projdir) rmdir(cvsdir) rmdir('docs') cvs = find_exe('cvs') python = find_exe('python') if cvs is None: os.exit(1) os.environ['CVSROOT']=':pserver:%s@cvs.reportlab.sourceforge.net:/cvsroot/reportlab' % USER if release: do_exec(cvs+(' export -r %s %s' % (tagname,...
4,433
def makeBackground(self): g = Group() g.add(Rect(self.x, self.y, self.width, self.height, strokeColor = self.strokeColor, fillColor= self.fillColor)) return g
def makeBackground(self): g = Group() g.add(Rect(self.x, self.y, self.width, self.height, strokeColor = self.strokeColor, fillColor= self.fillColor)) return g
4,434
def save(self, file): file.write(self.template % (self.keyname, self.fontname, self.encoding) + LINEEND)
def save(self, file): file.write(self.template % (self.keyname, self.fontname, self.encoding) + LINEEND)
4,435
def save(self, file): file.write(self.template % (self.keyname, self.fontname, self.encoding) + LINEEND)
defsave(self,file):file.write(self.template%(self.keyname,self.fontname,self.encoding)+LINEEND)
4,436
def MakeType1Fonts(encoding): "returns a list of all the standard font objects" fonts = [] pos = 1 for fontname in StandardEnglishFonts: #Symbol is almost empty in WinAnsi, no choice! if fontname in ['Symbol', 'ZapfDingbats']: encUsed = 'MacRomanEncoding' else: encUsed = encoding font = PDFType1Font('F'+str(pos), fontn...
def MakeType1Fonts(encoding): "returns a list of all the standard font objects" fonts = [] pos = 1 for fontname in StandardEnglishFonts: #Symbol is almost empty in WinAnsi, no choice! if fontname in ['Symbol', 'ZapfDingbats']: encUsed = 'MacRomanEncoding' else: encUsed = encoding font = PDFType1Font('F'+str(pos), fontn...
4,437
def MakeType1Fonts(encoding): "returns a list of all the standard font objects" fonts = [] pos = 1 for fontname in StandardEnglishFonts: #Symbol is almost empty in WinAnsi, no choice! if fontname in ['Symbol', 'ZapfDingbats']: encUsed = 'MacRomanEncoding' else: encUsed = encoding font = PDFType1Font('F'+str(pos), fontn...
def MakeType1Fonts(encoding): "returns a list of all the standard font objects" fonts = [] pos = 1 for fontname in StandardEnglishFonts: #Symbol is almost empty in WinAnsi, no choice! if fontname in ['Symbol', 'ZapfDingbats']: encUsed = 'StandardEncoding' else: encUsed = encoding font = PDFType1Font('F'+str(pos), fontn...
4,438
def makeInnerTiles(self): # inner grid lines group = Group()
def makeInnerTiles(self): # inner grid lines group = Group()
4,439
def demo(self): D = Drawing(100, 100)
def demo(self): D = Drawing(100, 100)
4,440
def _flipRectCorners(self): "Flip rectangle's corners if width or height is negative." if self.width < 0: self.x = self.x + self.width self.width = -self.width if self.orientation == 'vertical': self.fillColorStart, self.fillColorEnd = self.fillColorEnd, self.fillColorStart
def _flipRectCorners(self): "Flip rectangle's corners if width or height is negative." if self.width < 0 and self.height > 0: self.x = self.x + self.width self.width = -self.width if self.orientation == 'vertical': self.fillColorStart, self.fillColorEnd = self.fillColorEnd, self.fillColorStart
4,441
def _flipRectCorners(self): "Flip rectangle's corners if width or height is negative." if self.width < 0: self.x = self.x + self.width self.width = -self.width if self.orientation == 'vertical': self.fillColorStart, self.fillColorEnd = self.fillColorEnd, self.fillColorStart
def _flipRectCorners(self): "Flip rectangle's corners if width or height is negative." if self.width < 0: self.x = self.x + self.width self.width = -self.width if self.orientation == 'vertical': self.fillColorStart, self.fillColorEnd = self.fillColorEnd, self.fillColorStart
4,442
def draw(self): # general widget bits group = Group()
def draw(self): # general widget bits group = Group()
4,443
def test(): D = Drawing(450, 650) d = 80 s = 60 for row in range(10): y = 530 - row*d if row == 0: for col in range(3): x = 20 + col*d g = Grid0() g.x = x g.y = y g.width = s g.height = s g.useRects = 0 g.useLines = 1 if col == 0: pass elif col == 1: g.delta0 = 10 elif col == 2: g.orientation = 'horizontal' g.demo() ...
def test(): D = Drawing(450, 650) d = 80 s = 60 for row in range(10): y = 530 - row*d if row == 0: for col in range(3): x = 20 + col*d g = Grid0() g.x = x g.y = y g.width = s g.height = s g.useRects = 0 g.useLines = 1 if col == 0: pass elif col == 1: g.delta0 = 10 elif col == 2: g.orientation = 'horizontal' g.demo() ...
4,444
def test(): D = Drawing(450, 650) d = 80 s = 60 for row in range(10): y = 530 - row*d if row == 0: for col in range(3): x = 20 + col*d g = Grid0() g.x = x g.y = y g.width = s g.height = s g.useRects = 0 g.useLines = 1 if col == 0: pass elif col == 1: g.delta0 = 10 elif col == 2: g.orientation = 'horizontal' g.demo() ...
def test(): D = Drawing(450, 650) d = 80 s = 60 for row in range(10): y = 530 - row*d if row == 0: for col in range(3): x = 20 + col*d g = Grid0() g.x = x g.y = y g.width = s g.height = s g.useRects = 0 g.useLines = 1 if col == 0: pass elif col == 1: g.delta0 = 10 elif col == 2: g.orientation = 'horizontal' g.demo() ...
4,445
def test(): #grab all drawings from the test module and write out. #make a page of links in HTML to assist viewing. import os from reportlab.graphics import testshapes drawings = [] if not os.path.isdir('pmout'): os.mkdir('pmout') htmlTop = """<html><head><title>renderGD output results</title></head> <body> <h1>renderP...
def test(): #grab all drawings from the test module and write out. #make a page of links in HTML to assist viewing. import os from reportlab.graphics import testshapes drawings = [] if not os.path.isdir('pmout'): os.mkdir('pmout') htmlTop = """<html><head><title>renderGD output results</title></head> <body> <h1>renderP...
4,446
def _drawCell(self, cellval, cellstyle, (colpos, rowpos), (colwidth, rowheight)): if self._curcellstyle is not cellstyle: cur = self._curcellstyle if cur is None or cellstyle.color != cur.color: self.canv.setFillColor(cellstyle.color) if cur is None or cellstyle.leading != cur.leading or cellstyle.fontname != cur.fontn...
def _drawCell(self, cellval, cellstyle, (colpos, rowpos), (colwidth, rowheight)): if self._curcellstyle is not cellstyle: cur = self._curcellstyle if cur is None or cellstyle.color != cur.color: self.canv.setFillColor(cellstyle.color) if cur is None or cellstyle.leading != cur.leading or cellstyle.fontname != cur.fontn...
4,447
def __init__(self, fileName): if not haveImages: warnOnce('Imaging Library not available, unable to import bitmaps') return #start wih lots of null private fields, to be populated by #the relevant engine. self.fileName = fileName self._image = None self._width = None self._height = None self._transparent = None self._d...
def __init__(self, fileName): if not haveImages: warnOnce('Imaging Library not available, unable to import bitmaps') return #start wih lots of null private fields, to be populated by #the relevant engine. self.fileName = fileName self._image = None self._width = None self._height = None self._transparent = None self._d...
4,448
def __init__(self, fileName): if not haveImages: warnOnce('Imaging Library not available, unable to import bitmaps') return #start wih lots of null private fields, to be populated by #the relevant engine. self.fileName = fileName self._image = None self._width = None self._height = None self._transparent = None self._d...
def __init__(self, fileName): if not haveImages: warnOnce('Imaging Library not available, unable to import bitmaps') return #start wih lots of null private fields, to be populated by #the relevant engine. self.fileName = fileName self._image = None self._width = None self._height = None self._transparent = None self._d...
4,449
def getRGBData(self): "Return byte array of RGB data as string" if self._data is None: if sys.platform[0:4] == 'java': import jarray from java.awt.image import PixelGrabber width, height = self.getSize() buffer = jarray.zeros(width*height, 'i') pg = PixelGrabber(self._image, 0,0,width,height,buffer,0,width) pg.grabPixe...
def getRGBData(self): "Return byte array of RGB data as string" if self._data is None: if sys.platform[0:4] == 'java': import jarray from java.awt.image import PixelGrabber width, height = self.getSize() buffer = jarray.zeros(width*height, 'i') pg = PixelGrabber(self._image, 0,0,width,height,buffer,0,width) pg.grabPixe...
4,450
def breakLines(self, width): """ Returns a broken line structure. There are two cases A) For the simple case of a single formatting input fragment the output is A fragment specifier with kind = 0 fontName, fontSize, leading, textColor lines= A list of lines Each line has two items. 1) unused width in points 2) word li...
def breakLines(self, width): """ Returns a broken line structure. There are two cases A) For the simple case of a single formatting input fragment the output is A fragment specifier with kind = 0 fontName, fontSize, leading, textColor lines= A list of lines Each line has two items. 1) unused width in points 2) word li...
4,451
def breakLines(self, width): """ Returns a broken line structure. There are two cases A) For the simple case of a single formatting input fragment the output is A fragment specifier with kind = 0 fontName, fontSize, leading, textColor lines= A list of lines Each line has two items. 1) unused width in points 2) word li...
def breakLines(self, width): """ Returns a broken line structure. There are two cases A) For the simple case of a single formatting input fragment the output is A fragment specifier with kind = 0 fontName, fontSize, leading, textColor lines= A list of lines Each line has two items. 1) unused width in points 2) word li...
4,452
def breakLines(self, width): """ Returns a broken line structure. There are two cases A) For the simple case of a single formatting input fragment the output is A fragment specifier with kind = 0 fontName, fontSize, leading, textColor lines= A list of lines Each line has two items. 1) unused width in points 2) word li...
def breakLines(self, width): """ Returns a broken line structure. There are two cases A) For the simple case of a single formatting input fragment the output is A fragment specifier with kind = 0 fontName, fontSize, leading, textColor lines= A list of lines Each line has two items. 1) unused width in points 2) word li...
4,453
def breakLines(self, width): """ Returns a broken line structure. There are two cases A) For the simple case of a single formatting input fragment the output is A fragment specifier with kind = 0 fontName, fontSize, leading, textColor lines= A list of lines Each line has two items. 1) unused width in points 2) word li...
def breakLines(self, width): """ Returns a broken line structure. There are two cases A) For the simple case of a single formatting input fragment the output is A fragment specifier with kind = 0 fontName, fontSize, leading, textColor lines= A list of lines Each line has two items. 1) unused width in points 2) word li...
4,454
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,...
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,...
4,455
def setFillColor(self, aColor): """Takes a color object, allowing colors to be referred to by name""" if isinstance(aColor, CMYKColor): c,m,y,k = (aColor.cyan, aColor.magenta, aColor.yellow, aColor.black) self._fillColorCMYK = (c, m, y, k) self._code.append('%s k' % fp_str(c, m, y, k)) elif isinstance(aColor, Color): #...
def setFillColor(self, aColor): """Takes a color object, allowing colors to be referred to by name""" if isinstance(aColor, CMYKColor): c,m,y,k = (aColor.cyan, aColor.magenta, aColor.yellow, aColor.black) self._fillColorCMYK = (c, m, y, k) self._code.append('%s k' % fp_str(c, m, y, k)) elif isinstance(aColor, Color): #...
4,456
def setStrokeColor(self, aColor): """Takes a color object, allowing colors to be referred to by name""" if isinstance(aColor, CMYKColor): c,m,y,k = (aColor.cyan, aColor.magenta, aColor.yellow, aColor.black) self._strokeColorCMYK = (c, m, y, k) self._code.append('%s K' % fp_str(c, m, y, k)) elif isinstance(aColor, Color...
def setStrokeColor(self, aColor): """Takes a color object, allowing colors to be referred to by name""" if isinstance(aColor, CMYKColor): c,m,y,k = (aColor.cyan, aColor.magenta, aColor.yellow, aColor.black) self._strokeColorCMYK = (c, m, y, k) self._code.append('%s K' % fp_str(c, m, y, k)) elif isinstance(aColor, Color...
4,457
def setStrokeColor(self, aColor): """Takes a color object, allowing colors to be referred to by name""" if isinstance(aColor, CMYKColor): c,m,y,k = (aColor.cyan, aColor.magenta, aColor.yellow, aColor.black) self._strokeColorCMYK = (c, m, y, k) self._code.append('%s K' % fp_str(c, m, y, k)) elif isinstance(aColor, Color...
def setStrokeColor(self, aColor): """Takes a color object, allowing colors to be referred to by name""" if isinstance(aColor, CMYKColor): c,m,y,k = (aColor.cyan, aColor.magenta, aColor.yellow, aColor.black) self._strokeColorCMYK = (c, m, y, k) self._code.append('%s K' % fp_str(c, m, y, k)) elif isinstance(aColor, Color...
4,458
def start_font(self,attr): A = {} for i, j in self._fontAttrMap.items(): if attr.has_key(i): func = j[1] val = attr[i] try: A[j[0]] = (func is None) and val or apply(func,(val,)) except: self.syntax_error('%s: invalid value %s'%(i,val)) apply(self._push,(),A)
def start_font(self,attr): A = {} for i, j in self._fontAttrMap.items(): if attr.has_key(i): func = j[1] val = attr[i] try: A[j[0]] = (func is None) and val or apply(func,(val,)) except: self.syntax_error('%s: invalid value %s'%(i,val)) apply(self._push,(),A)
4,459
def parse(self, text, style): """Given a formatted string will return a list of ParaFrag objects with their calculated widths. If errors occur None will be returned and the self.errors holds a list of the error messages. """
def parse(self, text, style): """Given a formatted string will return a list of ParaFrag objects with their calculated widths. If errors occur None will be returned and the self.errors holds a list of the error messages. """
4,460
def parse(self, text, style): """Given a formatted string will return a list of ParaFrag objects with their calculated widths. If errors occur None will be returned and the self.errors holds a list of the error messages. """
def parse(self, text, style): """Given a formatted string will return a list of ParaFrag objects with their calculated widths. If errors occur None will be returned and the self.errors holds a list of the error messages. """
4,461
def draw(self): nudge = 0.5 * (self.availWidth - self._width) self.canv.translate(nudge, 0) self._drawBkgrnd() self._drawLines() for row, rowstyle, rowpos, rowheight in map(None, self._cellvalues, self._cellStyles, self._rowpositions[1:], self._rowHeights): for cellval, cellstyle, colpos, colwidth in map(None, row, row...
def draw(self): nudge = 0.5 * (self.availWidth - self._width) if DO_NUDGE: self.canv.translate(nudge, 0) OLD_DO_NUDGE = DO_NUDGE DO_NUDGE = 0 self._drawBkgrnd() self._drawLines() for row, rowstyle, rowpos, rowheight in map(None, self._cellvalues, self._cellStyles, self._rowpositions[1:], self._rowHeights): for cellval,...
4,462
def _AsciiBase85Decode(input): """This is not used - Acrobat Reader decodes for you - but a round trip is essential for testing.""" outstream = cStringIO.StringIO() #strip all whitespace stripped = string.join(string.split(input),'') #check end assert stripped[-2:] == '~>', 'Invalid terminator for Ascii Base 85 Stream'...
def _AsciiBase85Decode(input): """This is not used - Acrobat Reader decodes for you - but a round trip is essential for testing.""" outstream = cStringIO.StringIO() #strip all whitespace stripped = string.join(string.split(input),'') #check end assert stripped[-2:] == '~>', 'Invalid terminator for Ascii Base 85 Stream'...
4,463
def _AsciiBase85Decode(input): """This is not used - Acrobat Reader decodes for you - but a round trip is essential for testing.""" outstream = cStringIO.StringIO() #strip all whitespace stripped = string.join(string.split(input),'') #check end assert stripped[-2:] == '~>', 'Invalid terminator for Ascii Base 85 Stream'...
def _AsciiBase85Decode(input): """This is not used - Acrobat Reader decodes for you - but a round trip is essential for testing.""" outstream = cStringIO.StringIO() #strip all whitespace stripped = string.join(string.split(input),'') #check end assert stripped[-2:] == '~>', 'Invalid terminator for Ascii Base 85 Stream'...
4,464
def _AsciiBase85Decode(input): """This is not used - Acrobat Reader decodes for you - but a round trip is essential for testing.""" outstream = cStringIO.StringIO() #strip all whitespace stripped = string.join(string.split(input),'') #check end assert stripped[-2:] == '~>', 'Invalid terminator for Ascii Base 85 Stream'...
def _AsciiBase85Decode(input): """This is not used - Acrobat Reader decodes for you - but a round trip is essential for testing.""" outstream = cStringIO.StringIO() #strip all whitespace stripped = string.join(string.split(input),'') #check end assert stripped[-2:] == '~>', 'Invalid terminator for Ascii Base 85 Stream'...
4,465
def _AsciiBase85Decode(input): """This is not used - Acrobat Reader decodes for you - but a round trip is essential for testing.""" outstream = cStringIO.StringIO() #strip all whitespace stripped = string.join(string.split(input),'') #check end assert stripped[-2:] == '~>', 'Invalid terminator for Ascii Base 85 Stream'...
def _AsciiBase85Decode(input): """This is not used - Acrobat Reader decodes for you - but a round trip is essential for testing.""" outstream = cStringIO.StringIO() #strip all whitespace stripped = string.join(string.split(input),'') #check end assert stripped[-2:] == '~>', 'Invalid terminator for Ascii Base 85 Stream'...
4,466
def rotate(angle): a = angle * pi /180 return (cos(a), sin(a), -sin(a), cos(a), 0, 0)
def rotate(angle): a = angle * pi/180 return (cos(a), sin(a), -sin(a), cos(a), 0, 0)
4,467
def skewX(angle): a = angle * 180 / pi return (1, 0, tan(a), 1, 0, 0)
def skewX(angle): a = angle * pi/180 return (1, 0, tan(a), 1, 0, 0)
4,468
def skewY(angle): a = angle * 180 / pi return (1, tan(a), 0, 1, 0, 0)
def skewY(angle): a = angle * pi/180 return (1, tan(a), 0, 1, 0, 0)
4,469
def _drawCell(self, cellval, cellstyle, (colpos, rowpos), (colwidth, rowheight)): if self._curcellstyle is not cellstyle: cur = self._curcellstyle if cur is None or cellstyle.color != cur.color: self.canv.setFillColor(cellstyle.color) if cur is None or cellstyle.leading != cur.leading or cellstyle.fontname != cur.fontn...
def _drawCell(self, cellval, cellstyle, (colpos, rowpos), (colwidth, rowheight)): if self._curcellstyle is not cellstyle: cur = self._curcellstyle if cur is None or cellstyle.color != cur.color: self.canv.setFillColor(cellstyle.color) if cur is None or cellstyle.leading != cur.leading or cellstyle.fontname != cur.fontn...
4,470
def _drawCell(self, cellval, cellstyle, (colpos, rowpos), (colwidth, rowheight)): if self._curcellstyle is not cellstyle: cur = self._curcellstyle if cur is None or cellstyle.color != cur.color: self.canv.setFillColor(cellstyle.color) if cur is None or cellstyle.leading != cur.leading or cellstyle.fontname != cur.fontn...
def _drawCell(self, cellval, cellstyle, (colpos, rowpos), (colwidth, rowheight)): if self._curcellstyle is not cellstyle: cur = self._curcellstyle if cur is None or cellstyle.color != cur.color: self.canv.setFillColor(cellstyle.color) if cur is None or cellstyle.leading != cur.leading or cellstyle.fontname != cur.fontn...
4,471
def _drawCell(self, cellval, cellstyle, (colpos, rowpos), (colwidth, rowheight)): if self._curcellstyle is not cellstyle: cur = self._curcellstyle if cur is None or cellstyle.color != cur.color: self.canv.setFillColor(cellstyle.color) if cur is None or cellstyle.leading != cur.leading or cellstyle.fontname != cur.fontn...
def _drawCell(self, cellval, cellstyle, (colpos, rowpos), (colwidth, rowheight)): if self._curcellstyle is not cellstyle: cur = self._curcellstyle if cur is None or cellstyle.color != cur.color: self.canv.setFillColor(cellstyle.color) if cur is None or cellstyle.leading != cur.leading or cellstyle.fontname != cur.fontn...
4,472
def _drawCell(self, cellval, cellstyle, (colpos, rowpos), (colwidth, rowheight)): if self._curcellstyle is not cellstyle: cur = self._curcellstyle if cur is None or cellstyle.color != cur.color: self.canv.setFillColor(cellstyle.color) if cur is None or cellstyle.leading != cur.leading or cellstyle.fontname != cur.fontn...
def _drawCell(self, cellval, cellstyle, (colpos, rowpos), (colwidth, rowheight)): if self._curcellstyle is not cellstyle: cur = self._curcellstyle if cur is None or cellstyle.color != cur.color: self.canv.setFillColor(cellstyle.color) if cur is None or cellstyle.leading != cur.leading or cellstyle.fontname != cur.fontn...
4,473
def multiBuild(self, story, filename=None, canvasmaker=canvas.Canvas, maxPasses = 10): """Makes multiple passes until all indexing flowables are happy.""" self._indexingFlowables = [] #scan the story and keep a copy for thing in story: if thing.isIndexing(): self._indexingFlowables.append(thing) #print 'scanned story, ...
def multiBuild(self, story, filename=None, canvasmaker=canvas.Canvas, maxPasses = 10): """Makes multiple passes until all indexing flowables are happy.""" self._indexingFlowables = [] #scan the story and keep a copy for thing in story: if thing.isIndexing(): self._indexingFlowables.append(thing) #print 'scanned story, ...
4,474
def close(self): pass
def close(self): pass
4,475
def close(self): pass
def close(self): pass
4,476
def add(self, drawable): """ Draws the object at the current position. Returns 1 if successful, 0 if it would not fit. Raises a LayoutError if the object is too wide, or if it is too high for a totally empty frame, to avoid infinite loops""" w, h = drawable.wrap(self.width, self.y - self.bottomMargin - self.bottomPaddi...
def add(self, drawable): """ Draws the object at the current position. Returns 1 if successful, 0 if it would not fit. Raises a LayoutError if the object is too wide, or if it is too high for a totally empty frame, to avoid infinite loops""" w, h = drawable.wrap(self.width, self.y - self.bottomMargin - self.bottomPaddi...
4,477
def add(self, drawable): """ Draws the object at the current position. Returns 1 if successful, 0 if it would not fit. Raises a LayoutError if the object is too wide, or if it is too high for a totally empty frame, to avoid infinite loops""" w, h = drawable.wrap(self.width, self.y - self.bottomMargin - self.bottomPaddi...
def add(self, drawable): """ Draws the object at the current position. Returns 1 if successful, 0 if it would not fit. Raises a LayoutError if the object is too wide, or if it is too high for a totally empty frame, to avoid infinite loops""" w, h = drawable.wrap(self.width, self.y - self.bottomMargin - self.bottomPaddi...
4,478
def add(self, drawable): """ Draws the object at the current position. Returns 1 if successful, 0 if it would not fit. Raises a LayoutError if the object is too wide, or if it is too high for a totally empty frame, to avoid infinite loops""" w, h = drawable.wrap(self.width, self.y - self.bottomMargin - self.bottomPaddi...
def add(self, drawable): """ Draws the object at the current position. Returns 1 if successful, 0 if it would not fit. Raises a LayoutError if the object is too wide, or if it is too high for a totally empty frame, to avoid infinite loops""" w, h = drawable.wrap(self.width, self.y - self.bottomMargin - self.bottomPaddi...
4,479
def makeTickLabels(self): g = Group()
def makeTickLabels(self): g = Group()
4,480
def fp_str(*a): if len(a)==1 and type(a[0]) in SeqTypes: a = a[0] s = [] for i in a: s.append('%0.2f' % i) return string.join(s)
def fp_str(*a): if len(a)==1 and type(a[0]) in SeqTypes: a = a[0] s = [] for i in a: s.append('%0.6f' % i) return string.join(s)
4,481
def setPosition(self, x, y, length): # ensure floating point self._x = x * 1.0 self._y = y * 1.0 self._length = length * 1.0
def setPosition(self, x, y, length): # ensure floating point self._x = x * 1.0 self._y = y * 1.0 self._length = length * 1.0
4,482
def getSubsetInternalName(self, subset, doc): '''Returns the name of a PDF Font object corresponding to a given subset of this dynamic font. Use this function instead of PDFDocument.getInternalFontName.'''
def getSubsetInternalName(self, subset, doc): '''Returns the name of a PDF Font object corresponding to a given subset of this dynamic font. Use this function instead of PDFDocument.getInternalFontName.'''
4,483
def latin1_to_utf8(text): "helper to convert when needed from latin input" return utf_8_encode(latin_1_decode(text)[0])[0]
deflatin1_to_utf8(text):"helpertoconvertwhenneededfromlatininput"returnutf_8_encode(latin_1_decode(text)[0])[0]
4,484
def hex32(i): return '0X%8.8X' % i
def hex32(i): return '0X%8.8X' % i
4,485
def calcChecksum(data): """Calculates PDF-style checksums""" if len(data)&3: data = data + (4-(len(data)&3))*"\0" sum = 0 for n in unpack(">%dl" % (len(data)>>2), data): lo = (sum & 0xFFFF) + (n & 0xFFFF) hi = (sum >> 16) + (n >> 16) + (lo >> 16) sum = (hi << 16) | (lo & 0xFFFF) return sum
def calcChecksum(data): """Calculates PDF-style checksums""" if len(data)&3: data = data + (4-(len(data)&3))*"\0" sum = 0 for n in unpack(">%dl" % (len(data)>>2), data): sum = add32(sum,n) return sum
4,486
def calcChecksum(data): """Calculates PDF-style checksums""" if len(data)&3: data = data + (4-(len(data)&3))*"\0" sum = 0 for n in unpack(">%dl" % (len(data)>>2), data): lo = (sum & 0xFFFF) + (n & 0xFFFF) hi = (sum >> 16) + (n >> 16) + (lo >> 16) sum = (hi << 16) | (lo & 0xFFFF) return sum
def calcChecksum(data): """Calculates PDF-style checksums""" if len(data)&3: data = data + (4-(len(data)&3))*"\0" sum = 0 for n in unpack(">%dl" % (len(data)>>2), data): lo = (sum & 0xFFFF) + (n & 0xFFFF) hi = (sum >> 16) + (n >> 16) + (lo >> 16) sum = (hi << 16) | (lo & 0xFFFF) return sum
4,487
def makeStream(self): "Finishes the generation and returns the TTF file as a string" stm = StringIO()
defmakeStream(self):"FinishesthegenerationandreturnstheTTFfileasastring"stm=StringIO()
4,488
def __init__(self, normalDate=None): """ Accept 1 of 4 values to initialize a NormalDate: 1. None - creates a NormalDate for the current day 2. integer in yyyymmdd format 3. string in yyyymmdd format 4. tuple in (yyyy, mm, dd) - localtime/gmtime can also be used """ if normalDate is None: import time self.setNormalDate...
def __init__(self, normalDate=None): """ Accept 1 of 4 values to initialize a NormalDate: 1. None - creates a NormalDate for the current day 2. integer in yyyymmdd format 3. string in yyyymmdd format 4. tuple in (yyyy, mm, dd) - localtime/gmtime can also be used """ if normalDate is None: self.setNormalDate(time.localt...
4,489
def setNormalDate(self, normalDate): """ accepts date as scalar string/integer (yyyymmdd) or tuple (year, month, day, ...)""" tn=type(normalDate) if tn is IntType: self.normalDate = normalDate elif tn is StringType: try: self.normalDate = int(normalDate) except: m = _iso_re.match(normalDate) if m: self.setNormalDate(m....
def setNormalDate(self, normalDate): """ accepts date as scalar string/integer (yyyymmdd) or tuple (year, month, day, ...)""" tn=type(normalDate) if tn is IntType: self.normalDate = normalDate elif tn is StringType: try: self.normalDate = int(normalDate) except: m = _iso_re.match(normalDate) if m: self.setNormalDate(m....
4,490
def demo(self): D = shapes.Drawing(200, 100) et = ETriangle0() 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 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
4,491
def demo(self): D = shapes.Drawing(200, 200) 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 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
4,492
def demo(self): D = shapes.Drawing(200, 100) na = NoSmoking0() 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 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
4,493
def demo(self): D = shapes.Drawing(200, 100) yn = YesNo0() yn.x = 50 yn.y = 0 yn.testValue = 1 yn.draw() D.add(yn) labelFontSize = 10 D.add(shapes.String(yn.x+(yn.size/2),(yn.y-(1.2*labelFontSize)), self.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) return D
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) labelFontSize = 10 D.add(shapes.String(yn.x+(yn.size/2),(yn.y-(1.2*labelFontSize)), self.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) return D
4,494
def demo(self): D = shapes.Drawing(200, 100) yn = YesNo0() yn.x = 50 yn.y = 0 yn.testValue = 1 yn.draw() D.add(yn) labelFontSize = 10 D.add(shapes.String(yn.x+(yn.size/2),(yn.y-(1.2*labelFontSize)), self.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=labelFontSize)) return D
def demo(self): D = shapes.Drawing(200, 100) yn = YesNo0() yn.x = 50 yn.y = 0 yn.testValue = 1 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)), self.__class__.__name__, fillC...
4,495
def demo(self): D = shapes.Drawing(200, 100) a2 = ArrowOne0() 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 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
4,496
def format(self, num): # positivize the numbers absNum = abs(num) if absNum == num: sign = 1 else: sign = -1 intPart, fracPart = divmod(absNum, 1.0) strInt = str(long(intPart)) if self.thousandSeparator is not None: strNew = '' while strInt: left, right = strInt[0:-3], strInt[-3:] if left == '': #strNew = self.thousan...
def format(self, num): # positivize the numbers sign=num<0 if sign: num = -num places, sep = self.decimalPlaces, self.decimalSeparator strip = places<=0 if places and strip: places = -places strInt, strFrac = (('%.' + str(places) + 'f') % num).split('.') if self.thousandSeparator is not None: strNew = '' while strInt:...
4,497
def format(self, num): # positivize the numbers absNum = abs(num) if absNum == num: sign = 1 else: sign = -1 intPart, fracPart = divmod(absNum, 1.0) strInt = str(long(intPart)) if self.thousandSeparator is not None: strNew = '' while strInt: left, right = strInt[0:-3], strInt[-3:] if left == '': #strNew = self.thousan...
def format(self, num): # positivize the numbers absNum = abs(num) if absNum == num: sign = 1 else: sign = -1 intPart, fracPart = divmod(absNum, 1.0) strInt = str(long(intPart)) if self.thousandSeparator is not None: strNew = '' while strInt: left, right = strInt[0:-3], strInt[-3:] if left == '': #strNew = self.thousan...
4,498
def format(self, num): # positivize the numbers absNum = abs(num) if absNum == num: sign = 1 else: sign = -1 intPart, fracPart = divmod(absNum, 1.0) strInt = str(long(intPart)) if self.thousandSeparator is not None: strNew = '' while strInt: left, right = strInt[0:-3], strInt[-3:] if left == '': #strNew = self.thousan...
def format(self, num): # positivize the numbers absNum = abs(num) if absNum == num: sign = 1 else: sign = -1 intPart, fracPart = divmod(absNum, 1.0) strInt = str(long(intPart)) if self.thousandSeparator is not None: strNew = '' while strInt: left, right = strInt[0:-3], strInt[-3:] if left == '': #strNew = self.thousan...
4,499