bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def _do_under_lines(i, t_off, tx): y = tx.XtraState.cur_y - i*tx.XtraState.style.leading - tx.XtraState.f.fontSize/8.0 # 8.0 factor copied from para.py text = join(tx.lines[i][1]) textlen = tx._canvas.stringWidth(text, tx._fontname, tx._fontsize) tx._canvas.line(t_off, y, t_off+textlen, y) | def _do_under_lines(i, t_off, tx): y = tx.XtraState.cur_y - i*tx.XtraState.style.leading - tx.XtraState.f.fontSize/8.0 # 8.0 factor copied from para.py text = join(tx.XtraState.lines[i][1]) textlen = tx._canvas.stringWidth(text, tx._fontname, tx._fontsize) tx._canvas.line(t_off, y, t_off+textlen, y) | 4,500 |
def cvs_checkout(d,u): recursive_rmdir(d) cvs = find_exe('cvs') if cvs is None: print "Can't find cvs anywhere on the path" os.exit(1) have_tmp = os.path.isdir(_tmp) os.makedirs(d) os.environ['HOME']=d os.environ['CVSROOT']=':pserver:anonymous@cvs.reportlab.sourceforge.net:/cvsroot/reportlab' os.chdir(d) f = open(os.... | def cvs_checkout(d): recursive_rmdir(d) cvs = find_exe('cvs') if cvs is None: print "Can't find cvs anywhere on the path" os.exit(1) have_tmp = os.path.isdir(_tmp) os.makedirs(d) os.environ['HOME']=d os.environ['CVSROOT']=':pserver:anonymous@cvs.reportlab.sourceforge.net:/cvsroot/reportlab' os.chdir(d) f = open(os.pa... | 4,501 |
def _calcValueStep(self): '''Calculate _valueStep for the axis or get from valueStep.''' | def _calcValueStep(self): '''Calculate _valueStep for the axis or get from valueStep.''' | 4,502 |
def inForm(self): """specify that we are in a form xobject (disable page features, etc)""" if self.inObject not in ["form", None]: raise ValueError, "can't go in form already in object %s" % self.inObject self.inObject = "form" # don't need to do anything else, I think... | def inForm(self): """specify that we are in a form xobject (disable page features, etc)""" self.inObject = "form" # don't need to do anything else, I think... | 4,503 |
def registerTypeFace(face): assert isinstance(face, TypeFace), 'Not a TypeFace: %s' % face _typefaces[face.name] = face # HACK - bold/italic do not apply for type 1, so egister # all combinations of mappings. from reportlab.lib import fonts ttname = string.lower(face.name) if not face.name in standardFonts: fonts.addMa... | def registerTypeFace(face): assert isinstance(face, TypeFace), 'Not a TypeFace: %s' % face _typefaces[face.name] = face # HACK - bold/italic do not apply for type 1, so egister # all combinations of mappings. from reportlab.lib import fonts ttname = string.lower(face.name) if not face.name in standardFonts: fonts.addMa... | 4,504 |
def __init__(self,validate=None,desc=None,initial=None, **kw): self.validate = validate or isAnything self.desc = desc self.initial = initial for k,v in kw.items(): setattr(self,k,v) | def __init__(self,validate=None,desc=None,initial=None, **kw): self.validate = validate or isAnything self.desc = desc self._initial = initial for k,v in kw.items(): setattr(self,k,v) | 4,505 |
def __init__(self, data, colWidths=None, rowHeights=None, style=None, repeatRows=0, repeatCols=0, splitByRow=1, emptyTableAction=None): 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) self._cellvalue... | def __init__(self, data, colWidths=None, rowHeights=None, style=None, repeatRows=0, repeatCols=0, splitByRow=1, emptyTableAction=None): 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) self._cellvalue... | 4,506 |
def identity(self, maxLen=30): '''Identify our selves as well as possible''' vx = None nr = getattr(self,'_nrows','unknown') nc = getattr(self,'_ncols','unknown') cv = self._cellvalues if cv and 'unknown' not in (nr,nc): b = 0 for i in xrange(nr): for j in xrange(nc): v = cv[i][j] t = type(v) if t in _SeqTypes or isins... | def identity(self, maxLen=30): '''Identify our selves as well as possible''' vx = None nr = getattr(self,'_nrows','unknown') nc = getattr(self,'_ncols','unknown') cv = getattr(self,'_cellvalues',None) if cv and 'unknown' not in (nr,nc): b = 0 for i in xrange(nr): for j in xrange(nc): v = cv[i][j] t = type(v) if t in _S... | 4,507 |
def getModuleObjects(folder, rootName, typ): "Get a list of all function objects defined *somewhere* in a package." folders = [folder] + subFoldersOfFolder(folder) objects = [] for f in folders: sys.path.insert(0, f) os.chdir(f) pattern = os.path.join('*.py') prefix = f[string.find(f, rootName):] prefix = string.repl... | def getModuleObjects(folder, rootName, typ): "Get a list of all function objects defined *somewhere* in a package." folders = [folder] + subFoldersOfFolder(folder) objects = [] for f in folders: sys.path.insert(0, f) os.chdir(f) pattern = os.path.join('*.py') prefix = f[string.find(f, rootName):] prefix = string.repl... | 4,508 |
def getModuleObjects(folder, rootName, typ): "Get a list of all function objects defined *somewhere* in a package." folders = [folder] + subFoldersOfFolder(folder) objects = [] for f in folders: sys.path.insert(0, f) os.chdir(f) pattern = os.path.join('*.py') prefix = f[string.find(f, rootName):] prefix = string.repl... | def getModuleObjects(folder, rootName, typ): "Get a list of all function objects defined *somewhere* in a package." folders = [folder] + subFoldersOfFolder(folder) objects = [] for f in folders: sys.path.insert(0, f) os.chdir(f) pattern = os.path.join('*.py') prefix = f[string.find(f, rootName):] prefix = string.repl... | 4,509 |
def getModuleObjects(folder, rootName, typ): "Get a list of all function objects defined *somewhere* in a package." folders = [folder] + subFoldersOfFolder(folder) objects = [] for f in folders: sys.path.insert(0, f) os.chdir(f) pattern = os.path.join('*.py') prefix = f[string.find(f, rootName):] prefix = string.repl... | def getModuleObjects(folder, rootName, typ): "Get a list of all function objects defined *somewhere* in a package." folders = [folder] + subFoldersOfFolder(folder) objects = [] for f in folders: sys.path.insert(0, f) os.chdir(f) pattern = os.path.join('*.py') prefix = f[string.find(f, rootName):] prefix = string.repl... | 4,510 |
def getModuleObjects(folder, rootName, typ): "Get a list of all function objects defined *somewhere* in a package." folders = [folder] + subFoldersOfFolder(folder) objects = [] for f in folders: sys.path.insert(0, f) os.chdir(f) pattern = os.path.join('*.py') prefix = f[string.find(f, rootName):] prefix = string.repl... | def getModuleObjects(folder, rootName, typ): "Get a list of all function objects defined *somewhere* in a package." folders = [folder] + subFoldersOfFolder(folder) objects = [] for f in folders: sys.path.insert(0, f) os.chdir(f) pattern = os.path.join('*.py') prefix = f[string.find(f, rootName):] prefix = string.repl... | 4,511 |
def getModuleObjects(folder, rootName, typ): "Get a list of all function objects defined *somewhere* in a package." folders = [folder] + subFoldersOfFolder(folder) objects = [] for f in folders: sys.path.insert(0, f) os.chdir(f) pattern = os.path.join('*.py') prefix = f[string.find(f, rootName):] prefix = string.repl... | def getModuleObjects(folder, rootName, typ): "Get a list of all function objects defined *somewhere* in a package." folders = [folder] + subFoldersOfFolder(folder) objects = [] for f in folders: sys.path.insert(0, f) os.chdir(f) pattern = os.path.join('*.py') prefix = f[string.find(f, rootName):] prefix = string.repl... | 4,512 |
def _writeLogFile(self, objType): "Write log file for different kind of documentable objects." cwd = os.getcwd() | def _writeLogFile(self, objType): "Write log file for different kind of documentable objects." cwd = os.getcwd() | 4,513 |
def _writeLogFile(self, objType): "Write log file for different kind of documentable objects." cwd = os.getcwd() | def _writeLogFile(self, objType): "Write log file for different kind of documentable objects." cwd = os.getcwd() | 4,514 |
def makeSuite(): suite = unittest.TestSuite() suite.addTest(DocstringTestCase('test1')) suite.addTest(DocstringTestCase('test2')) suite.addTest(DocstringTestCase('test3')) suite.addTest(DocstringTestCase('test4')) return suite | def makeSuite(): suite = unittest.TestSuite() suite.addTest(DocstringTestCase('test1')) suite.addTest(DocstringTestCase('test2')) suite.addTest(DocstringTestCase('test3')) suite.addTest(DocstringTestCase('test4')) return suite | 4,515 |
def makeSuite(): suite = unittest.TestSuite() suite.addTest(DocstringTestCase('test1')) suite.addTest(DocstringTestCase('test2')) suite.addTest(DocstringTestCase('test3')) suite.addTest(DocstringTestCase('test4')) return suite | defmakeSuite():suite=unittest.TestSuite()suite.addTest(DocstringTestCase('test1'))suite.addTest(DocstringTestCase('test2'))suite.addTest(DocstringTestCase('test3'))suite.addTest(DocstringTestCase('test4'))returnsuite | 4,516 |
def __getitem__(self, index): try: return self._children[index] except KeyError: Klass = self._prototype if Klass in _ItemWrapper.keys(): WKlass = _ItemWrapper[Klass] else: class WKlass(Klass): def __getattr__(self,name): try: return Klass.__getattr__(self,name) except: return getattr(self._parent,name) _ItemWrapper[Kl... | def __getitem__(self, index): try: return self._children[index] except KeyError: Klass = self._prototype if _ItemWrapper.has_key(Klass): WKlass = _ItemWrapper[Klass] else: class WKlass(Klass): def __getattr__(self,name): try: return Klass.__getattr__(self,name) except: return getattr(self._parent,name) _ItemWrapper[Kla... | 4,517 |
def __getattr__(self,name): try: return Klass.__getattr__(self,name) except: return getattr(self._parent,name) | def __getattr__(self,name): try: return self.__class__.__bases__[0].__getattr__(self,name) except: return getattr(self._parent,name) | 4,518 |
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.""" | 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.""" | 4,519 |
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.""" | 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.""" | 4,520 |
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.""" | 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.""" | 4,521 |
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.""" | 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.""" | 4,522 |
def run(): started = time.time() canv = canvas.Canvas('odyssey.pdf') canv.setPageCompression(0) drawPageFrame(canv) #do some title page stuff canv.setFont("Times-Bold", 36) canv.drawCentredString(0.5 * A4[0], 7 * inch, "Homer's Odyssey") canv.setFont("Times-Bold", 18) canv.drawCentredString(0.5 * A4[0], 5 * inch, "Tr... | def run(): started = time.time() canv = canvas.Canvas('odyssey.pdf') canv.setPageCompression(0) drawPageFrame(canv) #do some title page stuff canv.setFont("Times-Bold", 36) canv.drawCentredString(0.5 * A4[0], 7 * inch, "Homer's Odyssey") canv.setFont("Times-Bold", 18) canv.drawCentredString(0.5 * A4[0], 5 * inch, "Tr... | 4,523 |
def run(): started = time.time() canv = canvas.Canvas('odyssey.pdf') canv.setPageCompression(0) drawPageFrame(canv) #do some title page stuff canv.setFont("Times-Bold", 36) canv.drawCentredString(0.5 * A4[0], 7 * inch, "Homer's Odyssey") canv.setFont("Times-Bold", 18) canv.drawCentredString(0.5 * A4[0], 5 * inch, "Tr... | def run(): started = time.time() canv = canvas.Canvas('odyssey.pdf') canv.setPageCompression(0) drawPageFrame(canv) #do some title page stuff canv.setFont("Times-Bold", 36) canv.drawCentredString(0.5 * A4[0], 7 * inch, "Homer's Odyssey") canv.setFont("Times-Bold", 18) canv.drawCentredString(0.5 * A4[0], 5 * inch, "Tr... | 4,524 |
def handle_pageEnd(self): ''' show the current page check the next page template hang a page begin ''' #detect infinite loops... if self._curPageFlowableCount == 0: self._emptyPages = self._emptyPages + 1 else: self._emptyPages = 0 if self._emptyPages >= self._emptyPagesAllowed: if 1: ident = "More than %d pages genera... | def handle_pageEnd(self): ''' show the current page check the next page template hang a page begin ''' #detect infinite loops... if self._curPageFlowableCount == 0: self._emptyPages = self._emptyPages + 1 else: self._emptyPages = 0 if self._emptyPages >= self._emptyPagesAllowed: if 1: ident = "More than %d pages genera... | 4,525 |
def draw(self): from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_RIGHT, TA_JUSTIFY style = self.style lines = self.lines rightIndent = style.rightIndent leftIndent = style.leftIndent leading = style.leading font = style.fontName size = style.fontSize alignment = style.alignment firstindent = style.firstLineIndent... | def draw(self): from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_RIGHT, TA_JUSTIFY style = self.style lines = self.lines rightIndent = style.rightIndent leftIndent = style.leftIndent leading = style.leading font = style.fontName size = style.fontSize alignment = style.alignment firstindent = style.firstLineIndent... | 4,526 |
def draw(self): from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_RIGHT, TA_JUSTIFY style = self.style lines = self.lines rightIndent = style.rightIndent leftIndent = style.leftIndent leading = style.leading font = style.fontName size = style.fontSize alignment = style.alignment firstindent = style.firstLineIndent... | def draw(self): from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_RIGHT, TA_JUSTIFY style = self.style lines = self.lines rightIndent = style.rightIndent leftIndent = style.leftIndent leading = style.leading font = style.fontName size = style.fontSize alignment = style.alignment firstindent = style.firstLineIndent... | 4,527 |
def test(): from pprint import pprint #print test_program; return from reportlab.pdfgen import canvas from reportlab.lib.units import inch fn = "paratest0.pdf" c = canvas.Canvas(fn) test2(c) c.showPage() if 1: remainder = test_program + test_program + test_program laststate = {} while remainder: print "NEW PAGE" c.tran... | def test(): from pprint import pprint #print test_program; return from reportlab.pdfgen import canvas from reportlab.lib.units import inch fn = "paratest0.pdf" c = canvas.Canvas(fn) test2(c) c.showPage() if 1: remainder = test_program + test_program + test_program laststate = {} while remainder: print "NEW PAGE" c.tran... | 4,528 |
def __init__(self): self.objects = [] self.objectPositions = {} self.fonts = MakeType1Fonts() | def __init__(self): self.objects = [] self.objectPositions = {} self.fonts = MakeType1Fonts() | 4,529 |
def add(self, key, obj): self.objectPositions[key] = len(self.objects) # its position self.objects.append(obj) #obj.doc = self return len(self.objects) - 1 # give its position | def add(self, key, obj): self.objectPositions[key] = len(self.objects)+1 # its position self.objects.append(obj) #obj.doc = self return len(self.objects) - 1 # give its position | 4,530 |
def add(self, key, obj): self.objectPositions[key] = len(self.objects) # its position self.objects.append(obj) #obj.doc = self return len(self.objects) - 1 # give its position | def add(self, key, obj): self.objectPositions[key] = len(self.objects) # its position self.objects.append(obj) #obj.doc = self return self.getPosition(key) # give its position | 4,531 |
def addPage(self, page): """adds page and stream at end. Maintains pages list""" #page.buildstream() pos = len(self.objects) # work out where added page.ParentPos = 3 #pages collection page.info = { 'parentpos':3, 'fontdict':self.fontdict, 'contentspos':pos + 2, } self.PageCol.PageList.append(pos+1) self.add('Page... | def addPage(self, page): """adds page and stream at end. Maintains pages list""" #page.buildstream() pos = len(self.objects) # work out where added page.ParentPos = self.getPosition("PagesTreeRoot") #pages collection page.info = { 'parentpos':3, 'fontdict':self.fontdict, 'contentspos':pos + 2, } self.PageCol.PageL... | 4,532 |
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... | 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... | 4,533 |
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... | 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... | 4,534 |
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... | 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... | 4,535 |
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... | 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... | 4,536 |
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,537 |
def handle_pageEnd(self): ''' show the current page check the next page template hang a page begin ''' #detect infinite loops... if self._curPageFlowableCount == 0: self._emptyPages = self._emptyPages + 1 else: self._emptyPages = 0 if self._emptyPages >= self._emptyPagesAllowed: if 1: raise LayoutError("More than %d pa... | def handle_pageEnd(self): ''' show the current page check the next page template hang a page begin ''' #detect infinite loops... if self._curPageFlowableCount == 0: self._emptyPages = self._emptyPages + 1 else: self._emptyPages = 0 if self._emptyPages >= self._emptyPagesAllowed: if 1: ident = "More than %d pages genera... | 4,538 |
def handle_flowable(self,flowables): '''try to handle one flowable from the front of list flowables.''' | def handle_flowable(self,flowables): '''try to handle one flowable from the front of list flowables.''' | 4,539 |
def handle_flowable(self,flowables): '''try to handle one flowable from the front of list flowables.''' | def handle_flowable(self,flowables): '''try to handle one flowable from the front of list flowables.''' | 4,540 |
def __init__(self,filename,pagesize=(595.27,841.89), bottomup = 1, pageCompression=0 ): """Most of the attributes are private - we will use set/get methods as the preferred interface. Default page size is A4.""" self._filename = filename self._doc = pdfdoc.PDFDocument() self._pagesize = pagesize #self._currentPageHasI... | def __init__(self,filename,pagesize=(595.27,841.89), bottomup = 1, pageCompression=0 ): """Most of the attributes are private - we will use set/get methods as the preferred interface. Default page size is A4.""" self._filename = filename self._doc = pdfdoc.PDFDocument() self._pagesize = pagesize #self._currentPageHasI... | 4,541 |
def showPage(self): """This is where the fun happens""" page = pdfdoc.PDFPage() page.pagewidth = self._pagesize[0] page.pageheight = self._pagesize[1] page.hasImages = self._currentPageHasImages page.pageTransitionString = self._pageTransitionString page.setCompression(self._pageCompression) #print stream page.setStrea... | def showPage(self): """This is where the fun happens""" page = pdfdoc.PDFPage() page.pagewidth = self._pagesize[0] page.pageheight = self._pagesize[1] page.hasImages = self._currentPageHasImages page.pageTransitionString = self._pageTransitionString page.setCompression(self._pageCompression) #print stream page.setStrea... | 4,542 |
def showPage(self): """This is where the fun happens""" page = pdfdoc.PDFPage() page.pagewidth = self._pagesize[0] page.pageheight = self._pagesize[1] page.hasImages = self._currentPageHasImages page.pageTransitionString = self._pageTransitionString page.setCompression(self._pageCompression) #print stream page.setStrea... | def showPage(self): """This is where the fun happens""" page = pdfdoc.PDFPage() page.pagewidth = self._pagesize[0] page.pageheight = self._pagesize[1] page.hasImages = self._currentPageHasImages page.pageTransitionString = self._pageTransitionString page.setCompression(self._pageCompression) #print stream page.setStrea... | 4,543 |
def setXObjects(self, thing): """for pages and forms, define the XObject dictionary for resources, if needed""" forms = self._formsinuse if forms: xobjectsdict = self._doc.xobjDict(forms) thing.XObjects = xobjectsdict else: thing.XObjects = None | def _setXObjects(self, thing): """for pages and forms, define the XObject dictionary for resources, if needed""" forms = self._formsinuse if forms: xobjectsdict = self._doc.xobjDict(forms) thing.XObjects = xobjectsdict else: thing.XObjects = None | 4,544 |
def bookmarkReference(self, name): """get a reference to a (possibly undefined, possibly unbound) bookmark""" d = self._destinations try: return d[name] except: result = d[name] = pdfdoc.Destination(name) # newly defined, unbound return result | def _bookmarkReference(self, name): """get a reference to a (possibly undefined, possibly unbound) bookmark""" d = self._destinations try: return d[name] except: result = d[name] = pdfdoc.Destination(name) # newly defined, unbound return result | 4,545 |
def bookmarkPage(self, name): """bind a bookmark (destination) to the current page""" # XXXX there are a lot of other ways a bookmark destination can be bound: should be implemented. # XXXX the other ways require tracking of the graphics state.... dest = self.bookmarkReference(name) pageref = self._doc.thisPageRef() de... | def bookmarkPage(self, name): """bind a bookmark (destination) to the current page""" # XXXX there are a lot of other ways a bookmark destination can be bound: should be implemented. # XXXX the other ways require tracking of the graphics state.... dest = self._bookmarkReference(name) pageref = self._doc.thisPageRef() d... | 4,546 |
def bookmarkHorizontalInPageAbsolute(self, name, yhorizontal): """bind a bookmark (destination to the current page at a horizontal position""" dest = self.bookmarkReference(name) pageref = self._doc.thisPageRef() dest.fith(yhorizontal) dest.setPageRef(pageref) return dest | def bookmarkHorizontalAbsolute(self, name, yhorizontal): """bind a bookmark (destination to the current page at a horizontal position""" dest = self.bookmarkReference(name) pageref = self._doc.thisPageRef() dest.fith(yhorizontal) dest.setPageRef(pageref) return dest | 4,547 |
def bookmarkHorizontalInPageAbsolute(self, name, yhorizontal): """bind a bookmark (destination to the current page at a horizontal position""" dest = self.bookmarkReference(name) pageref = self._doc.thisPageRef() dest.fith(yhorizontal) dest.setPageRef(pageref) return dest | def bookmarkHorizontalInPageAbsolute(self, name, yhorizontal): """bind a bookmark (destination to the current page at a horizontal position""" dest = self._bookmarkReference(name) pageref = self._doc.thisPageRef() dest.fith(yhorizontal) dest.setPageRef(pageref) return dest | 4,548 |
def restartAccumulators(self): self._code = [] # ready for more... self._currentPageHasImages = 1 # for safety... self._formsinuse = [] self._annotationrefs = [] | def _restartAccumulators(self): self._code = [] # ready for more... self._currentPageHasImages = 1 # for safety... self._formsinuse = [] self._annotationrefs = [] | 4,549 |
def makeForm(self, name, lowerx=0, lowery=0, upperx=None, uppery=None): """Like showpage, but make a form using accumulated operations instead""" (w,h) = self._pagesize if upperx is None: upperx=w if uppery is None: uppery=h form = pdfdoc.PDFFormXObject(lowerx=lowerx, lowery=lowery, upperx=upperx, uppery=uppery) form.c... | def makeForm(self, name, lowerx=0, lowery=0, upperx=None, uppery=None): """Like showpage, but make a form using accumulated operations instead""" (w,h) = self._pagesize if upperx is None: upperx=w if uppery is None: uppery=h form = pdfdoc.PDFFormXObject(lowerx=lowerx, lowery=lowery, upperx=upperx, uppery=uppery) form.c... | 4,550 |
def makeForm(self, name, lowerx=0, lowery=0, upperx=None, uppery=None): """Like showpage, but make a form using accumulated operations instead""" (w,h) = self._pagesize if upperx is None: upperx=w if uppery is None: uppery=h form = pdfdoc.PDFFormXObject(lowerx=lowerx, lowery=lowery, upperx=upperx, uppery=uppery) form.c... | def makeForm(self, name, lowerx=0, lowery=0, upperx=None, uppery=None): """Like showpage, but make a form using accumulated operations instead""" (w,h) = self._pagesize if upperx is None: upperx=w if uppery is None: uppery=h form = pdfdoc.PDFFormXObject(lowerx=lowerx, lowery=lowery, upperx=upperx, uppery=uppery) form.c... | 4,551 |
def textAnnotation(self, contents, Rect=None, addtopage=1, name=None, **kw): if not Rect: (w,h) = self._pagesize# default to whole page (?) Rect = (0,0,w,h) annotation = apply(pdfdoc.TextAnnotation, (Rect, contents), kw) self.addAnnotation(annotation, name, addtopage) | def textAnnotation(self, contents, Rect=None, addtopage=1, name=None, **kw): if not Rect: (w,h) = self._pagesize# default to whole page (?) Rect = (0,0,w,h) annotation = apply(pdfdoc.TextAnnotation, (Rect, contents), kw) self._addAnnotation(annotation, name, addtopage) | 4,552 |
def linkAnnotationAbsolute(self, contents, destinationname, Rect=None, addtopage=1, name=None, **kw): """link annotation positioned wrt the default user space""" destination = self.bookmarkReference(destinationname) # permitted to be undefined... must bind later... (w,h) = self._pagesize if not Rect: Rect = (0,0,w,h) k... | def linkAbsolute(self, contents, destinationname, Rect=None, addtopage=1, name=None, **kw): """link annotation positioned wrt the default user space""" destination = self.bookmarkReference(destinationname) # permitted to be undefined... must bind later... (w,h) = self._pagesize if not Rect: Rect = (0,0,w,h) kw["Rect"] ... | 4,553 |
def linkAnnotationAbsolute(self, contents, destinationname, Rect=None, addtopage=1, name=None, **kw): """link annotation positioned wrt the default user space""" destination = self.bookmarkReference(destinationname) # permitted to be undefined... must bind later... (w,h) = self._pagesize if not Rect: Rect = (0,0,w,h) k... | def linkAnnotationAbsolute(self, contents, destinationname, Rect=None, addtopage=1, name=None, **kw): """link annotation positioned wrt the default user space""" destination = self._bookmarkReference(destinationname) # permitted to be undefined... must bind later... (w,h) = self._pagesize if not Rect: Rect = (0,0,w,h) ... | 4,554 |
def linkAnnotationAbsolute(self, contents, destinationname, Rect=None, addtopage=1, name=None, **kw): """link annotation positioned wrt the default user space""" destination = self.bookmarkReference(destinationname) # permitted to be undefined... must bind later... (w,h) = self._pagesize if not Rect: Rect = (0,0,w,h) k... | def linkAnnotationAbsolute(self, contents, destinationname, Rect=None, addtopage=1, name=None, **kw): """link annotation positioned wrt the default user space""" destination = self.bookmarkReference(destinationname) # permitted to be undefined... must bind later... (w,h) = self._pagesize if not Rect: Rect = (0,0,w,h) k... | 4,555 |
def addAnnotation(self, annotation, name=None, addtopage=1): count = self.annotationCount = self.annotationCount+1 if not name: name="NUMBER"+repr(count) self._doc.addAnnotation(name, annotation) if addtopage: self.annotatePage(name) | def _addAnnotation(self, annotation, name=None, addtopage=1): count = self._annotationCount = self._annotationCount+1 if not name: name="NUMBER"+repr(count) self._doc.addAnnotation(name, annotation) if addtopage: self.annotatePage(name) | 4,556 |
def addAnnotation(self, annotation, name=None, addtopage=1): count = self.annotationCount = self.annotationCount+1 if not name: name="NUMBER"+repr(count) self._doc.addAnnotation(name, annotation) if addtopage: self.annotatePage(name) | def addAnnotation(self, annotation, name=None, addtopage=1): count = self.annotationCount = self.annotationCount+1 if not name: name="NUMBER"+repr(count) self._doc.addAnnotation(name, annotation) if addtopage: self._annotatePage(name) | 4,557 |
def annotatePage(self, name): ref = self._doc.refAnnotation(name) self._annotationrefs.append(ref) | def _annotatePage(self, name): ref = self._doc.refAnnotation(name) self._annotationrefs.append(ref) | 4,558 |
def _runTests(pyRXP): global _pyRXP _pyRXP = pyRXP print >>_logf, '############# Testing',pyRXP.__name__ try: for k,v in pyRXP.parser_flags.items(): eval('pyRXP.Parser(%s=%d)' % (k,v)) print >>_logf,'Parser keywords OK' _dot('.') except: traceback.print_exc() print >>_logf,'Parser keywords BAD' _dot('E') try: for k,v i... | def _runTests(pyRXP): global _pyRXP _pyRXP = pyRXP print >>_logf, '############# Testing',pyRXP.__name__ try: for k,v in pyRXP.parser_flags.items(): eval('pyRXP.Parser(%s=%d)' % (k,v)) print >>_logf,'Parser keywords OK' _dot('.') except: traceback.print_exc() print >>_logf,'Parser keywords BAD' _dot('E') try: for k,v i... | 4,559 |
def _runTests(pyRXP): global _pyRXP _pyRXP = pyRXP print >>_logf, '############# Testing',pyRXP.__name__ try: for k,v in pyRXP.parser_flags.items(): eval('pyRXP.Parser(%s=%d)' % (k,v)) print >>_logf,'Parser keywords OK' _dot('.') except: traceback.print_exc() print >>_logf,'Parser keywords BAD' _dot('E') try: for k,v i... | def _runTests(pyRXP): global _pyRXP _pyRXP = pyRXP print >>_logf, '############# Testing',pyRXP.__name__ try: for k,v in pyRXP.parser_flags.items(): eval('pyRXP.Parser(%s=%d)' % (k,v)) print >>_logf,'Parser keywords OK' _dot('.') except: traceback.print_exc() print >>_logf,'Parser keywords BAD' _dot('E') try: for k,v i... | 4,560 |
def _runTests(pyRXP): global _pyRXP _pyRXP = pyRXP print >>_logf, '############# Testing',pyRXP.__name__ try: for k,v in pyRXP.parser_flags.items(): eval('pyRXP.Parser(%s=%d)' % (k,v)) print >>_logf,'Parser keywords OK' _dot('.') except: traceback.print_exc() print >>_logf,'Parser keywords BAD' _dot('E') try: for k,v i... | def _runTests(pyRXP): global _pyRXP _pyRXP = pyRXP print >>_logf, '############# Testing',pyRXP.__name__ try: for k,v in pyRXP.parser_flags.items(): eval('pyRXP.Parser(%s=%d)' % (k,v)) print >>_logf,'Parser keywords OK' _dot('.') except: traceback.print_exc() print >>_logf,'Parser keywords BAD' _dot('E') try: for k,v i... | 4,561 |
def getDifferences(self, otherEnc): """Return a compact list of the code points differing between two encodings | def getDifferences(self, otherEnc): """Return a compact list of the code points differing between two encodings | 4,562 |
def getDifferences(self, otherEnc): """Return a compact list of the code points differing between two encodings | def getDifferences(self, otherEnc): """Return a compact list of the code points differing between two encodings | 4,563 |
def testStringWidthAlgorithms(): rawdata = open('../../rlextra/rml2pdf/doc/rml_user_guide.rml').read() print 'rawdata length %d' % len(rawdata) print 'test one huge string...' test3widths([rawdata]) print words = string.split(rawdata) print 'test %d shorter strings (average length %0.2f chars)...' % (len(words), 1.0*le... | def testStringWidthAlgorithms(): rawdata = open('../../rlextra/rml2pdf/doc/rml_user_guide.prep').read() print 'rawdata length %d' % len(rawdata) print 'test one huge string...' test3widths([rawdata]) print words = string.split(rawdata) print 'test %d shorter strings (average length %0.2f chars)...' % (len(words), 1.0*l... | 4,564 |
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... | 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... | 4,565 |
def sample0a(): "Make a degenerated pie chart with only one slice." d = Drawing(400, 200) pc = Pie() pc.x = 150 pc.y = 50 pc.data = [10] pc.labels = ['a'] pc.defaultStyles.strokeWidth=1#0.5 d.add(pc) return d | def sample0a(): "Make a degenerated pie chart with only one slice." d = Drawing(400, 200) pc = Pie() pc.x = 150 pc.y = 50 pc.data = [10] pc.labels = ['a'] pc.defaultStyles.strokeWidth=1#0.5 d.add(pc) return d | 4,566 |
def sample0b(): "Make a degenerated pie chart with only one slice." d = Drawing(400, 200) pc = Pie() pc.x = 150 pc.y = 50 pc.width = 120 pc.height = 100 pc.data = [10] pc.labels = ['a'] pc.defaultStyles.strokeWidth=1#0.5 d.add(pc) return d | def sample0b(): "Make a degenerated pie chart with only one slice." d = Drawing(400, 200) pc = Pie() pc.x = 150 pc.y = 50 pc.width = 120 pc.height = 100 pc.data = [10] pc.labels = ['a'] pc.defaultStyles.strokeWidth=1#0.5 d.add(pc) return d | 4,567 |
def sample1(): "Make a typical pie chart with with one slice treated in a special way." d = Drawing(400, 200) pc = Pie() pc.x = 150 pc.y = 50 pc.data = [10, 20, 30, 40, 50, 60] pc.labels = ['a', 'b', 'c', 'd', 'e', 'f'] pc.defaultStyles.strokeWidth=1#0.5 pc.defaultStyles[3].popout = 20 pc.defaultStyles[3].strokeWidt... | def sample1(): "Make a typical pie chart with with one slice treated in a special way." d = Drawing(400, 200) pc = Pie() pc.x = 150 pc.y = 50 pc.data = [10, 20, 30, 40, 50, 60] pc.labels = ['a', 'b', 'c', 'd', 'e', 'f'] pc.defaultStyles.strokeWidth=1#0.5 pc.defaultStyles[3].popout = 20 pc.defaultStyles[3].strokeWidt... | 4,568 |
def sample2(): "Make a pie chart with nine slices." d = Drawing(400, 200) pc = Pie() pc.x = 125 pc.y = 25 pc.data = [0.31, 0.148, 0.108, 0.076, 0.033, 0.03, 0.019, 0.126, 0.15] pc.labels = ['1', '2', '3', '4', '5', '6', '7', '8', 'X'] pc.width = 150 pc.height = 150 pc.defaultStyles.strokeWidth=1#0.5 pc.defaultStyle... | def sample2(): "Make a pie chart with nine slices." d = Drawing(400, 200) pc = Pie() pc.x = 125 pc.y = 25 pc.data = [0.31, 0.148, 0.108, 0.076, 0.033, 0.03, 0.019, 0.126, 0.15] pc.labels = ['1', '2', '3', '4', '5', '6', '7', '8', 'X'] pc.width = 150 pc.height = 150 pc.defaultStyles.strokeWidth=1#0.5 pc.defaultStyle... | 4,569 |
def sample3(): "Make a pie chart with a very slim slice." d = Drawing(400, 200) pc = Pie() pc.x = 125 pc.y = 25 pc.data = [74, 1, 25] pc.width = 150 pc.height = 150 pc.defaultStyles.strokeWidth=1#0.5 pc.defaultStyles[0].fillColor = colors.steelblue pc.defaultStyles[1].fillColor = colors.thistle pc.defaultStyles[2].... | def sample3(): "Make a pie chart with a very slim slice." d = Drawing(400, 200) pc = Pie() pc.x = 125 pc.y = 25 pc.data = [74, 1, 25] pc.width = 150 pc.height = 150 pc.defaultStyles.strokeWidth=1#0.5 pc.defaultStyles[0].fillColor = colors.steelblue pc.defaultStyles[1].fillColor = colors.thistle pc.defaultStyles[2].... | 4,570 |
def provideNode(self): return self.draw() | def provideNode(self): return self.draw() | 4,571 |
def __getitem__(self, index): try: return self._children[index] except KeyError: Klass = self._prototype if Klass in _ElementWrapper.keys(): WKlass = _ElementWrapper[Klass] else: class WKlass(Klass): def __getattr__(self,name): try: return Klass.__getattr__(self,name) except: return getattr(self._parent,name) | def __getitem__(self, index): try: return self._children[index] except KeyError: Klass = self._prototype if Klass in _ItemWrapper.keys(): WKlass = _ItemWrapper[Klass] else: class WKlass(Klass): def __getattr__(self,name): try: return Klass.__getattr__(self,name) except: return getattr(self._parent,name) | 4,572 |
def __init__(self, encoding=rl_config.defaultEncoding, dummyoutline=0, compression=rl_config.pageCompression, invariant=rl_config.invariant): #self.defaultStreamFilters = [PDFBase85Encode, PDFZCompress] # for testing! #self.defaultStreamFilters = [PDFZCompress] # for testing! assert encoding in ['MacRomanEncoding', 'Wi... | def __init__(self, encoding=rl_config.defaultEncoding, dummyoutline=0, compression=rl_config.pageCompression, invariant=rl_config.invariant): #self.defaultStreamFilters = [PDFBase85Encode, PDFZCompress] # for testing! #self.defaultStreamFilters = [PDFZCompress] # for testing! assert encoding in ['MacRomanEncoding', 'Wi... | 4,573 |
def __init__(self, encoding=rl_config.defaultEncoding, dummyoutline=0, compression=rl_config.pageCompression, invariant=rl_config.invariant): #self.defaultStreamFilters = [PDFBase85Encode, PDFZCompress] # for testing! #self.defaultStreamFilters = [PDFZCompress] # for testing! assert encoding in ['MacRomanEncoding', 'Wi... | def __init__(self, encoding=rl_config.defaultEncoding, dummyoutline=0, compression=rl_config.pageCompression, invariant=rl_config.invariant): #self.defaultStreamFilters = [PDFBase85Encode, PDFZCompress] # for testing! #self.defaultStreamFilters = [PDFZCompress] # for testing! assert encoding in ['MacRomanEncoding', 'Wi... | 4,574 |
def __init__(self): self.invariant = 1 self.title = "untitled" self.author = "anonymous" self.subject = "unspecified" #now = time.localtime(time.time()) #self.datestr = '%04d%02d%02d%02d%02d%02d' % tuple(now[0:6]) | def __init__(self): self.invariant = rl_config.invariant self.title = "untitled" self.author = "anonymous" self.subject = "unspecified" #now = time.localtime(time.time()) #self.datestr = '%04d%02d%02d%02d%02d%02d' % tuple(now[0:6]) | 4,575 |
def __init__(self): self.invariant = 1 self.title = "untitled" self.author = "anonymous" self.subject = "unspecified" #now = time.localtime(time.time()) #self.datestr = '%04d%02d%02d%02d%02d%02d' % tuple(now[0:6]) | def __init__(self): self.invariant = 1 self.title = "untitled" self.author = "anonymous" self.subject = "unspecified" #now = time.localtime(time.time()) #self.datestr = '%04d%02d%02d%02d%02d%02d' % tuple(now[0:6]) | 4,576 |
def format(self, document): D = {} D["Title"] = PDFString(self.title) D["Author"] = PDFString(self.author) if self.invariant: D["CreationDate"] = PDFString('19001231000000') else: D["CreationDate"] = PDFDate() D["Producer"] = PDFString("ReportLab http://www.reportlab.com") D["Subject"] = PDFString(self.subject) PD = PD... | def format(self, document): D = {} D["Title"] = PDFString(self.title) D["Author"] = PDFString(self.author) D["CreationDate"] = PDFDate(invariant=self.invariant) D["Producer"] = PDFString("ReportLab http://www.reportlab.com") D["Subject"] = PDFString(self.subject) PD = PDFDictionary(D) return PD.format(document) | 4,577 |
def format(self, document): A = PDFArray([self.llx, self.lly, self.ulx, self.ury]) return format(A, document) | def format(self, document): A = PDFArray([self.llx, self.lly, self.ulx, self.ury]) return format(A, document) | 4,578 |
def __init__(self, yyyy=nowyyyy, mm=nowmm, dd=nowdd, hh=nowhh, m=nowm, s=nows): self.yyyy=yyyy; self.mm=mm; self.dd=dd; self.hh=hh; self.m=m; self.s=s | def __init__(self, yyyy=None, mm=None, dd=None, hh=None, m=None, s=None, invariant=rl_config.invariant): if None in (yyyy, mm, dd, hh, m, s): if invariant: now = 1900,01,01,00,00,00,0 else: global _NOW if _NOW is None: import time _NOW = tuple(time.localtime(time.time())[:6]) now = _NOW if yyyy is None: yyyy=now[0] if ... | 4,579 |
def format(self, doc): S = PDFString(DATEFMT % (self.yyyy, self.mm, self.dd, self.hh, self.m, self.s)) return format(S, doc) | def format(self, doc): S = PDFString('%04d%02d%02d%02d%02d%02d' % (self.yyyy, self.mm, self.dd, self.hh, self.m, self.s)) return format(S, doc) | 4,580 |
def __init__(self, fileName): if isinstance(fileName,ImageReader): self.__dict__ = fileName.__dict__ #borgize return if not haveImages: raise RuntimeError('Imaging Library not available, unable to import bitmaps') #start wih lots of null private fields, to be populated by #the relevant engine. self.fileName = fileNam... | def __init__(self, fileName): if isinstance(fileName,ImageReader): self.__dict__ = fileName.__dict__ #borgize return if not haveImages: raise RuntimeError('Imaging Library not available, unable to import bitmaps') #start wih lots of null private fields, to be populated by #the relevant engine. self.fileName = self._i... | 4,581 |
def _calc(self): if hasattr(self,'_width'): return | def _calc(self): if hasattr(self,'_width'): return | 4,582 |
def _calc(self): if hasattr(self,'_width'): return | def_calc(self):ifhasattr(self,'_width'):return | 4,583 |
def _calc(self): if hasattr(self,'_width'): return | def _calc(self): if hasattr(self,'_width'): return | 4,584 |
def _calc(self): if hasattr(self,'_width'): return | def _calc(self): if hasattr(self,'_width'): return | 4,585 |
def _splitRows(self,availHeight): h = 0 n = 0 lim = len(self._rowHeights) while n<lim: hn = h + self._rowHeights[n] if hn>availHeight: break h = hn n = n + 1 | def _splitRows(self,availHeight): h = 0 n = 0 lim = len(self._rowHeights) while n<lim: hn = h + self._rowHeights[n] if hn>availHeight: break h = hn n = n + 1 | 4,586 |
def _splitRows(self,availHeight): h = 0 n = 0 lim = len(self._rowHeights) while n<lim: hn = h + self._rowHeights[n] if hn>availHeight: break h = hn n = n + 1 | def _splitRows(self,availHeight): h = 0 n = 0 lim = len(self._rowHeights) while n<lim: hn = h + self._rowHeights[n] if hn>availHeight: break h = hn n = n + 1 | 4,587 |
def _splitRows(self,availHeight): h = 0 n = 0 lim = len(self._rowHeights) while n<lim: hn = h + self._rowHeights[n] if hn>availHeight: break h = hn n = n + 1 | def _splitRows(self,availHeight): h = 0 n = 0 lim = len(self._rowHeights) while n<lim: hn = h + self._rowHeights[n] if hn>availHeight: break h = hn n = n + 1 | 4,588 |
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,589 |
def makeMarker(name): if Marker._attrMap['kind'].validate(name): m = Marker() m.kind = name elif Flag._attrMap['kind'].validate(name): m = Flag() m.kind = name m.size = 10 else: raise ValueError, "Invalid marker name %s" % name return m | def makeMarker(name): if Marker._attrMap['kind'].validate(name): m = Marker() m.kind = name elif name[-5:]=='_Flag' and Flag._attrMap['kind'].validate(name[:-5]): m = Flag() m.kind = name m.size = 10 else: raise ValueError, "Invalid marker name %s" % name return m | 4,590 |
def makeMarker(name): if Marker._attrMap['kind'].validate(name): m = Marker() m.kind = name elif Flag._attrMap['kind'].validate(name): m = Flag() m.kind = name m.size = 10 else: raise ValueError, "Invalid marker name %s" % name return m | def makeMarker(name): if Marker._attrMap['kind'].validate(name): m = Marker() m.kind = name[:-5] elif Flag._attrMap['kind'].validate(name): m = Flag() m.kind = name[:-5] m.size = 10 else: raise ValueError, "Invalid marker name %s" % name return m | 4,591 |
def _setRange(self, dataSeries): """Set minimum and maximum axis values. | def _setRange(self, dataSeries): """Set minimum and maximum axis values. | 4,592 |
def drawOn(self, canvas): canvas.saveState() canvas.setFont('Helvetica-Bold',24) canvas.drawString(100,700,'A Custom Shape') | def drawOn(self, canvas): canvas.saveState() canvas.setFont('Helvetica-Bold',24) canvas.drawString(100,700,'A Custom Shape') | 4,593 |
def getKeepWithNext(self): """returns boolean determining whether the next flowabel should stay with this one""" if hasattr(self,'keepWithNext'): return self.keepWithNext elif hasattr(self,'style') and hasattr(self.style,'keepWithNext'): return self.style.keepWithNext else: return 0 | def getKeepWithNext(self): """returns boolean determining whether the next flowable should stay with this one""" if hasattr(self,'keepWithNext'): return self.keepWithNext elif hasattr(self,'style') and hasattr(self.style,'keepWithNext'): return self.style.keepWithNext else: return 0 | 4,594 |
def __init__(self, maxWidth, maxHeight, content=[], mergeSpace=None, mode=0, id=None): '''mode describes the action to take when overflowing 0 raise an error in the normal way 1 ignore ie just draw it and report maxWidth, maxHeight 2 shrinkToFit ''' self.id = id self.maxWidth = maxWidth self.maxHeight = maxHeight... | def __init__(self, maxWidth, maxHeight, content=[], mergeSpace=1, mode=0, name=None): '''mode describes the action to take when overflowing 0 raise an error in the normal way 1 ignore ie just draw it and report maxWidth, maxHeight 2 shrinkToFit ''' self.id = id self.maxWidth = maxWidth self.maxHeight = maxHeight ... | 4,595 |
def __init__(self, maxWidth, maxHeight, content=[], mergeSpace=None, mode=0, id=None): '''mode describes the action to take when overflowing 0 raise an error in the normal way 1 ignore ie just draw it and report maxWidth, maxHeight 2 shrinkToFit ''' self.id = id self.maxWidth = maxWidth self.maxHeight = maxHeight... | def __init__(self, maxWidth, maxHeight, content=[], mergeSpace=None, mode=0, id=None): '''mode describes the action to take when overflowing 0 raise an error in the normal way 1 ignore ie just draw it and report maxWidth, maxHeight 2 shrinkToFit ''' self.name = name or str(id(self)) self.maxWidth = maxWidth self.... | 4,596 |
def identity(self, maxLen=None): return "<%s at %d%s> size=%sx%s" % (self.__class__.__name__, id(self), self.id and ' id="%s"'%self.id, fp_str(self.maxWidth),fp_str(self.maxHeight)) | def identity(self, maxLen=None): return "<%s at %d%s> size=%sx%s" % (self.__class__.__name__, id(self), self.id and ' id="%s"'%self.id, fp_str(self.maxWidth),fp_str(self.maxHeight)) | 4,597 |
def wrap(self,availWidth,availHeight): mode = self.mode maxWidth = float(self.maxWidth) maxHeight = float(self.maxHeight) W, H = _listWrapOn(self._content,availWidth,self.canv) if mode==0 or (W<=maxWidth and H<=maxHeight): self.width = W #we take what we get self.height = H elif mode==1: #we lie self.width = min(max... | def wrap(self,availWidth,availHeight): mode = self.mode maxWidth = float(self.maxWidth or availWidth) maxHeight = float(self.maxHeight) W, H = _listWrapOn(self._content,availWidth,self.canv) if mode==0 or (W<=maxWidth and H<=maxHeight): self.width = W #we take what we get self.height = H elif mode==1: #we lie self.w... | 4,598 |
def _getFragLines(frags): lines = [] cline = [] W = frags[:] while W != []: w = W[0] t = w.text del W[0] i = string.find(t,'\n') if i>=0: tleft = t[i+1:] w.text = t[:i] cline.append(w) lines.append(cline) cline = [] if tleft!='': W.insert(0,w.clone(text=tleft)) else: cline.append(w) if cline!=[]: lines.append(cline) re... | def _getFragLines(frags): lines = [] cline = [] W = frags[:] while W != []: w = W[0] t = w.text del W[0] i = string.find(t,'\n') if i>=0: tleft = t[i+1:] cline.append(w.clone(text=t[:i])) lines.append(cline) cline = [] if tleft!='': W.insert(0,w.clone(text=tleft)) else: cline.append(w) if cline!=[]: lines.append(cline)... | 4,599 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.