rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
if fragment and fragment[0] in WHITESPACE:
if fragment and fragment[0] in whitespace:
def handleSpecialCharacters(engine, text, program=None): from paraparser import greeks, symenc from string import whitespace standard={'lt':'<', 'gt':'>', 'amp':'&'} # add space prefix if space here if text[0:1] in whitespace: program.append(" ") #print "handling", repr(text) # shortcut if 0 and "&" not in text: result...
if fragment[-1] in WHITESPACE:
if fragment[-1] in whitespace:
def handleSpecialCharacters(engine, text, program=None): from paraparser import greeks, symenc from string import whitespace standard={'lt':'<', 'gt':'>', 'amp':'&'} # add space prefix if space here if text[0:1] in whitespace: program.append(" ") #print "handling", repr(text) # shortcut if 0 and "&" not in text: result...
stripped = string.strip(text) lines = string.split(stripped, '\n') trimmed_lines = map(string.lstrip, lines) return string.join(trimmed_lines, joiner)
L = map(_lineClean, split(text, '\n')) return join(L, joiner) def setXPos(tx,dx): if dx>1e-6 or dx<-1e-6: tx.setXPos(dx)
def cleanBlockQuotedText(text,joiner=' '): """This is an internal utility which takes triple- quoted text form within the document and returns (hopefully) the paragraph the user intended originally.""" stripped = string.strip(text) lines = string.split(stripped, '\n') trimmed_lines = map(string.lstrip, lines) return st...
tx.setXPos(offset) tx._textOut(string.join(words),1)
setXPos(tx,offset) tx._textOut(join(words),1) setXPos(tx,-offset)
def _leftDrawParaLine( tx, offset, extraspace, words, last=0): tx.setXPos(offset) tx._textOut(string.join(words),1)
tx.setXPos(m) tx._textOut(string.join(words),1)
setXPos(tx,m) tx._textOut(join(words),1) setXPos(tx,-m)
def _centerDrawParaLine( tx, offset, extraspace, words, last=0): m = offset + 0.5 * extraspace tx.setXPos(m) tx._textOut(string.join(words),1)
tx.setXPos(m) tx._textOut(string.join(words),1)
setXPos(tx,m) tx._textOut(join(words),1) setXPos(tx,-m)
def _rightDrawParaLine( tx, offset, extraspace, words, last=0): m = offset + extraspace tx.setXPos(m) tx._textOut(string.join(words),1)
tx.setXPos(offset) text = string.join(words)
setXPos(tx,offset) text = join(words)
def _justifyDrawParaLine( tx, offset, extraspace, words, last=0): tx.setXPos(offset) text = string.join(words) if last: #last one, left align tx._textOut(text,1) else: nSpaces = len(words)-1 if nSpaces: tx.setWordSpace(extraspace / float(nSpaces)) tx._textOut(text,1) tx.setWordSpace(0) else: tx._textOut(text,1)
tx.setXPos(offset)
setXPos(tx,offset)
def _leftDrawParaLineX( tx, offset, line, last=0): tx.setXPos(offset) _putFragLine(tx, line.words)
tx.setXPos(m)
setXPos(tx,m)
def _centerDrawParaLineX( tx, offset, line, last=0): m = offset+0.5*line.extraSpace tx.setXPos(m) _putFragLine(tx, line.words)
tx.setXPos(m)
setXPos(tx,m)
def _rightDrawParaLineX( tx, offset, line, last=0): m = offset+line.extraSpace tx.setXPos(m) _putFragLine(tx, line.words)
tx.setXPos(offset)
def _justifyDrawParaLineX( tx, offset, line, last=0): if last: #last one, left align tx.setXPos(offset) _putFragLine(tx, line.words) else: tx.setXPos(offset) nSpaces = line.wordCount - 1 if nSpaces: tx.setWordSpace(line.extraSpace / float(nSpaces)) _putFragLine(tx, line.words) tx.setWordSpace(0) else: _putFragLine(tx, ...
S = string.split(text,' ')
S = split(text,' ')
def _getFragWords(frags): ''' given a Parafrag list return a list of fragwords [[size, (f00,w00), ..., (f0n,w0n)],....,[size, (fm0,wm0), ..., (f0n,wmn)]] each pair f,w represents a style and some string each sublist represents a word ''' R = [] W = [] n = 0 for f in frags: text = f.text #del f.text # we can't do this u...
if bulletRight > style.firstLineIndent:
indent = style.leftIndent+style.firstLineIndent if bulletRight > indent:
def _handleBulletWidth(bulletText,style,maxWidths): '''work out bullet width and adjust maxWidths[0] if neccessary ''' if bulletText <> None: if type(bulletText) is StringType: bulletWidth = stringWidth( bulletText, style.bulletFontName, style.bulletFontSize) else: #it's a list of fragments bulletWidth = 0 for f in bul...
maxWidths[0] = maxWidths[0] - (bulletRight - style.firstLineIndent)
maxWidths[0] = maxWidths[0] - (bulletRight - indent)
def _handleBulletWidth(bulletText,style,maxWidths): '''work out bullet width and adjust maxWidths[0] if neccessary ''' if bulletText <> None: if type(bulletText) is StringType: bulletWidth = stringWidth( bulletText, style.bulletFontName, style.bulletFontSize) else: #it's a list of fragments bulletWidth = 0 for f in bul...
first_line_width = availWidth - self.style.firstLineIndent - self.style.rightIndent later_widths = availWidth - self.style.leftIndent - self.style.rightIndent
leftIndent = self.style.leftIndent first_line_width = availWidth - (leftIndent+self.style.firstLineIndent) - self.style.rightIndent later_widths = availWidth - leftIndent - self.style.rightIndent
def wrap(self, availWidth, availHeight): # work out widths array for breaking self.width = availWidth first_line_width = availWidth - self.style.firstLineIndent - self.style.rightIndent later_widths = availWidth - self.style.leftIndent - self.style.rightIndent self.blPara = self.breakLines([first_line_width, later_widt...
if style.firstLineIndent != style.leftIndent:
if style.firstLineIndent != 0:
def split(self,availWidth, availHeight): if len(self.frags)<=0: return []
style.firstLineIndent = style.leftIndent
style.firstLineIndent = 0
def split(self,availWidth, availHeight): if len(self.frags)<=0: return []
maxWidth = maxWidths[lineno]
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...
words = hasattr(f,'text') and string.split(f.text, ' ') or f.words
words = hasattr(f,'text') and split(f.text, ' ') or f.words
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...
canvas.addLiteral('%% %s.drawPara' % _className(self))
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."""
offset = style.firstLineIndent - style.leftIndent
offset = style.firstLineIndent
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."""
return string.join(plains, '')
return join(plains, '')
def getPlainText(self): """Convenience function for templates which want access to the raw text, without XML tags. """ plains = [] for frag in self.frags: plains.append(frag.text) return string.join(plains, '')
image = PIL_Image.open(cStringIO.StringIO(str(logo.data))) (width, height) = image.size
image = ImageReader(cStringIO.StringIO(str(logo.data))) (width, height) = image.getSize()
def getImageFromZODB(self, name) : """Retrieves an Image from the ZODB, converts it to PIL, and makes it 0.75 inch high. """ try : # try to get it from ZODB logo = getattr(self.parent.context, name) except AttributeError : # not found ! return None
print vm, vM, y, scale, self.valueAxis._y, self.valueAxis._valueMin, self._findMinMaxValues()[0]
def calcBarPositions(self): """Works out where they go. default vertical.
version="1.15.3",
version="1.17", licence="BSD license, Copyright (c) 2000-2003, ReportLab Inc.",
def run(): LIBS = [] setup( name="Reportlab", version="1.15.3", description="Reportlab PDF generation tools", author="The boys from SW19", author_email="info@reportlab.com", url="http://www.reportlab.com/", package_dir = {'': '..'}, packages=[ # include anything with an __init__ 'reportlab', 'reportlab.docs', 'report...
package_dir = {'': '..'},
package_dir = {'reportlab': '.'},
def run(): LIBS = [] setup( name="Reportlab", version="1.15.3", description="Reportlab PDF generation tools", author="The boys from SW19", author_email="info@reportlab.com", url="http://www.reportlab.com/", package_dir = {'': '..'}, packages=[ # include anything with an __init__ 'reportlab', 'reportlab.docs', 'report...
'reportlab.docs.images',
def run(): LIBS = [] setup( name="Reportlab", version="1.15.3", description="Reportlab PDF generation tools", author="The boys from SW19", author_email="info@reportlab.com", url="http://www.reportlab.com/", package_dir = {'': '..'}, packages=[ # include anything with an __init__ 'reportlab', 'reportlab.docs', 'report...
'reportlab.fonts',
def run(): LIBS = [] setup( name="Reportlab", version="1.15.3", description="Reportlab PDF generation tools", author="The boys from SW19", author_email="info@reportlab.com", url="http://www.reportlab.com/", package_dir = {'': '..'}, packages=[ # include anything with an __init__ 'reportlab', 'reportlab.docs', 'report...
], data_files = [('docs/images', ['docs/images/Edit_Prefs.gif', 'docs/images/Python_21.gif', 'docs/images/Python_21_HINT.gif', 'docs/images/fileExchange.gif', 'docs/images/jpn.gif', 'docs/images/jpnchars.jpg', 'docs/images/lj8100.jpg', 'docs/images/replogo.a85', 'docs/images/replogo.gif']), ('fonts', ['fonts/LeERC___.A...
'reportlab.test', 'reportlab.tools', 'reportlab.tools.docco', 'reportlab.tools.py2pdf', 'reportlab.tools.pythonpoint', 'reportlab.tools.pythonpoint.demos', 'reportlab.tools.pythonpoint.styles', ], data_files = [(pjoin(package_path, 'docs', 'images'), ['docs/images/Edit_Prefs.gif', 'docs/images/Python_21.gif', 'docs/ima...
def run(): LIBS = [] setup( name="Reportlab", version="1.15.3", description="Reportlab PDF generation tools", author="The boys from SW19", author_email="info@reportlab.com", url="http://www.reportlab.com/", package_dir = {'': '..'}, packages=[ # include anything with an __init__ 'reportlab', 'reportlab.docs', 'report...
ext_modules = [Extension( '_rl_accel',
ext_modules = [Extension( 'reportlab/lib/_rl_accel',
def run(): LIBS = [] setup( name="Reportlab", version="1.15.3", description="Reportlab PDF generation tools", author="The boys from SW19", author_email="info@reportlab.com", url="http://www.reportlab.com/", package_dir = {'': '..'}, packages=[ # include anything with an __init__ 'reportlab', 'reportlab.docs', 'report...
Extension( 'sgmlop',
Extension( 'reportlab/lib/sgmlop',
def run(): LIBS = [] setup( name="Reportlab", version="1.15.3", description="Reportlab PDF generation tools", author="The boys from SW19", author_email="info@reportlab.com", url="http://www.reportlab.com/", package_dir = {'': '..'}, packages=[ # include anything with an __init__ 'reportlab', 'reportlab.docs', 'report...
Extension( 'pyHnj',
Extension( 'reportlab/lib/pyHnj',
def run(): LIBS = [] setup( name="Reportlab", version="1.15.3", description="Reportlab PDF generation tools", author="The boys from SW19", author_email="info@reportlab.com", url="http://www.reportlab.com/", package_dir = {'': '..'}, packages=[ # include anything with an __init__ 'reportlab', 'reportlab.docs', 'report...
unittest.TextTestRunner().run(makeSuite())
if '-debug' in sys.argv: run() else: unittest.TextTestRunner().run(makeSuite())
def makeSuite(): suite = unittest.TestSuite() suite.addTest(PlatypusTestCase('test1')) return suite
deltas['transform'] = [1,0,0,1,x,y]
deltas['transform'] = canvas._baseCTM[0:4]+(x,y)
def draw(self, drawing, canvas, x=0, y=0, showBoundary=rl_config.showBoundary): """This is the top level function, which draws the drawing at the given location. The recursive part is handled by drawNode.""" #stash references for ease of communication self._canvas = canvas canvas.__dict__['_drawing'] = self._drawing =...
w = int(d.width+0.5) h = int(d.height+0.5)
w = int(d.width*dpi/72.0+0.5) h = int(d.height*dpi/72.0+0.5)
def drawToPMCanvas(d, dpi=72, bg=0xffffff, configPIL=None, showBoundary=rl_config.showBoundary): w = int(d.width+0.5) h = int(d.height+0.5) c = PMCanvas(w, h, dpi=dpi, bg=bg, configPIL=configPIL) draw(d, c, 0, 0) return c
lineBreakPrev = False
def breakLines(self, width): """ Returns a broken line structure. There are two cases
endLine = (newWidth>maxWidth and n>0) or (lineBreak and (currentWidth>0 or lineBreakPrev))
endLine = (newWidth>maxWidth and n>0) or lineBreak
def breakLines(self, width): """ Returns a broken line structure. There are two cases
lineBreakPrev = lineBreak
def breakLines(self, width): """ Returns a broken line structure. There are two cases
while hasattr(words[i],'cbDefn'): i = i-1
while hasattr(words[i],'cbDefn'): i -= 1
def breakLines(self, width): """ Returns a broken line structure. There are two cases
if lineBreak and not len(words):
if lineBreak:
def breakLines(self, width): """ Returns a broken line structure. There are two cases
del g.lineBreak
def breakLines(self, width): """ Returns a broken line structure. There are two cases
print "frag%d: '%s'" % (l, frags[l].text)
print "frag%d: '%s' %s" % (l, frags[l].text,' '.join(['%s=%s' % (k,getattr(frags[l],k)) for k in frags[l].__dict__ if k!=text]))
def dumpParagraphFrags(P): print 'dumpParagraphFrags(<Paragraph @ %d>) minWidth() = %.2f' % (id(P), P.minWidth()) frags = P.frags n =len(frags) for l in range(n): print "frag%d: '%s'" % (l, frags[l].text)
w = [] for frag in self.blPara.lines: w.append(self.width - frag.extraSpace) return w
if self.blPara.kind: func = lambda frag, w=self.width: w - frag.extraSpace else: func = lambda frag, w=self.width: w - frag[0] return map(func,self.blPara.lines)
def getActualLineWidths0(self): """Convenience function; tells you how wide each line actually is. For justified styles, this will be the same as the wrap width; for others it might be useful for seeing if paragraphs will fit in spaces.""" assert hasattr(self, 'width'), "Cannot call this method before wrap()" w = [] f...
R.extend(unicode2T1(utext[i0:il],fonts))
R.extend(_py_unicode2T1(utext[i0:il],fonts))
def _py_unicode2T1(utext,fonts): '''return a list of (font,string) pairs representing the unicode text''' #print 'unicode2t1(%s, %s): %s' % (utext, fonts, type(utext)) #if type(utext) R = [] font, fonts = fonts[0], fonts[1:] enc = font.encName if 'UCS-2' in enc: enc = 'UTF16' while utext: try: R.append((font,utext.enco...
from rl_accel import getFontU as getFont
from _rl_accel import getFontU as getFont
def _py_getFont(fontName): """Lazily constructs known fonts if not found. Names of form 'face-encoding' will be built if face and encoding are known. Also if the name is just one of the standard 14, it will make up a font in the default encoding.""" try: return _fonts[fontName] except KeyError: return findFontAndRegi...
self._addNABarLabel(g,rowNo,colNo,x,y,width,height)
self._addNABarLabel(lg,rowNo,colNo,x,y,width,height)
def makeBars(self): g = Group()
self._addBarLabel(g,rowNo,colNo,x,y,width,height)
self._addBarLabel(lg,rowNo,colNo,x,y,width,height) g.add(lg)
def makeBars(self): g = Group()
outDir = join(rlDir, 'test') pdf = join(outDir, 'pythonpoint.pdf')
datafilename = 'pythonpoiint.pdf' if isCompactDistro(): cwd = None outDir = '.' xml = open_for_read(xml) else: outDir = join(rlDir, 'test') cwd = os.getcwd() os.chdir(join(ppDir, 'demos')) pdf = join(outDir, datafilename)
def test0(self): "Test if pythonpoint.pdf can be created from pythonpoint.xml."
cwd = os.getcwd() os.chdir(join(ppDir, 'demos')) pythonpoint.process(xml, outDir=outDir, verbose=0) os.chdir(cwd)
pythonpoint.process(xml, outDir=outDir, verbose=0, datafilename=datafilename) if cwd: os.chdir(cwd)
def test0(self): "Test if pythonpoint.pdf can be created from pythonpoint.xml."
def _doNothing(drawables, doc): "Dummy callback for onFirstPage and onNewPage" pass
def reset(self, category): self.dict[category] = 0
self.onFirstPage = self.doNothing self.onNewPage = self.doNothing def doNothing(self, drawables, doc): "Dummy callback for onFirstPage and onNewPage" pass
self.onFirstPage = _doNothing self.onNewPage = _doNothing
def __init__(self, filename, pagesize, showBoundary=0): self.filename = filename self.pagesize = pagesize self.showBoundary=showBoundary #sensibel defaults; override if you wish self.leftMargin = inch self.bottomMargin = inch self.rightMargin = self.pagesize[0] - inch self.topMargin = self.pagesize[1] - inch
return filter(lambda x: x is not None, self._attrMap['kind']._enum)
return filter(lambda x: x is not None, self._attrMap['kind'].validate._enum)
def availableFlagNames(self): '''return a list of the things we can display''' return filter(lambda x: x is not None, self._attrMap['kind']._enum)
projdir = py2pdf_dir cvsdir = os.path.join(groupdir,projdir)
pdir = py2pdf_dir cvsdir = os.path.join(groupdir,pdir) else: pdir = projdir
def do_zip(d): 'create .tgz and .zip file archives of d/reportlab' os.chdir(d) if release: b = tagname else: b = py2pdf and "py2pdf" or "current" tarfile = '%s/%s.tgz' % (groupdir,b) zipfile = '%s/%s.zip' % (groupdir,b) if py2pdf: projdir = py2pdf_dir cvsdir = os.path.join(groupdir,projdir) tar = find_exe('tar') if...
do_exec('%s czvf %s %s' % (tar, tarfile, projdir), 'tar creation')
do_exec('%s czvf %s %s' % (tar, tarfile, pdir), 'tar creation')
def do_zip(d): 'create .tgz and .zip file archives of d/reportlab' os.chdir(d) if release: b = tagname else: b = py2pdf and "py2pdf" or "current" tarfile = '%s/%s.tgz' % (groupdir,b) zipfile = '%s/%s.zip' % (groupdir,b) if py2pdf: projdir = py2pdf_dir cvsdir = os.path.join(groupdir,projdir) tar = find_exe('tar') if...
do_exec('%s -ur %s %s' % (zip, zipfile, projdir), 'zip creation')
do_exec('%s -ur %s %s' % (zip, zipfile, pdir), 'zip creation')
def do_zip(d): 'create .tgz and .zip file archives of d/reportlab' os.chdir(d) if release: b = tagname else: b = py2pdf and "py2pdf" or "current" tarfile = '%s/%s.tgz' % (groupdir,b) zipfile = '%s/%s.zip' % (groupdir,b) if py2pdf: projdir = py2pdf_dir cvsdir = os.path.join(groupdir,projdir) tar = find_exe('tar') if...
if self._atTop: s = flowable.getSpaceBefore()
if not self._atTop: s = flowable.getSpaceBefore()
def split(self,flowable,canv): '''Ask the flowable to split using up the available space.''' y = self._y p = self._y1p s = 0 if self._atTop: s = flowable.getSpaceBefore() flowable.canv = canv #some flowables might need this r = flowable.split(self._aW, y-p-s) del flowable.canv return r
obj.contents.append(newChild)
a(newChild)
def expandUserNodes(self): """Return a new object which only contains primitive shapes."""
if k in self_contents:
if v in self_contents:
def _copyNamedContents(self,obj,aKeys=None,noCopy=('contents',)): from copy import copy self_contents = self.contents if not aKeys: aKeys = self._attrMap.keys() for (k, v) in self.__dict__.items(): if k in self_contents: pos = self_contents.index(v) setattr(obj, oldKey, obj.contents[pos]) elif k in aKeys and k not in n...
setattr(obj, oldKey, obj.contents[pos])
setattr(obj, k, obj.contents[pos])
def _copyNamedContents(self,obj,aKeys=None,noCopy=('contents',)): from copy import copy self_contents = self.contents if not aKeys: aKeys = self._attrMap.keys() for (k, v) in self.__dict__.items(): if k in self_contents: pos = self_contents.index(v) setattr(obj, oldKey, obj.contents[pos]) elif k in aKeys and k not in n...
ascent=getFont(fontName).face.ascent
ascent=getFont(fontName).face.ascent/1000.
def gAdd(t,g=g,fontName=fontName,fontSize=fontSize,fillColor=fillColor): t.fontName = fontName t.fontSize = fontSize t.fillColor = fillColor return g.add(t)
if ext == '.pfb':
if string.lower(ext) == '.pfb':
def findT1File(self,ext='.pfb'): possible_exts = (string.lower(ext), string.upper(ext)) if hasattr(self,'pfbFileName'): r_basename = os.path.splitext(self.pfbFileName)[0] for e in possible_exts: if os.path.isfile(r_basename + e): return r_basename + e try: r = _fontdata.findT1File(self.name) except: afm = bruteForceSea...
elif ext == '.afm':
elif string.lower(ext) == '.afm':
def findT1File(self,ext='.pfb'): possible_exts = (string.lower(ext), string.upper(ext)) if hasattr(self,'pfbFileName'): r_basename = os.path.splitext(self.pfbFileName)[0] for e in possible_exts: if os.path.isfile(r_basename + e): return r_basename + e try: r = _fontdata.findT1File(self.name) except: afm = bruteForceSea...
possibles = glob.glob(dirname + os.sep + '*.afm')
possibles = glob.glob(dirname + os.sep + '*.[aA][fF][mM]')
def bruteForceSearchForAFM(faceName): """Looks in all AFM files on path for face with given name. Returns AFM file name or None. Ouch!""" import glob from reportlab.rl_config import T1SearchPath for dirname in T1SearchPath: if not os.path.isdir(dirname): continue possibles = glob.glob(dirname + os.sep + '*.afm') for...
codes = map(ord, text)
codes = map(ord, uText)
def stringWidth(self, text, size, encoding='utf-8'): "Calculate text width" width = self.face.getCharWidth w = 0 if type(text) is UnicodeType: codes = map(ord, text) else: uText = unicode(text, encoding) codes = map(ord, text) for code in codes: w = w + width(code) return 0.001 * w * size
fileSuffix = '-graph.pdf'
fileSuffix = '.pdf'
def getFunctionBody(f, linesInFile): """Pass in the function object and the lines in the file. Since we will typically grab several things out of the same file. it extracts a multiline text block. Works with methods too.""" if hasattr(f, 'im_func'): #it's a method, drill down and get its function f = f.im_func extr...
if name == 'demo': PdfDocBuilder0.beginMethod(self, name, doc, sig)
pass
def beginMethod(self, name, doc, sig): if name == 'demo': PdfDocBuilder0.beginMethod(self, name, doc, sig)
if name == 'demo': PdfDocBuilder0.endMethod(self, name, doc, sig)
pass
def endMethod(self, name, doc, sig): if name == 'demo': PdfDocBuilder0.endMethod(self, name, doc, sig)
self._showWidgetDemoCode(widget)
def endClass(self, name, doc, bases): "Append a graphic demo of a widget at the end of a class." PdfDocBuilder0.endClass(self, name, doc, bases)
class UmlPdfDocBuilder0(PdfDocBuilder0): "Document the skeleton of a Python module with UML class diagrams." fileSuffix = '-uml.pdf' def begin(self): styleSheet = getSampleStyleSheet() self.h1 = styleSheet['Heading1'] self.h2 = styleSheet['Heading2'] self.h3 = styleSheet['Heading3'] self.code = styleSheet['Code'] sel...
def beginFunction(self, name, doc, sig): bt = self.bt story = self.story story.append(Paragraph(name+sig, bt)) story.append(XPreformatted(doc, bt))
def documentModule0(path, builder=DocBuilder0()):
def documentModule0(path, builder=GraphPdfDocBuilder0()):
def documentModule0(path, builder=DocBuilder0()): """Generate documentation for one Python file in some format. This handles Python standard modules like string, custom modules on the Python search path like e.g. docpy as well as modules specified with their full path like C:/tmp/junk.py. The doc file will always be ...
def documentPackage0(path, builder=DocBuilder0()):
def documentPackage0(pathOrName, builder=GraphPdfDocBuilder0()):
def documentPackage0(path, builder=DocBuilder0()): """Generate documentation for one Python package in some format. Rigiht now, 'path' must be a filesystem path, later it will also be a package name whose path will be resolved by importing the top-level module. The doc file will always be saved in the current directo...
builder = DocBuilder0()
builder = GraphPdfDocBuilder0()
def main(): """Handle command-line options and trigger corresponding action. """ opts, args = getopt.getopt(sys.argv[1:], 'hf:m:p:') # On -h print usage and exit immediately. for o, a in opts: if o == '-h': print printUsage.__doc__ #printUsage() sys.exit(0) # On -f set the DocBuilder to use or a default one. builder...
'''This gets called by the template framework
"""This gets called by the template framework
def checkPageSize(self,canv,doc): '''This gets called by the template framework If canv size != template size then the canv size is set to the template size or if that's not available to the doc size. ''' #### NEVER EVER EVER COMPARE FLOATS FOR EQUALITY #RGB converting pagesizes to ints means we are accurate to one poi...
'''
"""
def checkPageSize(self,canv,doc): '''This gets called by the template framework If canv size != template size then the canv size is set to the template size or if that's not available to the doc size. ''' #### NEVER EVER EVER COMPARE FLOATS FOR EQUALITY #RGB converting pagesizes to ints means we are accurate to one poi...
fn = pjoin(dir,'_rl_accel') return getVersionFromCCode(fn),os.stat(fn)[stat.ST_MTIME]
fn = pjoin(dir,'_rl_accel.c') try: return getVersionFromCCode(fn),os.stat(fn)[stat.ST_MTIME] except: return None
def _rl_accel_dir_info(dir): import stat fn = pjoin(dir,'_rl_accel') return getVersionFromCCode(fn),os.stat(fn)[stat.ST_MTIME]
if len(_)>1: _.sort(_cmp_rl_accel_dirs) return abspath(_[0])
_ = filter(_rl_accel_dir_info,_) if len(_): _.sort(_cmp_rl_accel_dirs) return abspath(_[0])
def _find_rl_accel(): '''locate where the accelerator code lives''' _ = [] for x in [ './rl_addons/rl_accel', '../rl_addons/rl_accel', '../../rl_addons/rl_accel', './rl_accel', '../rl_accel', '../../rl_accel', './lib'] \ + glob.glob('./rl_accel-*/rl_accel')\ + glob.glob('../rl_accel-*/rl_accel') \ + glob.glob('../../rl...
RL_ACCEL = _find_rl_accel() LIBS = [] DATA_FILES = {} if not RL_ACCEL: EXT_MODULES = [] print '***************************************************' print '*No rl_accel code found, you can obtain it at *' print '*http://www.reportlab.org/downloads.html print '***************************************************'
_yesV=('yes','y','1','true') _yesnoV=_yesV+('no','n','0','false') tra=[_ for _ in sys.argv if _.lower().startswith('--rl_accel=')] if not tra: tra = True
def run(): RL_ACCEL = _find_rl_accel() LIBS = [] DATA_FILES = {} if not RL_ACCEL: EXT_MODULES = [] print '***************************************************' print '*No rl_accel code found, you can obtain it at *' print '*http://www.reportlab.org/downloads.html#_rl_accel*' print '**********************************...
fn = pjoin(RL_ACCEL,'lib','hyphen.mashed') if isfile(fn): DATA_FILES[pjoin(package_path, 'lib')] = [fn] EXT_MODULES = [ Extension( '_rl_accel', [pjoin(RL_ACCEL,'_rl_accel.c')],
map(sys.argv.remove,tra) tra=tra[-1].split('=',1)[1].lower() assert tra in _yesnoV, 'bad argument --rl_accel='+tra tra = tra in _yesV if tra: RL_ACCEL = _find_rl_accel() LIBS = [] DATA_FILES = {} if not RL_ACCEL: EXT_MODULES = [] print '***************************************************' print '*No rl_accel code foun...
def run(): RL_ACCEL = _find_rl_accel() LIBS = [] DATA_FILES = {} if not RL_ACCEL: EXT_MODULES = [] print '***************************************************' print '*No rl_accel code found, you can obtain it at *' print '*http://www.reportlab.org/downloads.html#_rl_accel*' print '**********************************...
define_macros=[], library_dirs=[], libraries=LIBS, ), Extension( 'sgmlop', [pjoin(RL_ACCEL,'sgmlop.c')], include_dirs=[], define_macros=[], library_dirs=[], libraries=LIBS, ), Extension( 'pyHnj', [pjoin(RL_ACCEL,'pyHnjmodule.c'), pjoin(RL_ACCEL,'hyphen.c'), pjoin(RL_ACCEL,'hnjalloc.c')], include_dirs=[], define_macros=...
define_macros=[], library_dirs=[], libraries=LIBS, ), Extension( 'pyHnj', [pjoin(RL_ACCEL,'pyHnjmodule.c'), pjoin(RL_ACCEL,'hyphen.c'), pjoin(RL_ACCEL,'hnjalloc.c')], include_dirs=[], define_macros=[], library_dirs=[], libraries=LIBS, ), ]
def run(): RL_ACCEL = _find_rl_accel() LIBS = [] DATA_FILES = {} if not RL_ACCEL: EXT_MODULES = [] print '***************************************************' print '*No rl_accel code found, you can obtain it at *' print '*http://www.reportlab.org/downloads.html#_rl_accel*' print '**********************************...
if self._atTop: s = flowable.getSpaceBefore()
if not self._atTop: s = flowable.getSpaceBefore()
def _add(self, flowable, canv, trySplit=0): """ Draws the flowable 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""" y = self._y p = self._y1p s = 0 if self._atTop: s = flowa...
c.bookmarkHorizontalAbsolute0(nameTag, pos)
c.bookmarkHorizontalAbsolute(nameTag, pos)
def addIdent(self, t): "Add an identifier." o = self.options # Make base font bold. fam, b, i = fonts.ps2tt(o.fontName) ps = fonts.tt2ps(fam, 1, i) font = (ps, o.fontSize) self.setFillColorAndFont(o.identCol, font) self.putText(t) # Bookmark certain identifiers (class and function names). if not o.noOutline and not...
raise "LayoutError", "Flowable (%sx%s points) too wide for frame (%sx* points)." % (dW,t,w)
raise "LayoutError", "Flowable (%sx%s points) too wide for cell (%sx* points)." % (dW,t,w)
def _calc(self): if hasattr(self,'_width'): return
self._canvas.ellipse(x1,y1,x2,y2,fill=1)
self._canvas.ellipse(x1,y1,x2,y2,fill=self._fill,stroke=self._stroke)
def drawEllipse(self, ellipse): #need to convert to pdfgen's bounding box representation x1 = ellipse.cx - ellipse.rx x2 = ellipse.cx + ellipse.rx y1 = ellipse.cy - ellipse.ry y2 = ellipse.cy + ellipse.ry self._canvas.ellipse(x1,y1,x2,y2,fill=1)
internalname = canv._doc.hasForm(name) canv.saveState()
if definedForms.has_key(name): internalname = 1 else: internalname = None definedForms[name] = 1
def drawOn(self, canv): for graphic in self.graphics:
canv.restoreState()
def drawOn(self, canv): for graphic in self.graphics:
if self._text == None: self._text = ''
_text = self._text self._text = _text or ''
def draw(self): if self._text == None: self._text = '' # hack, but it works for now... self.computeSize() g = Group() g.translate(self.x + self.dx, self.y + self.dy) g.rotate(self.angle)
def _doNothing(flowables, doc): "Dummy callback for onFirstPage and onNewPage"
def _doNothing(canvas, doc): "Dummy callback for onPage"
def _doNothing(flowables, doc): "Dummy callback for onFirstPage and onNewPage" pass
self.canv.drawCentredString(
try: self.canv.drawCentredString(
def drawChars(self, charList): """Fills boxes in order. None means skip a box. Empty boxes at end get filled with gray""" extraNeeded = (self.rows * self.charsPerRow - len(charList)) for i in range(extraNeeded): charList.append(None) #charList.extend([None] * extraNeeded) row = 0 col = 0 self.canv.setFont(self.fontNam...
ch
ch,
def drawChars(self, charList): """Fills boxes in order. None means skip a box. Empty boxes at end get filled with gray""" extraNeeded = (self.rows * self.charsPerRow - len(charList)) for i in range(extraNeeded): charList.append(None) #charList.extend([None] * extraNeeded) row = 0 col = 0 self.canv.setFont(self.fontNam...
return makeSuiteForClasses(RlAccelTestCase) except ImportError: return None
Klass = RlAccelTestCase except: class Klass(unittest.TestCase): pass return makeSuiteForClasses(Klass)
def makeSuite(): # only run the tests if _rl_accel is present try: import _rl_accel return makeSuiteForClasses(RlAccelTestCase) except ImportError: return None
radius = self._radius = self._cx-self.x self._radiusx = radiusx = radius self._radiusy = radiusy = (1.0 - self.perspective/100.0)*radius
radiusx = radiusy = self._cx-self.x if self.xradius: radiusx = self.xradius if self.yradius: radiusy = self.yradius self._radiusx = radiusx self._radiusy = (1.0 - self.perspective/100.0)*radiusy
def draw(self): slices = self.slices _3d_angle = self.angle_3d _3dva = self._3dva = _360(_3d_angle+90) a0 = _2rad(_3dva) self._xdepth_3d = cos(a0)*self.depth_3d self._ydepth_3d = sin(a0)*self.depth_3d self._cx = self.x+self.width/2.0 self._cy = self.y+(self.height - self._ydepth_3d)/2.0 radius = self._radius = self._cx...
print "Can't find cvs anywhere on the path"
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: os.environ['CVSROOT']=':pserver:%s@cvs:/cvsroot/reportlab' % USER do_exec(cvs+(' co -r %s reportlab'%release), 'the download phase') else: os.environ['CVSRO...
os.environ['CVSROOT']=':pserver:%s@cvs:/cvsroot/reportlab' % USER do_exec(cvs+(' co -r %s reportlab'%release), 'the download phase')
do_exec(cvs+(' export -r %s reportlab'%release), 'the export 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: os.environ['CVSROOT']=':pserver:%s@cvs:/cvsroot/reportlab' % USER do_exec(cvs+(' co -r %s reportlab'%release), 'the download phase') else: os.environ['CVSRO...
os.environ['CVSROOT']=':pserver:%s@cvs:/cvsroot/reportlab' % USER do_exec(cvs+' co reportlab', 'the download phase')
do_exec(cvs+' co reportlab', 'the checkout 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: os.environ['CVSROOT']=':pserver:%s@cvs:/cvsroot/reportlab' % USER do_exec(cvs+(' co -r %s reportlab'%release), 'the download phase') else: os.environ['CVSRO...
def find_src_files(L,d,N): if string.upper(os.path.basename(d))=='CVS': return for n in N: fn = os.path.normcase(os.path.normpath(os.path.join(d,n))) if os.path.isfile(fn): L.append(fn)
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)
src_files = [] os.path.walk(projdir,find_src_files,src_files)
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)
b = "%s" % release
b = 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)
safe_remove(zipfile) safe_remove(tarfile) if src_files==[]: return src_files = string.join(src_files)
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)
do_exec('%s czvf %s %s' % (tar, tarfile, src_files), 'tar creation')
if tar is not None: safe_remove(tarfile) do_exec('%s czvf %s %s' % (tar, tarfile, projdir), 'tar creation')
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)
do_exec('%s -u %s %s' % (zip, zipfile, src_files), 'zip creation')
if zip is not None: safe_remove(zipfile) do_exec('%s -ur %s %s' % (zip, zipfile, projdir), 'zip creation')
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)