bugged
stringlengths 4
228k
| fixed
stringlengths 0
96.3M
| __index_level_0__
int64 0
481k
|
|---|---|---|
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 = bruteForceSearchForAFM(self.name) if afm: if ext == '.pfb': for e in possible_exts: pfb = os.path.splitext(afm)[0] + e if os.path.isfile(pfb): r = pfb else: r = None elif ext == '.afm': r = afm else: r = None if r is None: warnOnce("Can't find %s for face '%s'" % (ext, self.name)) return r
|
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 = bruteForceSearchForAFM(self.name) if afm: if ext == '.pfb': for e in possible_exts: pfb = os.path.splitext(afm)[0] + e if os.path.isfile(pfb): r = pfb else: r = None elif string.lower(ext) == '.afm': r = afm else: r = None if r is None: warnOnce("Can't find %s for face '%s'" % (ext, self.name)) return r
| 4,900
|
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 possible in possibles: (topDict, glyphDict) = parseAFMFile(possible) if topDict['FontName'] == faceName: return possible return None
|
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 + '*.[aA][fF][mM]') for possible in possibles: (topDict, glyphDict) = parseAFMFile(possible) if topDict['FontName'] == faceName: return possible return None
| 4,901
|
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
|
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, uText) else: uText = unicode(text, encoding) codes = map(ord, uText) for code in codes: w = w + width(code) return 0.001 * w * size
| 4,902
|
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 extracted = [] firstLineNo = f.func_code.co_firstlineno - 1 startingIndent = indentLevel(linesInFile[firstLineNo]) extracted.append(linesInFile[firstLineNo]) #brackets = 0 for line in linesInFile[firstLineNo+1:]: ind = indentLevel(line) if ind <= startingIndent: break else: extracted.append(line) # we are not indented return string.join(extracted, '\n') # ??? usefulLines = lines[firstLineNo:lineNo+1] return string.join(usefulLines, '\n')
|
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 extracted = [] firstLineNo = f.func_code.co_firstlineno - 1 startingIndent = indentLevel(linesInFile[firstLineNo]) extracted.append(linesInFile[firstLineNo]) #brackets = 0 for line in linesInFile[firstLineNo+1:]: ind = indentLevel(line) if ind <= startingIndent: break else: extracted.append(line) # we are not indented return string.join(extracted, '\n') # ??? usefulLines = lines[firstLineNo:lineNo+1] return string.join(usefulLines, '\n')
| 4,903
|
def beginMethod(self, name, doc, sig): if name == 'demo': PdfDocBuilder0.beginMethod(self, name, doc, sig)
|
def beginMethod(self, name, doc, sig): if name == 'demo': PdfDocBuilder0.beginMethod(self, name, doc, sig)
| 4,904
|
def endMethod(self, name, doc, sig): if name == 'demo': PdfDocBuilder0.endMethod(self, name, doc, sig)
|
def endMethod(self, name, doc, sig): if name == 'demo': PdfDocBuilder0.endMethod(self, name, doc, sig)
| 4,905
|
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)
|
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)
| 4,906
|
def beginFunction(self, name, doc, sig): bt = self.bt story = self.story story.append(Paragraph(name+sig, bt)) story.append(XPreformatted(doc, bt))
|
def beginFunction(self, name, doc, sig): bt = self.bt story = self.story story.append(Paragraph(name+sig, bt)) story.append(XPreformatted(doc, bt))
| 4,907
|
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 saved in the current directory with a basename equal to the module's name. """ cwd = os.getcwd() # Append directory to Python search path if we get one. dirName = os.path.dirname(path) if dirName: sys.path.append(dirName) # Remove .py extension from module name. if path[-3:] == '.py': modname = path[:-3] else: modname = path # Remove directory paths from module name. if dirName: modname = os.path.basename(modname) # Load the module. try: module = __import__(modname) except: print 'Failed to import %s.' % modname os.chdir(cwd) return # Do the real documentation work. s = ModuleSkeleton0() s.inspect(module) builder.write(s) # Remove appended directory from Python search path if we got one. if dirName: del sys.path[-1] os.chdir(cwd)
|
def documentModule0(path, builder=GraphPdfDocBuilder0()): """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 saved in the current directory with a basename equal to the module's name. """ cwd = os.getcwd() # Append directory to Python search path if we get one. dirName = os.path.dirname(path) if dirName: sys.path.append(dirName) # Remove .py extension from module name. if path[-3:] == '.py': modname = path[:-3] else: modname = path # Remove directory paths from module name. if dirName: modname = os.path.basename(modname) # Load the module. try: module = __import__(modname) except: print 'Failed to import %s.' % modname os.chdir(cwd) return # Do the real documentation work. s = ModuleSkeleton0() s.inspect(module) builder.write(s) # Remove appended directory from Python search path if we got one. if dirName: del sys.path[-1] os.chdir(cwd)
| 4,908
|
def _packageWalkCallback(builder, dirPath, files): """A callback function used when waking over a package tree.""" files = filter(lambda f:f != '__init__.py', files) files = filter(lambda f:f[-3:] == '.py', files) if files: for f in files: path = os.path.join(dirPath, f) print path builder.indentLevel = builder.indentLevel + 1 documentModule0(path, builder) builder.indentLevel = builder.indentLevel - 1
|
def _packageWalkCallback(builder, dirPath, files): "A callback function used when waking over a package tree." files = filter(lambda f:f != '__init__.py', files) files = filter(lambda f:f[-3:] == '.py', files) if files: for f in files: path = os.path.join(dirPath, f) print path builder.indentLevel = builder.indentLevel + 1 documentModule0(path, builder) builder.indentLevel = builder.indentLevel - 1
| 4,909
|
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 directory. """ name = path if string.find(path, os.sep) > -1: name = os.path.splitext(os.path.basename(path))[0] else: package = __import__(name) name = path path = os.path.dirname(package.__file__) cwd = os.getcwd() builder.beginPackage(name) os.path.walk(path, _packageWalkCallback, builder) builder.endPackage(name) os.chdir(cwd)
|
def documentPackage0(pathOrName, builder=GraphPdfDocBuilder0()): """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 directory. """ name = path if string.find(path, os.sep) > -1: name = os.path.splitext(os.path.basename(path))[0] else: package = __import__(name) name = path path = os.path.dirname(package.__file__) cwd = os.getcwd() builder.beginPackage(name) os.path.walk(path, _packageWalkCallback, builder) builder.endPackage(name) os.chdir(cwd)
| 4,910
|
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 directory. """ name = path if string.find(path, os.sep) > -1: name = os.path.splitext(os.path.basename(path))[0] else: package = __import__(name) name = path path = os.path.dirname(package.__file__) cwd = os.getcwd() builder.beginPackage(name) os.path.walk(path, _packageWalkCallback, builder) builder.endPackage(name) os.chdir(cwd)
|
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 directory. """ if string.find(pathOrName, os.sep) > -1: name = os.path.splitext(os.path.basename(pathOrName))[0] path = pathOrName else: package = __import__(name) name = path path = os.path.dirname(package.__file__) cwd = os.getcwd() builder.beginPackage(name) os.path.walk(path, _packageWalkCallback, builder) builder.endPackage(name) os.chdir(cwd)
| 4,911
|
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 directory. """ name = path if string.find(path, os.sep) > -1: name = os.path.splitext(os.path.basename(path))[0] else: package = __import__(name) name = path path = os.path.dirname(package.__file__) cwd = os.getcwd() builder.beginPackage(name) os.path.walk(path, _packageWalkCallback, builder) builder.endPackage(name) os.chdir(cwd)
|
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 directory. """ name = path if string.find(path, os.sep) > -1: name = os.path.splitext(os.path.basename(path))[0] else: package = __import__(pathOrName) if '.' in pathOrName: subname = 'package' + pathOrName[string.find(pathOrName, '.'):] package = eval(subname) name = pathOrName path = os.path.dirname(package.__file__) cwd = os.getcwd() builder.beginPackage(name) os.path.walk(path, _packageWalkCallback, builder) builder.endPackage(name) os.chdir(cwd)
| 4,912
|
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 directory. """ name = path if string.find(path, os.sep) > -1: name = os.path.splitext(os.path.basename(path))[0] else: package = __import__(name) name = path path = os.path.dirname(package.__file__) cwd = os.getcwd() builder.beginPackage(name) os.path.walk(path, _packageWalkCallback, builder) builder.endPackage(name) os.chdir(cwd)
|
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 directory. """ name = path if string.find(path, os.sep) > -1: name = os.path.splitext(os.path.basename(path))[0] else: package = __import__(name) name = path path = os.path.dirname(package.__file__) cwd = os.getcwd() builder.beginPackage(name) os.path.walk(path, _packageWalkCallback, builder) builder.endPackage(name) os.chdir(cwd)
| 4,913
|
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 = DocBuilder0() for o, a in opts: if o == '-f': builder = eval("%sDocBuilder0()" % a) break # Now call the real documentation functions. for o, a in opts: if o == '-m': builder.begin() documentModule0(a, builder) builder.end() sys.exit(0) elif o == '-p': builder.begin() documentPackage0(a, builder) builder.end() sys.exit(0)
|
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 = DocBuilder0() for o, a in opts: if o == '-f': builder = eval("%sDocBuilder0()" % a) break # Now call the real documentation functions. for o, a in opts: if o == '-m': builder.begin() documentModule0(a, builder) builder.end() sys.exit(0) elif o == '-p': builder.begin() documentPackage0(a, builder) builder.end() sys.exit(0)
| 4,914
|
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 = DocBuilder0() for o, a in opts: if o == '-f': builder = eval("%sDocBuilder0()" % a) break # Now call the real documentation functions. for o, a in opts: if o == '-m': builder.begin() documentModule0(a, builder) builder.end() sys.exit(0) elif o == '-p': builder.begin() documentPackage0(a, builder) builder.end() sys.exit(0)
|
defmain():"""Handlecommand-lineoptionsandtriggercorrespondingaction."""opts,args=getopt.getopt(sys.argv[1:],'hf:m:p:')#On-hprintusageandexitimmediately.foro,ainopts:ifo=='-h':printprintUsage.__doc__#printUsage()sys.exit(0)#On-fsettheDocBuildertouseoradefaultone.builder=DocBuilder0()foro,ainopts:ifo=='-f':builder=eval("%sDocBuilder0()"%a)break#Nowcalltherealdocumentationfunctions.foro,ainopts:ifo=='-m':builder.begin()documentModule0(a,builder)builder.end()sys.exit(0)elifo=='-p':builder.begin()documentPackage0(a,builder)builder.end()sys.exit(0)
| 4,915
|
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 = DocBuilder0() for o, a in opts: if o == '-f': builder = eval("%sDocBuilder0()" % a) break # Now call the real documentation functions. for o, a in opts: if o == '-m': builder.begin() documentModule0(a, builder) builder.end() sys.exit(0) elif o == '-p': builder.begin() documentPackage0(a, builder) builder.end() sys.exit(0)
|
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 = GraphPdfDocBuilder0() for o, a in opts: if o == '-f': builder = eval("%sDocBuilder0()" % a) break # Now call the real documentation functions. for o, a in opts: if o == '-m': builder.begin() documentModule0(a, builder) builder.end() sys.exit(0) elif o == '-p': builder.begin() documentPackage0(a, builder) builder.end() sys.exit(0)
| 4,916
|
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 point #RGB I suggest we should be aiming a little better cp = None dp = None sp = None if canv._pagesize: cp = map(int, canv._pagesize) if self.pagesize: sp = map(int, self.pagesize) if doc.pagesize: dp = map(int, doc.pagesize) if cp!=sp: if sp: canv.setPageSize(self.pagesize) elif cp!=dp: canv.setPageSize(doc.pagesize)
|
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 point #RGB I suggest we should be aiming a little better cp = None dp = None sp = None if canv._pagesize: cp = map(int, canv._pagesize) if self.pagesize: sp = map(int, self.pagesize) if doc.pagesize: dp = map(int, doc.pagesize) if cp!=sp: if sp: canv.setPageSize(self.pagesize) elif cp!=dp: canv.setPageSize(doc.pagesize)
| 4,917
|
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 point #RGB I suggest we should be aiming a little better cp = None dp = None sp = None if canv._pagesize: cp = map(int, canv._pagesize) if self.pagesize: sp = map(int, self.pagesize) if doc.pagesize: dp = map(int, doc.pagesize) if cp!=sp: if sp: canv.setPageSize(self.pagesize) elif cp!=dp: canv.setPageSize(doc.pagesize)
|
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 point #RGB I suggest we should be aiming a little better cp = None dp = None sp = None if canv._pagesize: cp = map(int, canv._pagesize) if self.pagesize: sp = map(int, self.pagesize) if doc.pagesize: dp = map(int, doc.pagesize) if cp!=sp: if sp: canv.setPageSize(self.pagesize) elif cp!=dp: canv.setPageSize(doc.pagesize)
| 4,918
|
def handle_pageBegin(self): '''Perform actions required at beginning of page. shouldn't normally be called directly''' self.page += 1 if self._debug: logger.debug("beginning page %d" % self.page) self.pageTemplate.beforeDrawPage(self.canv,self) self.pageTemplate.checkPageSize(self.canv,self) self.pageTemplate.onPage(self.canv,self) for f in self.pageTemplate.frames: f._reset() self.beforePage() #keep a count of flowables added to this page. zero indicates bad stuff self._curPageFlowableCount = 0 if hasattr(self,'_nextFrameIndex'): del self._nextFrameIndex self.frame = self.pageTemplate.frames[0] self.frame._debug = self._debug self.handle_frameBegin()
|
def handle_pageBegin(self): """Perform actions required at beginning of page. shouldn't normally be called directly""" self.page += 1 if self._debug: logger.debug("beginning page %d" % self.page) self.pageTemplate.beforeDrawPage(self.canv,self) self.pageTemplate.checkPageSize(self.canv,self) self.pageTemplate.onPage(self.canv,self) for f in self.pageTemplate.frames: f._reset() self.beforePage() #keep a count of flowables added to this page. zero indicates bad stuff self._curPageFlowableCount = 0 if hasattr(self,'_nextFrameIndex'): del self._nextFrameIndex self.frame = self.pageTemplate.frames[0] self.frame._debug = self._debug self.handle_frameBegin()
| 4,919
|
def notify(self, kind, stuff): """"Forward to any listeners""" for l in self._indexingFlowables: l.notify(kind, stuff)
|
def notify(self, kind, stuff): """Forward to any listeners""" for l in self._indexingFlowables: l.notify(kind, stuff)
| 4,920
|
def _rl_accel_dir_info(dir): import stat fn = pjoin(dir,'_rl_accel') return getVersionFromCCode(fn),os.stat(fn)[stat.ST_MTIME]
|
def _rl_accel_dir_info(dir): import stat fn = pjoin(dir,'_rl_accel.c') try: return getVersionFromCCode(fn),os.stat(fn)[stat.ST_MTIME] except: return None
| 4,921
|
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_accel-*/rl_accel') \ : fn = pjoin(x,'_rl_accel.c') if isfile(pjoin(x,'_rl_accel.c')): _.append(x) if _: if len(_)>1: _.sort(_cmp_rl_accel_dirs) return abspath(_[0]) return None
|
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_accel-*/rl_accel') \ : fn = pjoin(x,'_rl_accel.c') if isfile(pjoin(x,'_rl_accel.c')): _.append(x) if _: _ = filter(_rl_accel_dir_info,_) if len(_): _.sort(_cmp_rl_accel_dirs) return abspath(_[0]) return None
| 4,922
|
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 '***************************************************' else: 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')], include_dirs=[], define_macros=[], library_dirs=[], libraries=LIBS, # libraries to link against ), Extension( 'sgmlop', [pjoin(RL_ACCEL,'sgmlop.c')], include_dirs=[], define_macros=[], library_dirs=[], libraries=LIBS, # libraries to link against ), 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, # libraries to link against ), ] for fn in _FILES: fn = os.sep.join(fn.split('/')) if isfile(fn): tn = dirname(fn) tn = tn and pjoin(package_path,tn) or package_path DATA_FILES.setdefault(tn,[]).append(fn) setup( name="Reportlab", version=get_version(), license="BSD license (see license.txt for details), Copyright (c) 2000-2003, ReportLab Inc.", description="The Reportlab Toolkit", long_description="""The ReportLab Toolkit.
|
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 '***************************************************' else: 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')], include_dirs=[], define_macros=[], library_dirs=[], libraries=LIBS, # libraries to link against ), Extension( 'sgmlop', [pjoin(RL_ACCEL,'sgmlop.c')], include_dirs=[], define_macros=[], library_dirs=[], libraries=LIBS, # libraries to link against ), 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, # libraries to link against ), ] for fn in _FILES: fn = os.sep.join(fn.split('/')) if isfile(fn): tn = dirname(fn) tn = tn and pjoin(package_path,tn) or package_path DATA_FILES.setdefault(tn,[]).append(fn) setup( name="Reportlab", version=get_version(), license="BSD license (see license.txt for details), Copyright (c) 2000-2003, ReportLab Inc.", description="The Reportlab Toolkit", long_description="""The ReportLab Toolkit.
| 4,923
|
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 '***************************************************' else: 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')], include_dirs=[], define_macros=[], library_dirs=[], libraries=LIBS, # libraries to link against ), Extension( 'sgmlop', [pjoin(RL_ACCEL,'sgmlop.c')], include_dirs=[], define_macros=[], library_dirs=[], libraries=LIBS, # libraries to link against ), 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, # libraries to link against ), ] for fn in _FILES: fn = os.sep.join(fn.split('/')) if isfile(fn): tn = dirname(fn) tn = tn and pjoin(package_path,tn) or package_path DATA_FILES.setdefault(tn,[]).append(fn) setup( name="Reportlab", version=get_version(), license="BSD license (see license.txt for details), Copyright (c) 2000-2003, ReportLab Inc.", description="The Reportlab Toolkit", long_description="""The ReportLab Toolkit.
|
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 '***************************************************' else: 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 found, you can obtain it at *' print '*http://www.reportlab.org/downloads.html print '***************************************************' else: print ' print ' print ' 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')], include_dirs=[], define_macros=[], library_dirs=[], libraries=LIBS, ), Extension( 'sgmlop', [pjoin(RL_ACCEL,'sgmlop.c')], include_dirs=[], define_macros=[], library_dirs=[], libraries=LIBS, # libraries to link against ), Extension( 'sgmlop', [pjoin(RL_ACCEL,'sgmlop.c')], include_dirs=[], define_macros=[], library_dirs=[], libraries=LIBS, # libraries to link against ), 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, # libraries to link against ), ] for fn in _FILES: fn = os.sep.join(fn.split('/')) if isfile(fn): tn = dirname(fn) tn = tn and pjoin(package_path,tn) or package_path DATA_FILES.setdefault(tn,[]).append(fn) setup( name="Reportlab", version=get_version(), license="BSD license (see license.txt for details), Copyright (c) 2000-2003, ReportLab Inc.", description="The Reportlab Toolkit", long_description="""The ReportLab Toolkit.
| 4,924
|
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 '***************************************************' else: 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')], include_dirs=[], define_macros=[], library_dirs=[], libraries=LIBS, # libraries to link against ), Extension( 'sgmlop', [pjoin(RL_ACCEL,'sgmlop.c')], include_dirs=[], define_macros=[], library_dirs=[], libraries=LIBS, # libraries to link against ), 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, # libraries to link against ), ] for fn in _FILES: fn = os.sep.join(fn.split('/')) if isfile(fn): tn = dirname(fn) tn = tn and pjoin(package_path,tn) or package_path DATA_FILES.setdefault(tn,[]).append(fn) setup( name="Reportlab", version=get_version(), license="BSD license (see license.txt for details), Copyright (c) 2000-2003, ReportLab Inc.", description="The Reportlab Toolkit", long_description="""The ReportLab Toolkit.
|
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 '***************************************************' else: 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')], include_dirs=[], define_macros=[], library_dirs=[], libraries=LIBS, # libraries to link against ), Extension( 'sgmlop', [pjoin(RL_ACCEL,'sgmlop.c')], include_dirs=[], define_macros=[], library_dirs=[], libraries=LIBS, # libraries to link against ), 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, # libraries to link against ), ] for fn in _FILES: fn = os.sep.join(fn.split('/')) if isfile(fn): tn = dirname(fn) tn = tn and pjoin(package_path,tn) or package_path DATA_FILES.setdefault(tn,[]).append(fn) setup( name="Reportlab", version=get_version(), license="BSD license (see license.txt for details), Copyright (c) 2000-2003, ReportLab Inc.", description="The Reportlab Toolkit", long_description="""The ReportLab Toolkit.
| 4,925
|
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 = flowable.getSpaceBefore() h = y - p - s if h>0: flowable.canv = canv #so they can use stringWidth etc w, h = flowable.wrap(self._aW, h) del flowable.canv else: return 0
|
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 not self._atTop: s = flowable.getSpaceBefore() h = y - p - s if h>0: flowable.canv = canv #so they can use stringWidth etc w, h = flowable.wrap(self._aW, h) del flowable.canv else: return 0
| 4,926
|
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 o.multiPage: item = self.itemFound if item: # Add line height to current vert. position. pos = self.text.getY() + o.fontSize nameTag = "p%sy%s" % (self.pageNum, pos) c = self.canvas i = self.startPositions.index(self.startPos) c.bookmarkHorizontalAbsolute0(nameTag, pos) c.addOutlineEntry0('%s %s' % (item, t), nameTag, i)
|
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 o.multiPage: item = self.itemFound if item: # Add line height to current vert. position. pos = self.text.getY() + o.fontSize nameTag = "p%sy%s" % (self.pageNum, pos) c = self.canvas i = self.startPositions.index(self.startPos) c.bookmarkHorizontalAbsolute(nameTag, pos) c.addOutlineEntry0('%s %s' % (item, t), nameTag, i)
| 4,927
|
def _calc(self): if hasattr(self,'_width'): return
|
def _calc(self): if hasattr(self,'_width'): return
| 4,928
|
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)
|
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)
| 4,929
|
def __init__(self, name): self.name = name self.graphics = []
|
def __init__(self, name): self.name = name self.graphics = []
| 4,930
|
def drawOn(self, canv): for graphic in self.graphics:
|
def drawOn(self, canv): for graphic in self.graphics:
| 4,931
|
def drawOn(self, canv): for graphic in self.graphics:
|
def drawOn(self, canv): for graphic in self.graphics:
| 4,932
|
def drawOn(self, canv): for graphic in self.graphics:
|
def drawOn(self, canv): for graphic in self.graphics:
| 4,933
|
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 draw(self): _text = self._text self._text = _text or '' # hack, but it works for now... self.computeSize() g = Group() g.translate(self.x + self.dx, self.y + self.dy) g.rotate(self.angle)
| 4,934
|
def draw(self): exec self.command in globals(), {'canvas':self.canv}
|
def draw(self): exec self.command in globals(), {'canvas':self.canv}
| 4,935
|
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.y1 + self.bottomPadding w, h = flowable.wrap(self.width, y - p )
|
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.y1 + self.bottomPadding w, h = flowable.wrap(self.width, y - p )
| 4,936
|
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.y1 + self.bottomPadding w, h = flowable.wrap(self.width, y - p )
|
def_add(self,flowable,canv,trySplit=0):"""Drawstheflowableatthecurrentposition.Returns1ifsuccessful,0ifitwouldnotfit.RaisesaLayoutErroriftheobjectistoowide,orifitistoohighforatotallyemptyframe,toavoidinfiniteloops"""y=self.yp=self.y1+self.bottomPaddingw,h=flowable.wrap(self.width,y-p)
| 4,937
|
def _doNothing(flowables, doc): "Dummy callback for onFirstPage and onNewPage" pass
|
def _doNothing(canvas, doc): "Dummy callback for onPage" pass
| 4,938
|
def run(): objects_to_draw = [] from reportlab.lib.styles import ParagraphStyle from reportlab.platypus.paragraph import Paragraph #need a style normal = ParagraphStyle('normal') normal.firstLineIndent = 18 normal.spaceBefore = 6 import random for i in range(15): height = 0.5 + (2*random.random()) box = XBox(6 * inch, height * inch, 'Box Number %d' % i) objects_to_draw.append(box) para = Paragraph(randomText(), normal) objects_to_draw.append(para) doc = SimpleFlowDocument('platypus.pdf',DEFAULT_PAGE_SIZE) doc.onFirstPage = myFirstPage doc.onNewPage = myLaterPages doc.build(objects_to_draw)
|
defrun():objects_to_draw=[]fromreportlab.lib.stylesimportParagraphStylefromreportlab.platypus.paragraphimportParagraph#needastylenormal=ParagraphStyle('normal')normal.firstLineIndent=18normal.spaceBefore=6importrandomforiinrange(15):height=0.5+(2*random.random())box=XBox(6*inch,height*inch,'BoxNumber%d'%i)objects_to_draw.append(box)para=Paragraph(randomText(),normal)objects_to_draw.append(para)doc=SimpleFlowDocument('platypus.pdf',DEFAULT_PAGE_SIZE)doc.onFirstPage=myFirstPagedoc.onNewPage=myLaterPagesdoc.build(objects_to_draw)
| 4,939
|
def run(): objects_to_draw = [] from reportlab.lib.styles import ParagraphStyle from reportlab.platypus.paragraph import Paragraph #need a style normal = ParagraphStyle('normal') normal.firstLineIndent = 18 normal.spaceBefore = 6 import random for i in range(15): height = 0.5 + (2*random.random()) box = XBox(6 * inch, height * inch, 'Box Number %d' % i) objects_to_draw.append(box) para = Paragraph(randomText(), normal) objects_to_draw.append(para) doc = SimpleFlowDocument('platypus.pdf',DEFAULT_PAGE_SIZE) doc.onFirstPage = myFirstPage doc.onNewPage = myLaterPages doc.build(objects_to_draw)
|
defrun():objects_to_draw=[]fromreportlab.lib.stylesimportParagraphStylefromreportlab.platypus.paragraphimportParagraph#needastylenormal=ParagraphStyle('normal')normal.firstLineIndent=18normal.spaceBefore=6importrandomforiinrange(15):height=0.5+(2*random.random())box=XBox(6*inch,height*inch,'BoxNumber%d'%i)objects_to_draw.append(box)para=Paragraph(randomText(),normal)objects_to_draw.append(para)doc=SimpleFlowDocument('platypus.pdf',DEFAULT_PAGE_SIZE)doc.onFirstPage=myFirstPagedoc.onNewPage=myLaterPagesdoc.build(objects_to_draw)
| 4,940
|
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.fontName, self.boxSize * 0.75) for ch in charList: # may be 2 bytes or 1 if ch is None: self.canv.setFillGray(0.9) self.canv.rect((1+col) * self.boxSize, (self.rows - row - 1) * self.boxSize, self.boxSize, self.boxSize, stroke=0, fill=1) self.canv.setFillGray(0.0) else: self.canv.drawCentredString( (col+1.5) * self.boxSize, (self.rows - row - 0.875) * self.boxSize, ch ) col = col + 1 if col == self.charsPerRow: row = row + 1 col = 0
|
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.fontName, self.boxSize * 0.75) for ch in charList: # may be 2 bytes or 1 if ch is None: self.canv.setFillGray(0.9) self.canv.rect((1+col) * self.boxSize, (self.rows - row - 1) * self.boxSize, self.boxSize, self.boxSize, stroke=0, fill=1) self.canv.setFillGray(0.0) else: try: self.canv.drawCentredString( (col+1.5) * self.boxSize, (self.rows - row - 0.875) * self.boxSize, ch ) col = col + 1 if col == self.charsPerRow: row = row + 1 col = 0
| 4,941
|
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.fontName, self.boxSize * 0.75) for ch in charList: # may be 2 bytes or 1 if ch is None: self.canv.setFillGray(0.9) self.canv.rect((1+col) * self.boxSize, (self.rows - row - 1) * self.boxSize, self.boxSize, self.boxSize, stroke=0, fill=1) self.canv.setFillGray(0.0) else: self.canv.drawCentredString( (col+1.5) * self.boxSize, (self.rows - row - 0.875) * self.boxSize, ch ) col = col + 1 if col == self.charsPerRow: row = row + 1 col = 0
|
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.fontName, self.boxSize * 0.75) for ch, in charList: # may be 2 bytes or 1 if ch, is None: self.canv.setFillGray(0.9) self.canv.rect((1+col) * self.boxSize, (self.rows - row - 1) * self.boxSize, self.boxSize, self.boxSize, stroke=0, fill=1) self.canv.setFillGray(0.0) else: self.canv.drawCentredString( (col+1.5) * self.boxSize, (self.rows - row - 0.875) * self.boxSize, ch, ) col = col + 1 if col == self.charsPerRow: row = row + 1 col = 0
| 4,942
|
def makeSuite(): # only run the tests if _rl_accel is present try: import _rl_accel return makeSuiteForClasses(RlAccelTestCase) except ImportError: return None
|
def makeSuite(): # only run the tests if _rl_accel is present try: import _rl_accel Klass = RlAccelTestCase except: class Klass(unittest.TestCase): pass return makeSuiteForClasses(Klass)
| 4,943
|
def makeSuite(): # only run the tests if _rl_accel is present try: import _rl_accel return makeSuiteForClasses(RlAccelTestCase) except ImportError: return None
|
def makeSuite(): # only run the tests if _rl_accel is present try: import _rl_accel return makeSuiteForClasses(RlAccelTestCase) except ImportError: return None
| 4,944
|
def drawInlineImage(self, canvas): #, image, x,y, width=None,height=None): """Draw an Image into the specified rectangle. If width and height are omitted, they are calculated from the image size. Also allow file names as well as images. This allows a caching mechanism"""
|
defdrawInlineImage(self,canvas):#,image,x,y,width=None,height=None):"""DrawanImageintothespecifiedrectangle.Ifwidthandheightareomitted,theyarecalculatedfromtheimagesize.Alsoallowfilenamesaswellasimages.Thisallowsacachingmechanism"""
| 4,945
|
def drawInlineImage(self, canvas): #, image, x,y, width=None,height=None): """Draw an Image into the specified rectangle. If width and height are omitted, they are calculated from the image size. Also allow file names as well as images. This allows a caching mechanism"""
|
def drawInlineImage(self, canvas): #, image, x,y, width=None,height=None): """Draw an Image into the specified rectangle. If width and height are omitted, they are calculated from the image size. Also allow file names as well as images. This allows a caching mechanism"""
| 4,946
|
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-self.x self._radiusx = radiusx = radius self._radiusy = radiusy = (1.0 - self.perspective/100.0)*radius data = self.normalizeData() sum = self._sum
|
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 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 data = self.normalizeData() sum = self._sum
| 4,947
|
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['CVSROOT']=':pserver:%s@cvs:/cvsroot/reportlab' % USER do_exec(cvs+' co reportlab', 'the download phase')
|
def cvs_checkout(d): os.chdir(d) recursive_rmdir(cvsdir) cvs = find_exe('cvs') if cvs is None: 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['CVSROOT']=':pserver:%s@cvs:/cvsroot/reportlab' % USER do_exec(cvs+' co reportlab', 'the download phase')
| 4,948
|
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['CVSROOT']=':pserver:%s@cvs:/cvsroot/reportlab' % USER do_exec(cvs+' co reportlab', 'the download 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: do_exec(cvs+(' export -r %s reportlab'%release), 'the export phase') else: os.environ['CVSROOT']=':pserver:%s@cvs:/cvsroot/reportlab' % USER do_exec(cvs+' co reportlab', 'the download phase')
| 4,949
|
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['CVSROOT']=':pserver:%s@cvs:/cvsroot/reportlab' % USER do_exec(cvs+' co reportlab', 'the download 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: do_exec(cvs+' co reportlab', 'the checkout phase')
| 4,950
|
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)
|
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)
| 4,951
|
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)
|
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)
| 4,952
|
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)
|
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)
| 4,953
|
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)
|
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)
| 4,954
|
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)
|
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)
| 4,955
|
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)
|
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)
| 4,956
|
def _findMinMaxValues(self): "Find the minimum and maximum value of the data we have."
|
def _findMinMaxValues(self): "Find the minimum and maximum value of the data we have."
| 4,957
|
def calcBarPositions(self): """Works out where they go. default vertical.
|
def calcBarPositions(self): """Works out where they go. default vertical.
| 4,958
|
def _digester(s): return string.join(map(lambda x : "%0x" % ord(x), md5.md5(s).digest()), '')
|
def _digester(s): return string.join(map(lambda x : "%0x" % ord(x), md5.md5(s).digest()), '')
| 4,959
|
def find_test_files(L,d,N): n = os.path.basename(d) if n!='test' : return for n in filter(lambda n: n[-3:]=='.py',N): fn = os.path.normcase(os.path.normpath(os.path.join(d,n))) if os.path.isfile(fn): L.append(fn)
|
def find_test_files(L,d,N): n = os.path.basename(d) if n!='test' : return for n in filter(lambda n: n[-3:]=='.py',N): fn = os.path.normcase(os.path.normpath(os.path.join(d,n))) if os.path.isfile(fn): L.append(fn)
| 4,960
|
def find_test_files(L,d,N): n = os.path.basename(d) if n!='test' : return for n in filter(lambda n: n[-3:]=='.py',N): fn = os.path.normcase(os.path.normpath(os.path.join(d,n))) if os.path.isfile(fn): L.append(fn)
|
def find_test_files(L,d,N): n = os.path.basename(d) if n!='test' : return for n in filter(lambda n: n[-3:]=='.py',N): fn = os.path.normcase(os.path.normpath(os.path.join(d,n))) if os.path.isfile(fn): L.append(fn)
| 4,961
|
def find_test_files(L,d,N): n = os.path.basename(d) if n!='test' : return for n in filter(lambda n: n[-3:]=='.py',N): fn = os.path.normcase(os.path.normpath(os.path.join(d,n))) if os.path.isfile(fn): L.append(fn)
|
def find_test_files(L,d,N): n = os.path.basename(d) if n!='test' : return for n in filter(lambda n: n[-3:]=='.py',N): fn = os.path.normcase(os.path.normpath(os.path.join(d,n))) if os.path.isfile(fn): L.append(fn)
| 4,962
|
def find_test_files(L,d,N): n = os.path.basename(d) if n!='test' : return for n in filter(lambda n: n[-3:]=='.py',N): fn = os.path.normcase(os.path.normpath(os.path.join(d,n))) if os.path.isfile(fn): L.append(fn)
|
def find_test_files(L,d,N): n = os.path.basename(d) if n!='test' : return for n in filter(lambda n: n[-3:]=='.py',N): fn = os.path.normcase(os.path.normpath(os.path.join(d,n))) if os.path.isfile(fn): L.append(fn)
| 4,963
|
def setFillColor(self, aColor): """Takes a color object, allowing colors to be referred to by name""" if type(aColor) == ColorType: rgb = (aColor.red, aColor.green, aColor.blue) self._strokeColorRGB = rgb self._code.append('%0.2f %0.2f %0.2f rg' % rgb ) elif type(aColor) in _SeqTypes: l = len(aColor) if l==3: self._strokeColorRGB = aColor self._code.append('%0.2f %0.2f %0.2f rg' % aColor ) elif l==4: self.setFillColorCMYK(self, aColor[0], aColor[1], aColor[2], aColor[3]) else: raise 'Unknown color', str(aColor) else: raise 'Unknown color', str(aColor)
|
def setFillColor(self, aColor): """Takes a color object, allowing colors to be referred to by name""" if type(aColor) == ColorType: rgb = (aColor.red, aColor.green, aColor.blue) self._fillColorRGB = rgb self._code.append('%0.2f %0.2f %0.2f rg' % rgb ) elif type(aColor) in _SeqTypes: l = len(aColor) if l==3: self._strokeColorRGB = aColor self._code.append('%0.2f %0.2f %0.2f rg' % aColor ) elif l==4: self.setFillColorCMYK(self, aColor[0], aColor[1], aColor[2], aColor[3]) else: raise 'Unknown color', str(aColor) else: raise 'Unknown color', str(aColor)
| 4,964
|
def setFillColor(self, aColor): """Takes a color object, allowing colors to be referred to by name""" if type(aColor) == ColorType: rgb = (aColor.red, aColor.green, aColor.blue) self._strokeColorRGB = rgb self._code.append('%0.2f %0.2f %0.2f rg' % rgb ) elif type(aColor) in _SeqTypes: l = len(aColor) if l==3: self._strokeColorRGB = aColor self._code.append('%0.2f %0.2f %0.2f rg' % aColor ) elif l==4: self.setFillColorCMYK(self, aColor[0], aColor[1], aColor[2], aColor[3]) else: raise 'Unknown color', str(aColor) else: raise 'Unknown color', str(aColor)
|
def setFillColor(self, aColor): """Takes a color object, allowing colors to be referred to by name""" if type(aColor) == ColorType: rgb = (aColor.red, aColor.green, aColor.blue) self._strokeColorRGB = rgb self._code.append('%0.2f %0.2f %0.2f rg' % rgb ) elif type(aColor) in _SeqTypes: l = len(aColor) if l==3: self._fillColorRGB = aColor self._code.append('%0.2f %0.2f %0.2f rg' % aColor ) elif l==4: self.setFillColorCMYK(self, aColor[0], aColor[1], aColor[2], aColor[3]) else: raise 'Unknown color', str(aColor) else: raise 'Unknown color', str(aColor)
| 4,965
|
def materialize(self, text, length, xyorigin=(0,0), lengthoffset=0, widthoffset=0): "generate a drawables based on this template, with help of 'derived' parameters" # for purposes of generality return a *sequence* of drawables (x,y) = xyorigin orientation = self.orientation # semantics is flipped compared to bar groups if orientation == "horizontal": lowerleftx = x+widthoffset lowerlefty = y+lengthoffset upperleftx = lowerleftx upperlefty = lowerlefty+length anchor = "middle" if length<0: upperlefty = upperlefty-self.extraOffset-self.size else: upperlefty = upperlefty+self.extraOffset elif orientation == "vertical": lowerleftx = x+lengthoffset lowerlefty = y+widthoffset upperleftx = lowerleftx+length upperlefty = lowerlefty if length<0: upperleftx = upperleftx-self.extraOffset anchor = "end" else: upperleftx = upperleftx+self.extraOffset anchor = "start" else: raise ValueError, "bad orientation %s" % orientation R = String(upperleftx, upperlefty, text) R.textAnchor = anchor if self.color is not None: R.fillColor = self.color elif self.defaultColor is not None: R.fillColor = self.defaultColor if self.size is not None: R.fontSize = self.size if self.font is not None: R.fontName = self.font return [R]
|
def materialize(self, text, length, xyorigin=(0,0), lengthoffset=0, widthoffset=0): "generate a drawables based on this template, with help of 'derived' parameters" # for purposes of generality return a *sequence* of drawables (x,y) = xyorigin orientation = self.orientation # semantics is flipped compared to bar groups if orientation == "horizontal": lowerleftx = x+widthoffset lowerlefty = y+lengthoffset upperleftx = lowerleftx upperlefty = lowerlefty+length anchor = "middle" if length<0: upperlefty = upperlefty-self.extraOffset-self.size else: upperlefty = upperlefty+self.extraOffset elif orientation == "vertical": lowerleftx = x+lengthoffset lowerlefty = y+widthoffset upperleftx = lowerleftx+length upperlefty = lowerlefty if length<0: upperleftx = upperleftx-self.extraOffset anchor = "end" else: upperleftx = upperleftx+self.extraOffset anchor = "start" else: raise ValueError, "bad orientation %s" % orientation R = String(upperleftx, upperlefty, text) R.textAnchor = anchor if self.color is not None: R.fillColor = self.color elif self.defaultColor is not None: R.fillColor = self.defaultColor if self.size is not None: R.fontSize = self.size if self.font is not None: R.fontName = self.font return [R]
| 4,966
|
def draw(self): orientation = self.orientation # this could be done cleverly using the other widgets, but what the .... x,y = self.x, self.y fmt = self.labelFormat (delta, startpoint) = scaleParameters(self.minimum, self.maximum, self.nLabels) G = Group() # orientation independent data (direct values for vertical case, convert for horizontal case linedata = [] textdata = [] # the main axis linedata.append( (0, 0, 0, self.length) ) # the cross lines and labels lineposition = startpoint - self.minimum factor = self.factor() print "factor is", factor while lineposition+self.minimum<self.maximum: text = string.strip(fmt % (lineposition+self.minimum)) clineposition = factor * lineposition print "lineposition, clineposition", lineposition, clineposition linedata.append( (0, clineposition, self.width, clineposition) ) textdata.append( (0, clineposition, text) ) lineposition = lineposition + delta print "done with lines" if orientation=="vertical": for (x1, y1, x2, y2) in linedata: G.add(Line(x+x1, y+y1, x+x2, y+y2)) for (x1, y1, t) in textdata: S = String(x+x1-self.extraOffset, y+y1, t) S.textAnchor = "end" G.add(S) elif orientation=="horizontal": for (y1, x1, y2, x2) in linedata: G.add(Line(x+x1, y+y1, x+x2, y+y2)) for (y1, x1, t) in textdata: S = String(x+x1, y+y1-self.extraOffset, t) S.textAnchor = "middle" G.add(S) else: raise ValueError, "bad orientation " + repr(orientation) return G
|
def draw(self): orientation = self.orientation # this could be done cleverly using the other widgets, but what the .... x,y = self.x, self.y fmt = self.labelFormat (delta, startpoint) = scaleParameters(self.minimum, self.maximum, self.nLabels) G = Group() # orientation independent data (direct values for vertical case, convert for horizontal case linedata = [] textdata = [] # the main axis linedata.append( (0, 0, 0, self.length) ) # the cross lines and labels lineposition = startpoint - self.minimum factor = self.factor() while lineposition+self.minimum<self.maximum: text = string.strip(fmt % (lineposition+self.minimum)) clineposition = factor * lineposition print "lineposition, clineposition", lineposition, clineposition linedata.append( (0, clineposition, self.width, clineposition) ) textdata.append( (0, clineposition, text) ) lineposition = lineposition + delta print "done with lines" if orientation=="vertical": for (x1, y1, x2, y2) in linedata: G.add(Line(x+x1, y+y1, x+x2, y+y2)) for (x1, y1, t) in textdata: S = String(x+x1-self.extraOffset, y+y1, t) S.textAnchor = "end" G.add(S) elif orientation=="horizontal": for (y1, x1, y2, x2) in linedata: G.add(Line(x+x1, y+y1, x+x2, y+y2)) for (y1, x1, t) in textdata: S = String(x+x1, y+y1-self.extraOffset, t) S.textAnchor = "middle" G.add(S) else: raise ValueError, "bad orientation " + repr(orientation) return G
| 4,967
|
def draw(self): orientation = self.orientation # this could be done cleverly using the other widgets, but what the .... x,y = self.x, self.y fmt = self.labelFormat (delta, startpoint) = scaleParameters(self.minimum, self.maximum, self.nLabels) G = Group() # orientation independent data (direct values for vertical case, convert for horizontal case linedata = [] textdata = [] # the main axis linedata.append( (0, 0, 0, self.length) ) # the cross lines and labels lineposition = startpoint - self.minimum factor = self.factor() print "factor is", factor while lineposition+self.minimum<self.maximum: text = string.strip(fmt % (lineposition+self.minimum)) clineposition = factor * lineposition print "lineposition, clineposition", lineposition, clineposition linedata.append( (0, clineposition, self.width, clineposition) ) textdata.append( (0, clineposition, text) ) lineposition = lineposition + delta print "done with lines" if orientation=="vertical": for (x1, y1, x2, y2) in linedata: G.add(Line(x+x1, y+y1, x+x2, y+y2)) for (x1, y1, t) in textdata: S = String(x+x1-self.extraOffset, y+y1, t) S.textAnchor = "end" G.add(S) elif orientation=="horizontal": for (y1, x1, y2, x2) in linedata: G.add(Line(x+x1, y+y1, x+x2, y+y2)) for (y1, x1, t) in textdata: S = String(x+x1, y+y1-self.extraOffset, t) S.textAnchor = "middle" G.add(S) else: raise ValueError, "bad orientation " + repr(orientation) return G
|
def draw(self): orientation = self.orientation # this could be done cleverly using the other widgets, but what the .... x,y = self.x, self.y fmt = self.labelFormat (delta, startpoint) = scaleParameters(self.minimum, self.maximum, self.nLabels) G = Group() # orientation independent data (direct values for vertical case, convert for horizontal case linedata = [] textdata = [] # the main axis linedata.append( (0, 0, 0, self.length) ) # the cross lines and labels lineposition = startpoint - self.minimum factor = self.factor() print "factor is", factor while lineposition+self.minimum<self.maximum: text = string.strip(fmt % (lineposition+self.minimum)) clineposition = factor * lineposition linedata.append( (0, clineposition, self.width, clineposition) ) textdata.append( (0, clineposition, text) ) lineposition = lineposition + delta print "done with lines" if orientation=="vertical": for (x1, y1, x2, y2) in linedata: G.add(Line(x+x1, y+y1, x+x2, y+y2)) for (x1, y1, t) in textdata: S = String(x+x1-self.extraOffset, y+y1, t) S.textAnchor = "end" G.add(S) elif orientation=="horizontal": for (y1, x1, y2, x2) in linedata: G.add(Line(x+x1, y+y1, x+x2, y+y2)) for (y1, x1, t) in textdata: S = String(x+x1, y+y1-self.extraOffset, t) S.textAnchor = "middle" G.add(S) else: raise ValueError, "bad orientation " + repr(orientation) return G
| 4,968
|
def draw(self): orientation = self.orientation # this could be done cleverly using the other widgets, but what the .... x,y = self.x, self.y fmt = self.labelFormat (delta, startpoint) = scaleParameters(self.minimum, self.maximum, self.nLabels) G = Group() # orientation independent data (direct values for vertical case, convert for horizontal case linedata = [] textdata = [] # the main axis linedata.append( (0, 0, 0, self.length) ) # the cross lines and labels lineposition = startpoint - self.minimum factor = self.factor() print "factor is", factor while lineposition+self.minimum<self.maximum: text = string.strip(fmt % (lineposition+self.minimum)) clineposition = factor * lineposition print "lineposition, clineposition", lineposition, clineposition linedata.append( (0, clineposition, self.width, clineposition) ) textdata.append( (0, clineposition, text) ) lineposition = lineposition + delta print "done with lines" if orientation=="vertical": for (x1, y1, x2, y2) in linedata: G.add(Line(x+x1, y+y1, x+x2, y+y2)) for (x1, y1, t) in textdata: S = String(x+x1-self.extraOffset, y+y1, t) S.textAnchor = "end" G.add(S) elif orientation=="horizontal": for (y1, x1, y2, x2) in linedata: G.add(Line(x+x1, y+y1, x+x2, y+y2)) for (y1, x1, t) in textdata: S = String(x+x1, y+y1-self.extraOffset, t) S.textAnchor = "middle" G.add(S) else: raise ValueError, "bad orientation " + repr(orientation) return G
|
def draw(self): orientation = self.orientation # this could be done cleverly using the other widgets, but what the .... x,y = self.x, self.y fmt = self.labelFormat (delta, startpoint) = scaleParameters(self.minimum, self.maximum, self.nLabels) G = Group() # orientation independent data (direct values for vertical case, convert for horizontal case linedata = [] textdata = [] # the main axis linedata.append( (0, 0, 0, self.length) ) # the cross lines and labels lineposition = startpoint - self.minimum factor = self.factor() print "factor is", factor while lineposition+self.minimum<self.maximum: text = string.strip(fmt % (lineposition+self.minimum)) clineposition = factor * lineposition print "lineposition, clineposition", lineposition, clineposition linedata.append( (0, clineposition, self.width, clineposition) ) textdata.append( (0, clineposition, text) ) lineposition = lineposition + delta if orientation=="vertical": for (x1, y1, x2, y2) in linedata: G.add(Line(x+x1, y+y1, x+x2, y+y2)) for (x1, y1, t) in textdata: S = String(x+x1-self.extraOffset, y+y1, t) S.textAnchor = "end" G.add(S) elif orientation=="horizontal": for (y1, x1, y2, x2) in linedata: G.add(Line(x+x1, y+y1, x+x2, y+y2)) for (y1, x1, t) in textdata: S = String(x+x1, y+y1-self.extraOffset, t) S.textAnchor = "middle" G.add(S) else: raise ValueError, "bad orientation " + repr(orientation) return G
| 4,969
|
def draw(self): self.valueAxis.configure(self.data) self.valueAxis.setPosition(self.x, self.y, self.height)
|
def draw(self): self.valueAxis.configure(self.data) self.valueAxis.setPosition(self.x, self.y, self.height)
| 4,970
|
def draw(self): self.valueAxis.configure(self.data) self.valueAxis.setPosition(self.x, self.y, self.height)
|
defdraw(self):self.valueAxis.configure(self.data)self.valueAxis.setPosition(self.x,self.y,self.height)
| 4,971
|
def draw(self): self.valueAxis.configure(self.data) self.valueAxis.setPosition(self.x, self.y, self.height)
|
def draw(self): self.valueAxis.configure(self.data) self.valueAxis.setPosition(self.x, self.y, self.height)
| 4,972
|
def draw(self): self.valueAxis.configure(self.data) self.valueAxis.setPosition(self.x, self.y, self.width)
|
def draw(self): self.valueAxis.configure(self.data) self.valueAxis.setPosition(self.x, self.y, self.width)
| 4,973
|
def draw(self): self.valueAxis.configure(self.data) self.valueAxis.setPosition(self.x, self.y, self.width)
|
defdraw(self):self.valueAxis.configure(self.data)self.valueAxis.setPosition(self.x,self.y,self.width)
| 4,974
|
def draw(self): self.valueAxis.configure(self.data) self.valueAxis.setPosition(self.x, self.y, self.width)
|
def draw(self): self.valueAxis.configure(self.data) self.valueAxis.setPosition(self.x, self.y, self.width)
| 4,975
|
def getRectsBounds(rectList): # filter out any None objects, e.g. empty groups rectList2 = [] for elem in rectList: if elem == (0,0,0,0): print 'got an empty one' if elem is not None: rectList2.append(elem) xMin, yMin, xMax, yMax = rectList2[0] for (x1, y1, x2, y2) in rectList2[1:]: if x1 < xMin: xMin = x1 if x2 > xMax: xMax = x2 if y1 < yMin: yMin = y1 if y2 > yMax: yMax = y2 return (xMin, yMin, xMax, yMax)
|
def getRectsBounds(rectList): # filter out any None objects, e.g. empty groups L = filter(lambda x: x is not None, rectList) if not L: return None xMin, yMin, xMax, yMax = L[0] for (x1, y1, x2, y2) in L[1:]: if x1 < xMin: xMin = x1 if x2 > xMax: xMax = x2 if y1 < yMin: yMin = y1 if y2 > yMax: yMax = y2 return (xMin, yMin, xMax, yMax)
| 4,976
|
def getBounds(self): if self.contents: b = [] for elem in self.contents: b.append(elem.getBounds()) (x1, y1, x2, y2) = getRectsBounds(b) trans = self.transform corners = [[x1,y1], [x1, y2], [x2, y1], [x2,y2]] newCorners = [] for corner in corners: newCorners.append(transformPoint(trans, corner)) return getPointsBounds(newCorners) else: #empty group needs a sane default; this #will happen when interactively creating a group #nothing has been added to yet. The alternative is #to handle None as an allowed return value everywhere. return None
|
def getBounds(self): if self.contents: b = [] for elem in self.contents: b.append(elem.getBounds()) x1 = getRectsBounds(b) if x1 is None: return None x1, y1, x2, y2 = x1 trans = self.transform corners = [[x1,y1], [x1, y2], [x2, y1], [x2,y2]] newCorners = [] for corner in corners: newCorners.append(transformPoint(trans, corner)) return getPointsBounds(newCorners) else: #empty group needs a sane default; this #will happen when interactively creating a group #nothing has been added to yet. The alternative is #to handle None as an allowed return value everywhere. return None
| 4,977
|
def _checkDXY(self,ba): if ba[0]=='n': if not hasattr(self,'_ody'): self._ody = self.dy self.dy = -self._ody + self._ydepth_3d
|
def _checkDXY(self,ba): if ba[0]=='n': if not hasattr(self,'_ody'): self._ody = self.dy self.dy = -self._ody + self._ydepth_3d
| 4,978
|
def _checkDXY(self,ba): if ba[0]=='n': if not hasattr(self,'_ody'): self._ody = self.dy self.dy = -self._ody + self._ydepth_3d
|
def _checkDXY(self,ba): if ba[0]=='n': if not hasattr(self,'_ody'): self._ody = self.dy self.dy = -self._ody + self._ydepth_3d
| 4,979
|
def test2(self): "try under a directory NOT on the path" rlDir = os.path.dirname(reportlab.__file__) ppDir = os.path.join(rlDir, 'tools','pythonpoint') m1 = recursiveImport('stdparser', baseDir=ppDir)
|
def test2(self): "try under a directory NOT on the path" D = os.path.join(os.path.dirname(reportlab.__file__), 'tools','pythonpoint') fn = os.path.join(D,'stdparser.py') if os.path.isfile(fn) or os.path.isfile(fn+'c') or os.path.isfile(fn+'o'): m1 = recursiveImport('stdparser', baseDir=D)
| 4,980
|
def makeSuite(): return makeSuiteForClasses(ImporterTestCase)
|
def makeSuite(): return makeSuiteForClasses(ImporterTestCase)
| 4,981
|
def open_for_read(name,mode='b'): '''attempt to open a file or URL for reading''' if hasattr(name,'read'): return name import urllib try: t, o = urllib.splittype(name) if not t or t=='file': raise ValueError o = urllib.urlopen(name) return getStringIO(o.read()) except: if 'r' not in mode: mode = 'r'+mode try: return open(name,mode) except IOError: t, v = sys.exc_info()[:2] if _isFSD or __loader__ is None: raise try: #we have a __loader__, perhaps the filename starts with #the dirname(reportlab.__file__) or is relative name = _startswith_rl(name) s = __loader__.get_data(name) if 'b' not in mode and os.linesep!='\n': s = s.replace(os.linesep,'\n') return getStringIO(s) except: raise t, v
|
def open_for_read_by_name(name,mode='b'): if 'r' not in mode: mode = 'r'+mode try: return open(name,mode) except IOError: t, v = sys.exc_info()[:2] if _isFSD or __loader__ is None: raise try: name = _startswith_rl(name) s = __loader__.get_data(name) if 'b' not in mode and os.linesep!='\n': s = s.replace(os.linesep,'\n') return getStringIO(s) except: raise t, v import urllib, urlparse def open_for_read(name,mode='b', urlparse=urlparse.urlparse, urlopen=urllib.urlopen): '''attempt to open a file or URL for reading''' if hasattr(name,'read'): return name import urllib try: t, o = urllib.splittype(name) if not t or t=='file': raise ValueError o = urllib.urlopen(name) return getStringIO(o.read()) except: if 'r' not in mode: mode = 'r'+mode try: return open(name,mode) except IOError: t, v = sys.exc_info()[:2] if _isFSD or __loader__ is None: raise try: #we have a __loader__, perhaps the filename starts with #the dirname(reportlab.__file__) or is relative name = _startswith_rl(name) s = __loader__.get_data(name) if 'b' not in mode and os.linesep!='\n': s = s.replace(os.linesep,'\n') return getStringIO(s) except: raise t, v
| 4,982
|
def open_for_read(name,mode='b'): '''attempt to open a file or URL for reading''' if hasattr(name,'read'): return name import urllib try: t, o = urllib.splittype(name) if not t or t=='file': raise ValueError o = urllib.urlopen(name) return getStringIO(o.read()) except: if 'r' not in mode: mode = 'r'+mode try: return open(name,mode) except IOError: t, v = sys.exc_info()[:2] if _isFSD or __loader__ is None: raise try: #we have a __loader__, perhaps the filename starts with #the dirname(reportlab.__file__) or is relative name = _startswith_rl(name) s = __loader__.get_data(name) if 'b' not in mode and os.linesep!='\n': s = s.replace(os.linesep,'\n') return getStringIO(s) except: raise t, v
|
def open_for_read(name,mode='b'): '''attempt to open a file or URL for reading''' if hasattr(name,'read'): return name try: P = urlparse(name) if not P[0] or P[0]=='file': raise ValueError return getStringIO(urlopen(name).read()) except: if 'r' not in mode: mode = 'r'+mode try: return open(name,mode) except IOError: t, v = sys.exc_info()[:2] if _isFSD or __loader__ is None: raise try: #we have a __loader__, perhaps the filename starts with #the dirname(reportlab.__file__) or is relative name = _startswith_rl(name) s = __loader__.get_data(name) if 'b' not in mode and os.linesep!='\n': s = s.replace(os.linesep,'\n') return getStringIO(s) except: raise t, v
| 4,983
|
def open_for_read(name,mode='b'): '''attempt to open a file or URL for reading''' if hasattr(name,'read'): return name import urllib try: t, o = urllib.splittype(name) if not t or t=='file': raise ValueError o = urllib.urlopen(name) return getStringIO(o.read()) except: if 'r' not in mode: mode = 'r'+mode try: return open(name,mode) except IOError: t, v = sys.exc_info()[:2] if _isFSD or __loader__ is None: raise try: #we have a __loader__, perhaps the filename starts with #the dirname(reportlab.__file__) or is relative name = _startswith_rl(name) s = __loader__.get_data(name) if 'b' not in mode and os.linesep!='\n': s = s.replace(os.linesep,'\n') return getStringIO(s) except: raise t, v
|
def open_for_read(name,mode='b'): '''attempt to open a file or URL for reading''' if hasattr(name,'read'): return name import urllib try: t, o = urllib.splittype(name) if not t or t=='file': raise ValueError o = urllib.urlopen(name) return getStringIO(o.read()) except: if 'r' not in mode: mode = 'r'+mode try: return open(name,mode) except IOError: t, v = sys.exc_info()[:2] if _isFSD or __loader__ is None: raise try: #we have a __loader__, perhaps the filename starts with #the dirname(reportlab.__file__) or is relative name = _startswith_rl(name) s = __loader__.get_data(name) if 'b' not in mode and os.linesep!='\n': s = s.replace(os.linesep,'\n') return getStringIO(s) except: raise t, v
| 4,984
|
def _StarSix(self): r = float(self.size)/2 c = 30*_toradians s = sin(30*_toradians)*r c = cos(c)*r z = s/2 g = c/2 return self._doPolygon((0,r,-z,s,-c,s,-s,0,-c,-s,-z,-s,0,-r,z,-s,c,-s,s,0,c,s,z,s))
|
def _StarSix(self): r = float(self.size)/2 c = 30*_toradians s = sin(c)*r c = cos(c)*r z = s/2 g = c/2 return self._doPolygon((0,r,-z,s,-c,s,-s,0,-c,-s,-z,-s,0,-r,z,-s,c,-s,s,0,c,s,z,s))
| 4,985
|
def draw(self): if self.kind: m = getattr(self,'_'+self.kind) if self.angle: _x, _dx, _y, _dy = self.x, self.dx, self.y, self.dy self.x, self.dx, self.y, self.dy = 0,0,0,0 try: m = m() finally: self.x, self.dx, self.y, self.dy = _x, _dx, _y, _dy if not isinstance(m,Group): _m, m = m, Group() m.add(_m) if self.angle: m.rotate(angle) x, y = _x+_dx, _y+_dy if x or y: m.shift(x,y) else: m = m() else: m = Group() return m
|
def draw(self): if self.kind: m = getattr(self,'_'+self.kind) if self.angle: _x, _dx, _y, _dy = self.x, self.dx, self.y, self.dy self.x, self.dx, self.y, self.dy = 0,0,0,0 try: m = m() finally: self.x, self.dx, self.y, self.dy = _x, _dx, _y, _dy if not isinstance(m,Group): _m, m = m, Group() m.add(_m) if self.angle: m.rotate(self.angle) x, y = _x+_dx, _y+_dy if x or y: m.shift(x,y) else: m = m() else: m = Group() return m
| 4,986
|
def makeMarker(name,**kw): if Marker._attrMap['kind'].validate(name): m = apply(Marker,(),kw) m.kind = name elif name[-5:]=='_Flag' and Flag._attrMap['kind'].validate(name[:-5]): m = apply(Flag,(),kw) m.kind = name[:-5] m.size = 10 else: raise ValueError, "Invalid marker name %s" % name return m
|
def makeMarker(name,**kw): if Marker._attrMap['kind'].validate(name): m = apply(Marker,(),kw) m.kind = name elif name[-5:]=='_Flag' and Flag._attrMap['kind'].validate(name[:-5]): m = apply(Flag,(),kw) m.kind = name[:-5] m.size = 10 else: raise ValueError, "Invalid marker name %s" % name return m
| 4,987
|
def myFirstPage(canvas, doc): canvas.saveState() canvas.setFont('Times-Bold',16) canvas.drawString(108, layout.PAGE_HEIGHT-108, Title) canvas.setFont('Times-Roman',9) canvas.restoreState()
|
def myFirstPage(canvas, doc): canvas.saveState() canvas.restoreState()
| 4,988
|
def go(): doc = layout.SimpleFlowDocument('fodyssey.pdf',layout.DEFAULT_PAGE_SIZE,showBoundary=0) doc.onFirstPage = myFirstPage doc.onNewPage = myLaterPages doc.build(Elements)
|
def go(): doc = layout.SimpleFlowDocument('fodyssey.pdf',layout.DEFAULT_PAGE_SIZE,showBoundary=0) doc.onFirstPage = myFirstPage doc.onNewPage = myLaterPages doc.build(Elements)
| 4,989
|
def p(txt, style=ParaStyle): Elements.append(layout.Spacer(0.2*inch, 0.1*inch)) Elements.append(Paragraph(txt, style))
|
def p(txt, style=ParaStyle): spacer(0.1) Elements.append(Paragraph(txt, style))
| 4,990
|
def p(txt, style=ParaStyle): Elements.append(layout.Spacer(0.2*inch, 0.1*inch)) Elements.append(Paragraph(txt, style))
|
def p(txt, style=ParaStyle): Elements.append(layout.Spacer(0.2*inch, 0.1*inch)) Elements.append(Paragraph(txt, style))
| 4,991
|
def pre(txt, style=PreStyle): s = layout.Spacer(0.1*inch, 0.1*inch) Elements.append(s) p = layout.Preformatted(txt, PreStyle) Elements.append(p)
|
def pre(txt, style=PreStyle): spacer(0.1) p = layout.Preformatted(txt, style) Elements.append(p)
| 4,992
|
def findNext(L, i): while 1: if string.strip(L[i])=='': del L[i] kind = 1 if i<len(L): while string.strip(L[i])=='': del L[i]
|
def findNext(L, i): while 1: if string.strip(L[i])=='': del L[i] kind = 1 if i<len(L): while string.strip(L[i])=='': del L[i]
| 4,993
|
def __init__(self): self.fillColor = white self.strokeColor = None self.strokeWidth = 0.1 self.background = ReportLabBlue self.shadow = 0.5 self.height = 86 self.width = 129 self.x = self.y = self.angle = 0
|
def __init__(self): self.fillColor = white self.strokeColor = None self.strokeWidth = 0.1 self.background = ReportLabBlue self.shadow = 0.5 self.height = 86 self.width = 129 self.x = self.y = self.angle = 0
| 4,994
|
def _paintLogo(self, g, dx=0, dy=0, strokeColor=None, strokeWidth=0.1, fillColor=white): g.add(definePath([ ('moveTo' ,15.7246,0 ), ('lineTo' ,9.49521,0 ), ('lineTo' ,6.64988,6.83711 ), ('curveTo' ,6.62224,6.95315 ,6.57391,7.10646 ,6.50485,7.29708 ), ('curveTo' ,6.43578,7.48767 ,6.35059,7.71559 ,6.24931,7.98079 ), ('lineTo' ,6.29074,6.71282 ), ('lineTo' ,6.29074,0 ), ('lineTo' ,0.55862,0 ), ('lineTo' ,0.55862,19.19365 ), ('lineTo' ,6.45649,19.19365 ), ('curveTo' ,9.05324,19.19365 ,10.99617,18.73371 ,12.28532,17.8138 ), ('curveTo' ,13.92439,16.63697 ,14.7439,14.96293 ,14.7439,12.79161 ), ('curveTo' ,14.7439,10.47114 ,13.64354,8.86755 ,11.44276,7.98079 ), 'closePath', ('moveTo' ,6.31838,10.30542 ), ('lineTo' ,6.70513,10.30542 ), ('curveTo' ,7.36812,10.30542 ,7.92062,10.53331 ,8.36261,10.98912 ), ('curveTo' ,8.80461,11.44491 ,9.0256,12.02504 ,9.0256,12.72947 ), ('curveTo' ,9.0256,14.16321 ,8.19227,14.88004 ,6.52556,14.88004 ), ('lineTo' ,6.31838,14.88004 ), 'closePath', ('moveTo' ,25.06173,4.54978 ), ('lineTo' ,30.47611,4.45033 ), ('curveTo' ,30.08951,2.88402 ,29.33668,1.70513 ,28.21787,0.91369 ), ('curveTo' ,27.09906,0.12223 ,25.63726,-0.27348 ,23.83245,-0.27348 ), ('curveTo' ,21.69611,-0.27348 ,20.02024,0.32322 ,18.80475,1.5166 ), ('curveTo' ,17.59846,2.72658 ,16.99531,4.37988 ,16.99531,6.47662 ), ('curveTo' ,16.99531,8.6065 ,17.64451,10.34269 ,18.94286,11.68527 ), ('curveTo' ,20.24124,13.03612 ,21.91711,13.71152 ,23.97056,13.71152 ), ('curveTo' ,26.01482,13.71152 ,27.64466,13.06096 ,28.86015,11.75985 ), ('curveTo' ,30.07566,10.45042 ,30.68326,8.71423 ,30.68326,6.5512 ), ('lineTo' ,30.65586,5.66859 ), ('lineTo' ,22.53407,5.66859 ), ('curveTo' ,22.59855,4.29287 ,23.03132,3.60503 ,23.83245,3.60503 ), ('curveTo' ,24.45861,3.60503 ,24.86837,3.91994 ,25.06173,4.54978 ), 'closePath', ('moveTo' ,25.18604,8.35371 ), ('curveTo' ,25.18604,8.60235 ,25.15384,8.83024 ,25.08937,9.03742 ), ('curveTo' ,25.02489,9.24463 ,24.93514,9.42278 ,24.82001,9.57197 ), ('curveTo' ,24.70492,9.72113 ,24.56911,9.83923 ,24.41255,9.92624 ), ('curveTo' ,24.25603,10.01326 ,24.08568,10.05678 ,23.90152,10.05678 ), ('curveTo' ,23.51474,10.05678 ,23.20169,9.89725 ,22.96225,9.57819 ), ('curveTo' ,22.72283,9.25913 ,22.60314,8.85096 ,22.60314,8.35371 ), 'closePath', ('moveTo' ,38.36308,-5.99181 ), ('lineTo' ,32.82428,-5.99181 ), ('lineTo' ,32.82428,13.43804 ), ('lineTo' ,38.36308,13.43804 ), ('lineTo' ,38.23873,11.53608 ), ('curveTo' ,38.46886,11.93387 ,38.70371,12.27159 ,38.94327,12.54922 ), ('curveTo' ,39.18254,12.82685 ,39.44037,13.05268 ,39.71676,13.22671 ), ('curveTo' ,39.99286,13.40074 ,40.28988,13.52712 ,40.60753,13.60585 ), ('curveTo' ,40.92518,13.68459 ,41.27759,13.72396 ,41.66419,13.72396 ), ('curveTo' ,43.10068,13.72396 ,44.2702,13.07755 ,45.17246,11.78472 ), ('curveTo' ,46.06588,10.50844 ,46.51229,8.81368 ,46.51229,6.70038 ), ('curveTo' ,46.51229,4.55394 ,46.08415,2.85502 ,45.22785,1.60362 ), ('curveTo' ,44.38983,0.35221 ,43.23416,-0.27348 ,41.76084,-0.27348 ), ('curveTo' ,40.41659,-0.27348 ,39.24235,0.42679 ,38.23873,1.82739 ), ('curveTo' ,38.2847,1.40472 ,38.31239,1.04007 ,38.32153,0.73345 ), ('curveTo' ,38.34923,0.41851 ,38.36308,0.04146 ,38.36308,-0.3978 ), 'closePath', ('moveTo' ,40.7802,6.84954 ), ('curveTo' ,40.7802,7.72802 ,40.66734,8.40964 ,40.44193,8.89448 ), ('curveTo' ,40.21621,9.37929 ,39.89621,9.62168 ,39.48191,9.62168 ), ('curveTo' ,38.62533,9.62168 ,38.19718,8.68108 ,38.19718,6.79983 ), ('curveTo' ,38.19718,4.87712 ,38.61177,3.91581 ,39.44037,3.91581 ), ('curveTo' ,39.85466,3.91581 ,40.18174,4.1727 ,40.42101,4.68654 ), ('curveTo' ,40.66057,5.20037 ,40.7802,5.92135 ,40.7802,6.84954 ), 'closePath', ('moveTo' ,62.10648,6.51392 ), ('curveTo' ,62.10648,4.44205 ,61.47118,2.79288 ,60.2003,1.56631 ), ('curveTo' ,58.92971,0.33978 ,57.22626,-0.27348 ,55.08965,-0.27348 ), ('curveTo' ,52.99018,-0.27348 ,51.31914,0.35221 ,50.07595,1.60362 ), ('curveTo' ,48.8419,2.8633 ,48.22517,4.55394 ,48.22517,6.67551 ), ('curveTo' ,48.22517,8.79709 ,48.85575,10.50016 ,50.1175,11.78472 ), ('curveTo' ,51.36982,13.07755 ,53.03172,13.72396 ,55.1035,13.72396 ), ('curveTo' ,57.28608,13.72396 ,58.99866,13.08168 ,60.24185,11.79712 ), ('curveTo' ,61.48503,10.51259 ,62.10648,8.75154 ,62.10648,6.51392 ), 'closePath', ('moveTo' ,56.73358,6.67551 ), ('curveTo' ,56.73358,7.17276 ,56.69675,7.62236 ,56.62308,8.02428 ), ('curveTo' ,56.54942,8.42623 ,56.44334,8.77016 ,56.30544,9.05607 ), ('curveTo' ,56.16724,9.34198 ,56.00134,9.56369 ,55.80804,9.72113 ), ('curveTo' ,55.61474,9.8786 ,55.39817,9.95733 ,55.1589,9.95733 ), ('curveTo' ,54.68921,9.95733 ,54.31174,9.65898 ,54.02621,9.06229 ), ('curveTo' ,53.74068,8.54018 ,53.59807,7.75702 ,53.59807,6.71282 ), ('curveTo' ,53.59807,5.68515 ,53.74068,4.90202 ,54.02621,4.36332 ), ('curveTo' ,54.31174,3.76663 ,54.69392,3.46828 ,55.17275,3.46828 ), ('curveTo' ,55.62388,3.46828 ,55.99692,3.7625 ,56.29159,4.35088 ), ('curveTo' ,56.58625,5.0056 ,56.73358,5.78047 ,56.73358,6.67551 ), 'closePath', ('moveTo' ,69.78629,0 ), ('lineTo' ,64.2475,0 ), ('lineTo' ,64.2475,13.43804 ), ('lineTo' ,69.78629,13.43804 ), ('lineTo' ,69.49605,10.81507 ), ('curveTo' ,70.33407,12.77921 ,71.71988,13.76126 ,73.65346,13.76126 ), ('lineTo' ,73.65346,8.16725 ), ('curveTo' ,73.04586,8.4656 ,72.5302,8.61478 ,72.10647,8.61478 ), ('curveTo' ,71.36068,8.61478 ,70.78756,8.37236 ,70.38711,7.88755 ), ('curveTo' ,69.98637,7.40274 ,69.78629,6.69623 ,69.78629,5.76804 ), 'closePath', ('moveTo' ,81.55427,0 ), ('lineTo' ,76.00163,0 ), ('lineTo' ,76.00163,9.42278 ), ('lineTo' ,74.42725,9.42278 ), ('lineTo' ,74.42725,13.43804 ), ('lineTo' ,76.00163,13.43804 ), ('lineTo' ,76.00163,17.39113 ), ('lineTo' ,81.55427,17.39113 ), ('lineTo' ,81.55427,13.43804 ), ('lineTo' ,83.39121,13.43804 ), ('lineTo' ,83.39121,9.42278 ), ('lineTo' ,81.55427,9.42278 ), 'closePath', ('moveTo' ,95.17333,0 ), ('lineTo' ,85.09024,0 ), ('lineTo' ,85.09024,19.19365 ), ('lineTo' ,90.85002,19.19365 ), ('lineTo' ,90.85002,4.61196 ), ('lineTo' ,95.17333,4.61196 ), 'closePath', ('moveTo' ,110.00787,0 ), ('lineTo' ,104.45523,0 ), ('curveTo' ,104.5012,0.44754 ,104.53803,0.87433 ,104.56573,1.2804 ), ('curveTo' ,104.59313,1.68651 ,104.62083,2.01385 ,104.64853,2.26246 ), ('curveTo' ,103.69087,0.57182 ,102.40644,-0.27348 ,100.79492,-0.27348 ), ('curveTo' ,99.39527,-0.27348 ,98.28557,0.35637 ,97.46611,1.61605 ), ('curveTo' ,96.65578,2.86746 ,96.25062,4.59952 ,96.25062,6.81227 ), ('curveTo' ,96.25062,8.95041 ,96.66963,10.63276 ,97.50765,11.8593 ), ('curveTo' ,98.34538,13.10242 ,99.4872,13.72396 ,100.93312,13.72396 ), ('curveTo' ,102.41557,13.72396 ,103.61249,12.92008 ,104.52418,11.31231 ), ('curveTo' ,104.50591,11.47806 ,104.49206,11.62309 ,104.48293,11.74741 ), ('curveTo' ,104.4735,11.87173 ,104.46437,11.9753 ,104.45523,12.05819 ), ('lineTo' ,104.39983,12.84135 ), ('lineTo' ,104.35858,13.43804 ), ('lineTo' ,110.00787,13.43804 ), 'closePath', ('moveTo' ,104.39983,6.88685 ), ('curveTo' ,104.39983,7.38409 ,104.37921,7.80676 ,104.33766,8.15481 ), ('curveTo' ,104.29641,8.5029 ,104.22952,8.78672 ,104.13758,9.00636 ), ('curveTo' ,104.04535,9.22598 ,103.92572,9.38341 ,103.77839,9.47874 ), ('curveTo' ,103.63106,9.57403 ,103.45161,9.62168 ,103.23974,9.62168 ), ('curveTo' ,102.30036,9.62168 ,101.83096,8.49875 ,101.83096,6.25285 ), ('curveTo' ,101.83096,4.64508 ,102.24967,3.8412 ,103.0877,3.8412 ), ('curveTo' ,103.96255,3.8412 ,104.39983,4.85641 ,104.39983,6.88685 ), 'closePath', ('moveTo' ,118.22604,0 ), ('lineTo' ,112.5629,0 ), ('lineTo' ,112.5629,20.99616 ), ('lineTo' ,118.10169,20.99616 ), ('lineTo' ,118.10169,13.63694 ), ('curveTo' ,118.10169,13.01538 ,118.07399,12.30268 ,118.01889,11.49877 ), ('curveTo' ,118.52542,12.31096 ,119.03636,12.88693 ,119.55202,13.22671 ), ('curveTo' ,120.08625,13.55821 ,120.75838,13.72396 ,121.5687,13.72396 ), ('curveTo' ,123.07885,13.72396 ,124.24837,13.09827 ,125.07697,11.84686 ), ('curveTo' ,125.90586,10.60373 ,126.32015,8.85099 ,126.32015,6.5885 ), ('curveTo' ,126.32015,4.42546 ,125.89201,2.74314 ,125.03571,1.54147 ), ('curveTo' ,124.18826,0.3315 ,123.01432,-0.27348 ,121.51331,-0.27348 ), ('curveTo' ,120.78608,-0.27348 ,120.16905,-0.12432 ,119.66252,0.17403 ), ('curveTo' ,119.41383,0.3315 ,119.15835,0.54283 ,118.8961,0.80803 ), ('curveTo' ,118.63356,1.07322 ,118.36866,1.40472 ,118.10169,1.80252 ), ('curveTo' ,118.11112,1.64505 ,118.12025,1.51039 ,118.12939,1.3985 ), ('curveTo' ,118.13852,1.28662 ,118.14766,1.19339 ,118.15709,1.11881 ), 'closePath', ('moveTo' ,120.58806,6.70038 ), ('curveTo' ,120.58806,8.62306 ,120.11837,9.5844 ,119.17898,9.5844 ), ('curveTo' ,118.35039,9.5844 ,117.93609,8.67693 ,117.93609,6.86198 ), ('curveTo' ,117.93609,4.96417 ,118.36424,4.01526 ,119.22053,4.01526 ), ('curveTo' ,120.13222,4.01526 ,120.58806,4.91027 ,120.58806,6.70038 ), 'closePath', ('moveTo',38.30626,-7.28346),('lineTo',38.30626,-25.55261),('lineTo',85.15777,-25.55261),('lineTo',85.15777,-1.39019),('lineTo',90.46172,-1.39019),('lineTo',90.46172,-31.15121),('lineTo',32.70766,-31.15121),('lineTo',32.70766,-7.28346), 'closePath', ('moveTo' ,32.70766,14.52164 ), ('lineTo' ,32.70766,47.81862 ), ('lineTo' ,80.14849,47.81862 ), ('lineTo' ,90.46172,37.21073 ), ('lineTo' ,90.46172,20.12025 ), ('lineTo' ,85.15777,20.12025 ), ('lineTo' ,85.15777,30.72814 ), ('lineTo' ,73.66589,30.72814 ), ('lineTo' ,73.66589,42.22002 ), ('lineTo' ,38.30626,42.22002 ), ('lineTo' ,38.30626,14.52164 ), 'closePath', ('moveTo' ,79.2645,36.32674 ), ('lineTo' ,85.15777,36.32674 ), ('lineTo' ,79.2645,42.22002 ), 'closePath', ], strokeColor=strokeColor,strokeWidth=strokeWidth,fillColor=fillColor, dx=dx, dy=dy))
|
def _paintLogo(self, g, dx=0, dy=0, strokeColor=None, strokeWidth=0.1, fillColor=white): P = [ ('moveTo' ,15.7246,0 ), ('lineTo' ,9.49521,0 ), ('lineTo' ,6.64988,6.83711 ), ('curveTo' ,6.62224,6.95315 ,6.57391,7.10646 ,6.50485,7.29708 ), ('curveTo' ,6.43578,7.48767 ,6.35059,7.71559 ,6.24931,7.98079 ), ('lineTo' ,6.29074,6.71282 ), ('lineTo' ,6.29074,0 ), ('lineTo' ,0.55862,0 ), ('lineTo' ,0.55862,19.19365 ), ('lineTo' ,6.45649,19.19365 ), ('curveTo' ,9.05324,19.19365 ,10.99617,18.73371 ,12.28532,17.8138 ), ('curveTo' ,13.92439,16.63697 ,14.7439,14.96293 ,14.7439,12.79161 ), ('curveTo' ,14.7439,10.47114 ,13.64354,8.86755 ,11.44276,7.98079 ), 'closePath', ('moveTo' ,6.31838,10.30542 ), ('lineTo' ,6.70513,10.30542 ), ('curveTo' ,7.36812,10.30542 ,7.92062,10.53331 ,8.36261,10.98912 ), ('curveTo' ,8.80461,11.44491 ,9.0256,12.02504 ,9.0256,12.72947 ), ('curveTo' ,9.0256,14.16321 ,8.19227,14.88004 ,6.52556,14.88004 ), ('lineTo' ,6.31838,14.88004 ), 'closePath', ('moveTo' ,25.06173,4.54978 ), ('lineTo' ,30.47611,4.45033 ), ('curveTo' ,30.08951,2.88402 ,29.33668,1.70513 ,28.21787,0.91369 ), ('curveTo' ,27.09906,0.12223 ,25.63726,-0.27348 ,23.83245,-0.27348 ), ('curveTo' ,21.69611,-0.27348 ,20.02024,0.32322 ,18.80475,1.5166 ), ('curveTo' ,17.59846,2.72658 ,16.99531,4.37988 ,16.99531,6.47662 ), ('curveTo' ,16.99531,8.6065 ,17.64451,10.34269 ,18.94286,11.68527 ), ('curveTo' ,20.24124,13.03612 ,21.91711,13.71152 ,23.97056,13.71152 ), ('curveTo' ,26.01482,13.71152 ,27.64466,13.06096 ,28.86015,11.75985 ), ('curveTo' ,30.07566,10.45042 ,30.68326,8.71423 ,30.68326,6.5512 ), ('lineTo' ,30.65586,5.66859 ), ('lineTo' ,22.53407,5.66859 ), ('curveTo' ,22.59855,4.29287 ,23.03132,3.60503 ,23.83245,3.60503 ), ('curveTo' ,24.45861,3.60503 ,24.86837,3.91994 ,25.06173,4.54978 ), 'closePath', ('moveTo' ,25.18604,8.35371 ), ('curveTo' ,25.18604,8.60235 ,25.15384,8.83024 ,25.08937,9.03742 ), ('curveTo' ,25.02489,9.24463 ,24.93514,9.42278 ,24.82001,9.57197 ), ('curveTo' ,24.70492,9.72113 ,24.56911,9.83923 ,24.41255,9.92624 ), ('curveTo' ,24.25603,10.01326 ,24.08568,10.05678 ,23.90152,10.05678 ), ('curveTo' ,23.51474,10.05678 ,23.20169,9.89725 ,22.96225,9.57819 ), ('curveTo' ,22.72283,9.25913 ,22.60314,8.85096 ,22.60314,8.35371 ), 'closePath', ('moveTo' ,38.36308,-5.99181 ), ('lineTo' ,32.82428,-5.99181 ), ('lineTo' ,32.82428,13.43804 ), ('lineTo' ,38.36308,13.43804 ), ('lineTo' ,38.23873,11.53608 ), ('curveTo' ,38.46886,11.93387 ,38.70371,12.27159 ,38.94327,12.54922 ), ('curveTo' ,39.18254,12.82685 ,39.44037,13.05268 ,39.71676,13.22671 ), ('curveTo' ,39.99286,13.40074 ,40.28988,13.52712 ,40.60753,13.60585 ), ('curveTo' ,40.92518,13.68459 ,41.27759,13.72396 ,41.66419,13.72396 ), ('curveTo' ,43.10068,13.72396 ,44.2702,13.07755 ,45.17246,11.78472 ), ('curveTo' ,46.06588,10.50844 ,46.51229,8.81368 ,46.51229,6.70038 ), ('curveTo' ,46.51229,4.55394 ,46.08415,2.85502 ,45.22785,1.60362 ), ('curveTo' ,44.38983,0.35221 ,43.23416,-0.27348 ,41.76084,-0.27348 ), ('curveTo' ,40.41659,-0.27348 ,39.24235,0.42679 ,38.23873,1.82739 ), ('curveTo' ,38.2847,1.40472 ,38.31239,1.04007 ,38.32153,0.73345 ), ('curveTo' ,38.34923,0.41851 ,38.36308,0.04146 ,38.36308,-0.3978 ), 'closePath', ('moveTo' ,40.7802,6.84954 ), ('curveTo' ,40.7802,7.72802 ,40.66734,8.40964 ,40.44193,8.89448 ), ('curveTo' ,40.21621,9.37929 ,39.89621,9.62168 ,39.48191,9.62168 ), ('curveTo' ,38.62533,9.62168 ,38.19718,8.68108 ,38.19718,6.79983 ), ('curveTo' ,38.19718,4.87712 ,38.61177,3.91581 ,39.44037,3.91581 ), ('curveTo' ,39.85466,3.91581 ,40.18174,4.1727 ,40.42101,4.68654 ), ('curveTo' ,40.66057,5.20037 ,40.7802,5.92135 ,40.7802,6.84954 ), 'closePath', ('moveTo' ,62.10648,6.51392 ), ('curveTo' ,62.10648,4.44205 ,61.47118,2.79288 ,60.2003,1.56631 ), ('curveTo' ,58.92971,0.33978 ,57.22626,-0.27348 ,55.08965,-0.27348 ), ('curveTo' ,52.99018,-0.27348 ,51.31914,0.35221 ,50.07595,1.60362 ), ('curveTo' ,48.8419,2.8633 ,48.22517,4.55394 ,48.22517,6.67551 ), ('curveTo' ,48.22517,8.79709 ,48.85575,10.50016 ,50.1175,11.78472 ), ('curveTo' ,51.36982,13.07755 ,53.03172,13.72396 ,55.1035,13.72396 ), ('curveTo' ,57.28608,13.72396 ,58.99866,13.08168 ,60.24185,11.79712 ), ('curveTo' ,61.48503,10.51259 ,62.10648,8.75154 ,62.10648,6.51392 ), 'closePath', ('moveTo' ,56.73358,6.67551 ), ('curveTo' ,56.73358,7.17276 ,56.69675,7.62236 ,56.62308,8.02428 ), ('curveTo' ,56.54942,8.42623 ,56.44334,8.77016 ,56.30544,9.05607 ), ('curveTo' ,56.16724,9.34198 ,56.00134,9.56369 ,55.80804,9.72113 ), ('curveTo' ,55.61474,9.8786 ,55.39817,9.95733 ,55.1589,9.95733 ), ('curveTo' ,54.68921,9.95733 ,54.31174,9.65898 ,54.02621,9.06229 ), ('curveTo' ,53.74068,8.54018 ,53.59807,7.75702 ,53.59807,6.71282 ), ('curveTo' ,53.59807,5.68515 ,53.74068,4.90202 ,54.02621,4.36332 ), ('curveTo' ,54.31174,3.76663 ,54.69392,3.46828 ,55.17275,3.46828 ), ('curveTo' ,55.62388,3.46828 ,55.99692,3.7625 ,56.29159,4.35088 ), ('curveTo' ,56.58625,5.0056 ,56.73358,5.78047 ,56.73358,6.67551 ), 'closePath', ('moveTo' ,69.78629,0 ), ('lineTo' ,64.2475,0 ), ('lineTo' ,64.2475,13.43804 ), ('lineTo' ,69.78629,13.43804 ), ('lineTo' ,69.49605,10.81507 ), ('curveTo' ,70.33407,12.77921 ,71.71988,13.76126 ,73.65346,13.76126 ), ('lineTo' ,73.65346,8.16725 ), ('curveTo' ,73.04586,8.4656 ,72.5302,8.61478 ,72.10647,8.61478 ), ('curveTo' ,71.36068,8.61478 ,70.78756,8.37236 ,70.38711,7.88755 ), ('curveTo' ,69.98637,7.40274 ,69.78629,6.69623 ,69.78629,5.76804 ), 'closePath', ('moveTo' ,81.55427,0 ), ('lineTo' ,76.00163,0 ), ('lineTo' ,76.00163,9.42278 ), ('lineTo' ,74.42725,9.42278 ), ('lineTo' ,74.42725,13.43804 ), ('lineTo' ,76.00163,13.43804 ), ('lineTo' ,76.00163,17.39113 ), ('lineTo' ,81.55427,17.39113 ), ('lineTo' ,81.55427,13.43804 ), ('lineTo' ,83.39121,13.43804 ), ('lineTo' ,83.39121,9.42278 ), ('lineTo' ,81.55427,9.42278 ), 'closePath', ('moveTo' ,95.17333,0 ), ('lineTo' ,85.09024,0 ), ('lineTo' ,85.09024,19.19365 ), ('lineTo' ,90.85002,19.19365 ), ('lineTo' ,90.85002,4.61196 ), ('lineTo' ,95.17333,4.61196 ), 'closePath', ('moveTo' ,110.00787,0 ), ('lineTo' ,104.45523,0 ), ('curveTo' ,104.5012,0.44754 ,104.53803,0.87433 ,104.56573,1.2804 ), ('curveTo' ,104.59313,1.68651 ,104.62083,2.01385 ,104.64853,2.26246 ), ('curveTo' ,103.69087,0.57182 ,102.40644,-0.27348 ,100.79492,-0.27348 ), ('curveTo' ,99.39527,-0.27348 ,98.28557,0.35637 ,97.46611,1.61605 ), ('curveTo' ,96.65578,2.86746 ,96.25062,4.59952 ,96.25062,6.81227 ), ('curveTo' ,96.25062,8.95041 ,96.66963,10.63276 ,97.50765,11.8593 ), ('curveTo' ,98.34538,13.10242 ,99.4872,13.72396 ,100.93312,13.72396 ), ('curveTo' ,102.41557,13.72396 ,103.61249,12.92008 ,104.52418,11.31231 ), ('curveTo' ,104.50591,11.47806 ,104.49206,11.62309 ,104.48293,11.74741 ), ('curveTo' ,104.4735,11.87173 ,104.46437,11.9753 ,104.45523,12.05819 ), ('lineTo' ,104.39983,12.84135 ), ('lineTo' ,104.35858,13.43804 ), ('lineTo' ,110.00787,13.43804 ), 'closePath', ('moveTo' ,104.39983,6.88685 ), ('curveTo' ,104.39983,7.38409 ,104.37921,7.80676 ,104.33766,8.15481 ), ('curveTo' ,104.29641,8.5029 ,104.22952,8.78672 ,104.13758,9.00636 ), ('curveTo' ,104.04535,9.22598 ,103.92572,9.38341 ,103.77839,9.47874 ), ('curveTo' ,103.63106,9.57403 ,103.45161,9.62168 ,103.23974,9.62168 ), ('curveTo' ,102.30036,9.62168 ,101.83096,8.49875 ,101.83096,6.25285 ), ('curveTo' ,101.83096,4.64508 ,102.24967,3.8412 ,103.0877,3.8412 ), ('curveTo' ,103.96255,3.8412 ,104.39983,4.85641 ,104.39983,6.88685 ), 'closePath', ('moveTo' ,118.22604,0 ), ('lineTo' ,112.5629,0 ), ('lineTo' ,112.5629,20.99616 ), ('lineTo' ,118.10169,20.99616 ), ('lineTo' ,118.10169,13.63694 ), ('curveTo' ,118.10169,13.01538 ,118.07399,12.30268 ,118.01889,11.49877 ), ('curveTo' ,118.52542,12.31096 ,119.03636,12.88693 ,119.55202,13.22671 ), ('curveTo' ,120.08625,13.55821 ,120.75838,13.72396 ,121.5687,13.72396 ), ('curveTo' ,123.07885,13.72396 ,124.24837,13.09827 ,125.07697,11.84686 ), ('curveTo' ,125.90586,10.60373 ,126.32015,8.85099 ,126.32015,6.5885 ), ('curveTo' ,126.32015,4.42546 ,125.89201,2.74314 ,125.03571,1.54147 ), ('curveTo' ,124.18826,0.3315 ,123.01432,-0.27348 ,121.51331,-0.27348 ), ('curveTo' ,120.78608,-0.27348 ,120.16905,-0.12432 ,119.66252,0.17403 ), ('curveTo' ,119.41383,0.3315 ,119.15835,0.54283 ,118.8961,0.80803 ), ('curveTo' ,118.63356,1.07322 ,118.36866,1.40472 ,118.10169,1.80252 ), ('curveTo' ,118.11112,1.64505 ,118.12025,1.51039 ,118.12939,1.3985 ), ('curveTo' ,118.13852,1.28662 ,118.14766,1.19339 ,118.15709,1.11881 ), 'closePath', ('moveTo' ,120.58806,6.70038 ), ('curveTo' ,120.58806,8.62306 ,120.11837,9.5844 ,119.17898,9.5844 ), ('curveTo' ,118.35039,9.5844 ,117.93609,8.67693 ,117.93609,6.86198 ), ('curveTo' ,117.93609,4.96417 ,118.36424,4.01526 ,119.22053,4.01526 ), ('curveTo' ,120.13222,4.01526 ,120.58806,4.91027 ,120.58806,6.70038 ), 'closePath', ] + (self.showPage and [ ('moveTo',38.30626,-7.28346),('lineTo',38.30626,-25.55261),('lineTo',85.15777,-25.55261),('lineTo',85.15777,-1.39019),('lineTo',90.46172,-1.39019),('lineTo',90.46172,-31.15121),('lineTo',32.70766,-31.15121),('lineTo',32.70766,-7.28346), 'closePath', ('moveTo' ,32.70766,14.52164 ), ('lineTo' ,32.70766,47.81862 ), ('lineTo' ,80.14849,47.81862 ), ('lineTo' ,90.46172,37.21073 ), ('lineTo' ,90.46172,20.12025 ), ('lineTo' ,85.15777,20.12025 ), ('lineTo' ,85.15777,30.72814 ), ('lineTo' ,73.66589,30.72814 ), ('lineTo' ,73.66589,42.22002 ), ('lineTo' ,38.30626,42.22002 ), ('lineTo' ,38.30626,14.52164 ), 'closePath', ('moveTo' ,79.2645,36.32674 ), ('lineTo' ,85.15777,36.32674 ), ('lineTo' ,79.2645,42.22002 ), 'closePath', ], strokeColor=strokeColor,strokeWidth=strokeWidth,fillColor=fillColor, dx=dx, dy=dy))
| 4,995
|
def _paintLogo(self, g, dx=0, dy=0, strokeColor=None, strokeWidth=0.1, fillColor=white): g.add(definePath([ ('moveTo' ,15.7246,0 ), ('lineTo' ,9.49521,0 ), ('lineTo' ,6.64988,6.83711 ), ('curveTo' ,6.62224,6.95315 ,6.57391,7.10646 ,6.50485,7.29708 ), ('curveTo' ,6.43578,7.48767 ,6.35059,7.71559 ,6.24931,7.98079 ), ('lineTo' ,6.29074,6.71282 ), ('lineTo' ,6.29074,0 ), ('lineTo' ,0.55862,0 ), ('lineTo' ,0.55862,19.19365 ), ('lineTo' ,6.45649,19.19365 ), ('curveTo' ,9.05324,19.19365 ,10.99617,18.73371 ,12.28532,17.8138 ), ('curveTo' ,13.92439,16.63697 ,14.7439,14.96293 ,14.7439,12.79161 ), ('curveTo' ,14.7439,10.47114 ,13.64354,8.86755 ,11.44276,7.98079 ), 'closePath', ('moveTo' ,6.31838,10.30542 ), ('lineTo' ,6.70513,10.30542 ), ('curveTo' ,7.36812,10.30542 ,7.92062,10.53331 ,8.36261,10.98912 ), ('curveTo' ,8.80461,11.44491 ,9.0256,12.02504 ,9.0256,12.72947 ), ('curveTo' ,9.0256,14.16321 ,8.19227,14.88004 ,6.52556,14.88004 ), ('lineTo' ,6.31838,14.88004 ), 'closePath', ('moveTo' ,25.06173,4.54978 ), ('lineTo' ,30.47611,4.45033 ), ('curveTo' ,30.08951,2.88402 ,29.33668,1.70513 ,28.21787,0.91369 ), ('curveTo' ,27.09906,0.12223 ,25.63726,-0.27348 ,23.83245,-0.27348 ), ('curveTo' ,21.69611,-0.27348 ,20.02024,0.32322 ,18.80475,1.5166 ), ('curveTo' ,17.59846,2.72658 ,16.99531,4.37988 ,16.99531,6.47662 ), ('curveTo' ,16.99531,8.6065 ,17.64451,10.34269 ,18.94286,11.68527 ), ('curveTo' ,20.24124,13.03612 ,21.91711,13.71152 ,23.97056,13.71152 ), ('curveTo' ,26.01482,13.71152 ,27.64466,13.06096 ,28.86015,11.75985 ), ('curveTo' ,30.07566,10.45042 ,30.68326,8.71423 ,30.68326,6.5512 ), ('lineTo' ,30.65586,5.66859 ), ('lineTo' ,22.53407,5.66859 ), ('curveTo' ,22.59855,4.29287 ,23.03132,3.60503 ,23.83245,3.60503 ), ('curveTo' ,24.45861,3.60503 ,24.86837,3.91994 ,25.06173,4.54978 ), 'closePath', ('moveTo' ,25.18604,8.35371 ), ('curveTo' ,25.18604,8.60235 ,25.15384,8.83024 ,25.08937,9.03742 ), ('curveTo' ,25.02489,9.24463 ,24.93514,9.42278 ,24.82001,9.57197 ), ('curveTo' ,24.70492,9.72113 ,24.56911,9.83923 ,24.41255,9.92624 ), ('curveTo' ,24.25603,10.01326 ,24.08568,10.05678 ,23.90152,10.05678 ), ('curveTo' ,23.51474,10.05678 ,23.20169,9.89725 ,22.96225,9.57819 ), ('curveTo' ,22.72283,9.25913 ,22.60314,8.85096 ,22.60314,8.35371 ), 'closePath', ('moveTo' ,38.36308,-5.99181 ), ('lineTo' ,32.82428,-5.99181 ), ('lineTo' ,32.82428,13.43804 ), ('lineTo' ,38.36308,13.43804 ), ('lineTo' ,38.23873,11.53608 ), ('curveTo' ,38.46886,11.93387 ,38.70371,12.27159 ,38.94327,12.54922 ), ('curveTo' ,39.18254,12.82685 ,39.44037,13.05268 ,39.71676,13.22671 ), ('curveTo' ,39.99286,13.40074 ,40.28988,13.52712 ,40.60753,13.60585 ), ('curveTo' ,40.92518,13.68459 ,41.27759,13.72396 ,41.66419,13.72396 ), ('curveTo' ,43.10068,13.72396 ,44.2702,13.07755 ,45.17246,11.78472 ), ('curveTo' ,46.06588,10.50844 ,46.51229,8.81368 ,46.51229,6.70038 ), ('curveTo' ,46.51229,4.55394 ,46.08415,2.85502 ,45.22785,1.60362 ), ('curveTo' ,44.38983,0.35221 ,43.23416,-0.27348 ,41.76084,-0.27348 ), ('curveTo' ,40.41659,-0.27348 ,39.24235,0.42679 ,38.23873,1.82739 ), ('curveTo' ,38.2847,1.40472 ,38.31239,1.04007 ,38.32153,0.73345 ), ('curveTo' ,38.34923,0.41851 ,38.36308,0.04146 ,38.36308,-0.3978 ), 'closePath', ('moveTo' ,40.7802,6.84954 ), ('curveTo' ,40.7802,7.72802 ,40.66734,8.40964 ,40.44193,8.89448 ), ('curveTo' ,40.21621,9.37929 ,39.89621,9.62168 ,39.48191,9.62168 ), ('curveTo' ,38.62533,9.62168 ,38.19718,8.68108 ,38.19718,6.79983 ), ('curveTo' ,38.19718,4.87712 ,38.61177,3.91581 ,39.44037,3.91581 ), ('curveTo' ,39.85466,3.91581 ,40.18174,4.1727 ,40.42101,4.68654 ), ('curveTo' ,40.66057,5.20037 ,40.7802,5.92135 ,40.7802,6.84954 ), 'closePath', ('moveTo' ,62.10648,6.51392 ), ('curveTo' ,62.10648,4.44205 ,61.47118,2.79288 ,60.2003,1.56631 ), ('curveTo' ,58.92971,0.33978 ,57.22626,-0.27348 ,55.08965,-0.27348 ), ('curveTo' ,52.99018,-0.27348 ,51.31914,0.35221 ,50.07595,1.60362 ), ('curveTo' ,48.8419,2.8633 ,48.22517,4.55394 ,48.22517,6.67551 ), ('curveTo' ,48.22517,8.79709 ,48.85575,10.50016 ,50.1175,11.78472 ), ('curveTo' ,51.36982,13.07755 ,53.03172,13.72396 ,55.1035,13.72396 ), ('curveTo' ,57.28608,13.72396 ,58.99866,13.08168 ,60.24185,11.79712 ), ('curveTo' ,61.48503,10.51259 ,62.10648,8.75154 ,62.10648,6.51392 ), 'closePath', ('moveTo' ,56.73358,6.67551 ), ('curveTo' ,56.73358,7.17276 ,56.69675,7.62236 ,56.62308,8.02428 ), ('curveTo' ,56.54942,8.42623 ,56.44334,8.77016 ,56.30544,9.05607 ), ('curveTo' ,56.16724,9.34198 ,56.00134,9.56369 ,55.80804,9.72113 ), ('curveTo' ,55.61474,9.8786 ,55.39817,9.95733 ,55.1589,9.95733 ), ('curveTo' ,54.68921,9.95733 ,54.31174,9.65898 ,54.02621,9.06229 ), ('curveTo' ,53.74068,8.54018 ,53.59807,7.75702 ,53.59807,6.71282 ), ('curveTo' ,53.59807,5.68515 ,53.74068,4.90202 ,54.02621,4.36332 ), ('curveTo' ,54.31174,3.76663 ,54.69392,3.46828 ,55.17275,3.46828 ), ('curveTo' ,55.62388,3.46828 ,55.99692,3.7625 ,56.29159,4.35088 ), ('curveTo' ,56.58625,5.0056 ,56.73358,5.78047 ,56.73358,6.67551 ), 'closePath', ('moveTo' ,69.78629,0 ), ('lineTo' ,64.2475,0 ), ('lineTo' ,64.2475,13.43804 ), ('lineTo' ,69.78629,13.43804 ), ('lineTo' ,69.49605,10.81507 ), ('curveTo' ,70.33407,12.77921 ,71.71988,13.76126 ,73.65346,13.76126 ), ('lineTo' ,73.65346,8.16725 ), ('curveTo' ,73.04586,8.4656 ,72.5302,8.61478 ,72.10647,8.61478 ), ('curveTo' ,71.36068,8.61478 ,70.78756,8.37236 ,70.38711,7.88755 ), ('curveTo' ,69.98637,7.40274 ,69.78629,6.69623 ,69.78629,5.76804 ), 'closePath', ('moveTo' ,81.55427,0 ), ('lineTo' ,76.00163,0 ), ('lineTo' ,76.00163,9.42278 ), ('lineTo' ,74.42725,9.42278 ), ('lineTo' ,74.42725,13.43804 ), ('lineTo' ,76.00163,13.43804 ), ('lineTo' ,76.00163,17.39113 ), ('lineTo' ,81.55427,17.39113 ), ('lineTo' ,81.55427,13.43804 ), ('lineTo' ,83.39121,13.43804 ), ('lineTo' ,83.39121,9.42278 ), ('lineTo' ,81.55427,9.42278 ), 'closePath', ('moveTo' ,95.17333,0 ), ('lineTo' ,85.09024,0 ), ('lineTo' ,85.09024,19.19365 ), ('lineTo' ,90.85002,19.19365 ), ('lineTo' ,90.85002,4.61196 ), ('lineTo' ,95.17333,4.61196 ), 'closePath', ('moveTo' ,110.00787,0 ), ('lineTo' ,104.45523,0 ), ('curveTo' ,104.5012,0.44754 ,104.53803,0.87433 ,104.56573,1.2804 ), ('curveTo' ,104.59313,1.68651 ,104.62083,2.01385 ,104.64853,2.26246 ), ('curveTo' ,103.69087,0.57182 ,102.40644,-0.27348 ,100.79492,-0.27348 ), ('curveTo' ,99.39527,-0.27348 ,98.28557,0.35637 ,97.46611,1.61605 ), ('curveTo' ,96.65578,2.86746 ,96.25062,4.59952 ,96.25062,6.81227 ), ('curveTo' ,96.25062,8.95041 ,96.66963,10.63276 ,97.50765,11.8593 ), ('curveTo' ,98.34538,13.10242 ,99.4872,13.72396 ,100.93312,13.72396 ), ('curveTo' ,102.41557,13.72396 ,103.61249,12.92008 ,104.52418,11.31231 ), ('curveTo' ,104.50591,11.47806 ,104.49206,11.62309 ,104.48293,11.74741 ), ('curveTo' ,104.4735,11.87173 ,104.46437,11.9753 ,104.45523,12.05819 ), ('lineTo' ,104.39983,12.84135 ), ('lineTo' ,104.35858,13.43804 ), ('lineTo' ,110.00787,13.43804 ), 'closePath', ('moveTo' ,104.39983,6.88685 ), ('curveTo' ,104.39983,7.38409 ,104.37921,7.80676 ,104.33766,8.15481 ), ('curveTo' ,104.29641,8.5029 ,104.22952,8.78672 ,104.13758,9.00636 ), ('curveTo' ,104.04535,9.22598 ,103.92572,9.38341 ,103.77839,9.47874 ), ('curveTo' ,103.63106,9.57403 ,103.45161,9.62168 ,103.23974,9.62168 ), ('curveTo' ,102.30036,9.62168 ,101.83096,8.49875 ,101.83096,6.25285 ), ('curveTo' ,101.83096,4.64508 ,102.24967,3.8412 ,103.0877,3.8412 ), ('curveTo' ,103.96255,3.8412 ,104.39983,4.85641 ,104.39983,6.88685 ), 'closePath', ('moveTo' ,118.22604,0 ), ('lineTo' ,112.5629,0 ), ('lineTo' ,112.5629,20.99616 ), ('lineTo' ,118.10169,20.99616 ), ('lineTo' ,118.10169,13.63694 ), ('curveTo' ,118.10169,13.01538 ,118.07399,12.30268 ,118.01889,11.49877 ), ('curveTo' ,118.52542,12.31096 ,119.03636,12.88693 ,119.55202,13.22671 ), ('curveTo' ,120.08625,13.55821 ,120.75838,13.72396 ,121.5687,13.72396 ), ('curveTo' ,123.07885,13.72396 ,124.24837,13.09827 ,125.07697,11.84686 ), ('curveTo' ,125.90586,10.60373 ,126.32015,8.85099 ,126.32015,6.5885 ), ('curveTo' ,126.32015,4.42546 ,125.89201,2.74314 ,125.03571,1.54147 ), ('curveTo' ,124.18826,0.3315 ,123.01432,-0.27348 ,121.51331,-0.27348 ), ('curveTo' ,120.78608,-0.27348 ,120.16905,-0.12432 ,119.66252,0.17403 ), ('curveTo' ,119.41383,0.3315 ,119.15835,0.54283 ,118.8961,0.80803 ), ('curveTo' ,118.63356,1.07322 ,118.36866,1.40472 ,118.10169,1.80252 ), ('curveTo' ,118.11112,1.64505 ,118.12025,1.51039 ,118.12939,1.3985 ), ('curveTo' ,118.13852,1.28662 ,118.14766,1.19339 ,118.15709,1.11881 ), 'closePath', ('moveTo' ,120.58806,6.70038 ), ('curveTo' ,120.58806,8.62306 ,120.11837,9.5844 ,119.17898,9.5844 ), ('curveTo' ,118.35039,9.5844 ,117.93609,8.67693 ,117.93609,6.86198 ), ('curveTo' ,117.93609,4.96417 ,118.36424,4.01526 ,119.22053,4.01526 ), ('curveTo' ,120.13222,4.01526 ,120.58806,4.91027 ,120.58806,6.70038 ), 'closePath', ('moveTo',38.30626,-7.28346),('lineTo',38.30626,-25.55261),('lineTo',85.15777,-25.55261),('lineTo',85.15777,-1.39019),('lineTo',90.46172,-1.39019),('lineTo',90.46172,-31.15121),('lineTo',32.70766,-31.15121),('lineTo',32.70766,-7.28346), 'closePath', ('moveTo' ,32.70766,14.52164 ), ('lineTo' ,32.70766,47.81862 ), ('lineTo' ,80.14849,47.81862 ), ('lineTo' ,90.46172,37.21073 ), ('lineTo' ,90.46172,20.12025 ), ('lineTo' ,85.15777,20.12025 ), ('lineTo' ,85.15777,30.72814 ), ('lineTo' ,73.66589,30.72814 ), ('lineTo' ,73.66589,42.22002 ), ('lineTo' ,38.30626,42.22002 ), ('lineTo' ,38.30626,14.52164 ), 'closePath', ('moveTo' ,79.2645,36.32674 ), ('lineTo' ,85.15777,36.32674 ), ('lineTo' ,79.2645,42.22002 ), 'closePath', ], strokeColor=strokeColor,strokeWidth=strokeWidth,fillColor=fillColor, dx=dx, dy=dy))
|
def _paintLogo(self, g, dx=0, dy=0, strokeColor=None, strokeWidth=0.1, fillColor=white): g.add(definePath([ ('moveTo' ,15.7246,0 ), ('lineTo' ,9.49521,0 ), ('lineTo' ,6.64988,6.83711 ), ('curveTo' ,6.62224,6.95315 ,6.57391,7.10646 ,6.50485,7.29708 ), ('curveTo' ,6.43578,7.48767 ,6.35059,7.71559 ,6.24931,7.98079 ), ('lineTo' ,6.29074,6.71282 ), ('lineTo' ,6.29074,0 ), ('lineTo' ,0.55862,0 ), ('lineTo' ,0.55862,19.19365 ), ('lineTo' ,6.45649,19.19365 ), ('curveTo' ,9.05324,19.19365 ,10.99617,18.73371 ,12.28532,17.8138 ), ('curveTo' ,13.92439,16.63697 ,14.7439,14.96293 ,14.7439,12.79161 ), ('curveTo' ,14.7439,10.47114 ,13.64354,8.86755 ,11.44276,7.98079 ), 'closePath', ('moveTo' ,6.31838,10.30542 ), ('lineTo' ,6.70513,10.30542 ), ('curveTo' ,7.36812,10.30542 ,7.92062,10.53331 ,8.36261,10.98912 ), ('curveTo' ,8.80461,11.44491 ,9.0256,12.02504 ,9.0256,12.72947 ), ('curveTo' ,9.0256,14.16321 ,8.19227,14.88004 ,6.52556,14.88004 ), ('lineTo' ,6.31838,14.88004 ), 'closePath', ('moveTo' ,25.06173,4.54978 ), ('lineTo' ,30.47611,4.45033 ), ('curveTo' ,30.08951,2.88402 ,29.33668,1.70513 ,28.21787,0.91369 ), ('curveTo' ,27.09906,0.12223 ,25.63726,-0.27348 ,23.83245,-0.27348 ), ('curveTo' ,21.69611,-0.27348 ,20.02024,0.32322 ,18.80475,1.5166 ), ('curveTo' ,17.59846,2.72658 ,16.99531,4.37988 ,16.99531,6.47662 ), ('curveTo' ,16.99531,8.6065 ,17.64451,10.34269 ,18.94286,11.68527 ), ('curveTo' ,20.24124,13.03612 ,21.91711,13.71152 ,23.97056,13.71152 ), ('curveTo' ,26.01482,13.71152 ,27.64466,13.06096 ,28.86015,11.75985 ), ('curveTo' ,30.07566,10.45042 ,30.68326,8.71423 ,30.68326,6.5512 ), ('lineTo' ,30.65586,5.66859 ), ('lineTo' ,22.53407,5.66859 ), ('curveTo' ,22.59855,4.29287 ,23.03132,3.60503 ,23.83245,3.60503 ), ('curveTo' ,24.45861,3.60503 ,24.86837,3.91994 ,25.06173,4.54978 ), 'closePath', ('moveTo' ,25.18604,8.35371 ), ('curveTo' ,25.18604,8.60235 ,25.15384,8.83024 ,25.08937,9.03742 ), ('curveTo' ,25.02489,9.24463 ,24.93514,9.42278 ,24.82001,9.57197 ), ('curveTo' ,24.70492,9.72113 ,24.56911,9.83923 ,24.41255,9.92624 ), ('curveTo' ,24.25603,10.01326 ,24.08568,10.05678 ,23.90152,10.05678 ), ('curveTo' ,23.51474,10.05678 ,23.20169,9.89725 ,22.96225,9.57819 ), ('curveTo' ,22.72283,9.25913 ,22.60314,8.85096 ,22.60314,8.35371 ), 'closePath', ('moveTo' ,38.36308,-5.99181 ), ('lineTo' ,32.82428,-5.99181 ), ('lineTo' ,32.82428,13.43804 ), ('lineTo' ,38.36308,13.43804 ), ('lineTo' ,38.23873,11.53608 ), ('curveTo' ,38.46886,11.93387 ,38.70371,12.27159 ,38.94327,12.54922 ), ('curveTo' ,39.18254,12.82685 ,39.44037,13.05268 ,39.71676,13.22671 ), ('curveTo' ,39.99286,13.40074 ,40.28988,13.52712 ,40.60753,13.60585 ), ('curveTo' ,40.92518,13.68459 ,41.27759,13.72396 ,41.66419,13.72396 ), ('curveTo' ,43.10068,13.72396 ,44.2702,13.07755 ,45.17246,11.78472 ), ('curveTo' ,46.06588,10.50844 ,46.51229,8.81368 ,46.51229,6.70038 ), ('curveTo' ,46.51229,4.55394 ,46.08415,2.85502 ,45.22785,1.60362 ), ('curveTo' ,44.38983,0.35221 ,43.23416,-0.27348 ,41.76084,-0.27348 ), ('curveTo' ,40.41659,-0.27348 ,39.24235,0.42679 ,38.23873,1.82739 ), ('curveTo' ,38.2847,1.40472 ,38.31239,1.04007 ,38.32153,0.73345 ), ('curveTo' ,38.34923,0.41851 ,38.36308,0.04146 ,38.36308,-0.3978 ), 'closePath', ('moveTo' ,40.7802,6.84954 ), ('curveTo' ,40.7802,7.72802 ,40.66734,8.40964 ,40.44193,8.89448 ), ('curveTo' ,40.21621,9.37929 ,39.89621,9.62168 ,39.48191,9.62168 ), ('curveTo' ,38.62533,9.62168 ,38.19718,8.68108 ,38.19718,6.79983 ), ('curveTo' ,38.19718,4.87712 ,38.61177,3.91581 ,39.44037,3.91581 ), ('curveTo' ,39.85466,3.91581 ,40.18174,4.1727 ,40.42101,4.68654 ), ('curveTo' ,40.66057,5.20037 ,40.7802,5.92135 ,40.7802,6.84954 ), 'closePath', ('moveTo' ,62.10648,6.51392 ), ('curveTo' ,62.10648,4.44205 ,61.47118,2.79288 ,60.2003,1.56631 ), ('curveTo' ,58.92971,0.33978 ,57.22626,-0.27348 ,55.08965,-0.27348 ), ('curveTo' ,52.99018,-0.27348 ,51.31914,0.35221 ,50.07595,1.60362 ), ('curveTo' ,48.8419,2.8633 ,48.22517,4.55394 ,48.22517,6.67551 ), ('curveTo' ,48.22517,8.79709 ,48.85575,10.50016 ,50.1175,11.78472 ), ('curveTo' ,51.36982,13.07755 ,53.03172,13.72396 ,55.1035,13.72396 ), ('curveTo' ,57.28608,13.72396 ,58.99866,13.08168 ,60.24185,11.79712 ), ('curveTo' ,61.48503,10.51259 ,62.10648,8.75154 ,62.10648,6.51392 ), 'closePath', ('moveTo' ,56.73358,6.67551 ), ('curveTo' ,56.73358,7.17276 ,56.69675,7.62236 ,56.62308,8.02428 ), ('curveTo' ,56.54942,8.42623 ,56.44334,8.77016 ,56.30544,9.05607 ), ('curveTo' ,56.16724,9.34198 ,56.00134,9.56369 ,55.80804,9.72113 ), ('curveTo' ,55.61474,9.8786 ,55.39817,9.95733 ,55.1589,9.95733 ), ('curveTo' ,54.68921,9.95733 ,54.31174,9.65898 ,54.02621,9.06229 ), ('curveTo' ,53.74068,8.54018 ,53.59807,7.75702 ,53.59807,6.71282 ), ('curveTo' ,53.59807,5.68515 ,53.74068,4.90202 ,54.02621,4.36332 ), ('curveTo' ,54.31174,3.76663 ,54.69392,3.46828 ,55.17275,3.46828 ), ('curveTo' ,55.62388,3.46828 ,55.99692,3.7625 ,56.29159,4.35088 ), ('curveTo' ,56.58625,5.0056 ,56.73358,5.78047 ,56.73358,6.67551 ), 'closePath', ('moveTo' ,69.78629,0 ), ('lineTo' ,64.2475,0 ), ('lineTo' ,64.2475,13.43804 ), ('lineTo' ,69.78629,13.43804 ), ('lineTo' ,69.49605,10.81507 ), ('curveTo' ,70.33407,12.77921 ,71.71988,13.76126 ,73.65346,13.76126 ), ('lineTo' ,73.65346,8.16725 ), ('curveTo' ,73.04586,8.4656 ,72.5302,8.61478 ,72.10647,8.61478 ), ('curveTo' ,71.36068,8.61478 ,70.78756,8.37236 ,70.38711,7.88755 ), ('curveTo' ,69.98637,7.40274 ,69.78629,6.69623 ,69.78629,5.76804 ), 'closePath', ('moveTo' ,81.55427,0 ), ('lineTo' ,76.00163,0 ), ('lineTo' ,76.00163,9.42278 ), ('lineTo' ,74.42725,9.42278 ), ('lineTo' ,74.42725,13.43804 ), ('lineTo' ,76.00163,13.43804 ), ('lineTo' ,76.00163,17.39113 ), ('lineTo' ,81.55427,17.39113 ), ('lineTo' ,81.55427,13.43804 ), ('lineTo' ,83.39121,13.43804 ), ('lineTo' ,83.39121,9.42278 ), ('lineTo' ,81.55427,9.42278 ), 'closePath', ('moveTo' ,95.17333,0 ), ('lineTo' ,85.09024,0 ), ('lineTo' ,85.09024,19.19365 ), ('lineTo' ,90.85002,19.19365 ), ('lineTo' ,90.85002,4.61196 ), ('lineTo' ,95.17333,4.61196 ), 'closePath', ('moveTo' ,110.00787,0 ), ('lineTo' ,104.45523,0 ), ('curveTo' ,104.5012,0.44754 ,104.53803,0.87433 ,104.56573,1.2804 ), ('curveTo' ,104.59313,1.68651 ,104.62083,2.01385 ,104.64853,2.26246 ), ('curveTo' ,103.69087,0.57182 ,102.40644,-0.27348 ,100.79492,-0.27348 ), ('curveTo' ,99.39527,-0.27348 ,98.28557,0.35637 ,97.46611,1.61605 ), ('curveTo' ,96.65578,2.86746 ,96.25062,4.59952 ,96.25062,6.81227 ), ('curveTo' ,96.25062,8.95041 ,96.66963,10.63276 ,97.50765,11.8593 ), ('curveTo' ,98.34538,13.10242 ,99.4872,13.72396 ,100.93312,13.72396 ), ('curveTo' ,102.41557,13.72396 ,103.61249,12.92008 ,104.52418,11.31231 ), ('curveTo' ,104.50591,11.47806 ,104.49206,11.62309 ,104.48293,11.74741 ), ('curveTo' ,104.4735,11.87173 ,104.46437,11.9753 ,104.45523,12.05819 ), ('lineTo' ,104.39983,12.84135 ), ('lineTo' ,104.35858,13.43804 ), ('lineTo' ,110.00787,13.43804 ), 'closePath', ('moveTo' ,104.39983,6.88685 ), ('curveTo' ,104.39983,7.38409 ,104.37921,7.80676 ,104.33766,8.15481 ), ('curveTo' ,104.29641,8.5029 ,104.22952,8.78672 ,104.13758,9.00636 ), ('curveTo' ,104.04535,9.22598 ,103.92572,9.38341 ,103.77839,9.47874 ), ('curveTo' ,103.63106,9.57403 ,103.45161,9.62168 ,103.23974,9.62168 ), ('curveTo' ,102.30036,9.62168 ,101.83096,8.49875 ,101.83096,6.25285 ), ('curveTo' ,101.83096,4.64508 ,102.24967,3.8412 ,103.0877,3.8412 ), ('curveTo' ,103.96255,3.8412 ,104.39983,4.85641 ,104.39983,6.88685 ), 'closePath', ('moveTo' ,118.22604,0 ), ('lineTo' ,112.5629,0 ), ('lineTo' ,112.5629,20.99616 ), ('lineTo' ,118.10169,20.99616 ), ('lineTo' ,118.10169,13.63694 ), ('curveTo' ,118.10169,13.01538 ,118.07399,12.30268 ,118.01889,11.49877 ), ('curveTo' ,118.52542,12.31096 ,119.03636,12.88693 ,119.55202,13.22671 ), ('curveTo' ,120.08625,13.55821 ,120.75838,13.72396 ,121.5687,13.72396 ), ('curveTo' ,123.07885,13.72396 ,124.24837,13.09827 ,125.07697,11.84686 ), ('curveTo' ,125.90586,10.60373 ,126.32015,8.85099 ,126.32015,6.5885 ), ('curveTo' ,126.32015,4.42546 ,125.89201,2.74314 ,125.03571,1.54147 ), ('curveTo' ,124.18826,0.3315 ,123.01432,-0.27348 ,121.51331,-0.27348 ), ('curveTo' ,120.78608,-0.27348 ,120.16905,-0.12432 ,119.66252,0.17403 ), ('curveTo' ,119.41383,0.3315 ,119.15835,0.54283 ,118.8961,0.80803 ), ('curveTo' ,118.63356,1.07322 ,118.36866,1.40472 ,118.10169,1.80252 ), ('curveTo' ,118.11112,1.64505 ,118.12025,1.51039 ,118.12939,1.3985 ), ('curveTo' ,118.13852,1.28662 ,118.14766,1.19339 ,118.15709,1.11881 ), 'closePath', ('moveTo' ,120.58806,6.70038 ), ('curveTo' ,120.58806,8.62306 ,120.11837,9.5844 ,119.17898,9.5844 ), ('curveTo' ,118.35039,9.5844 ,117.93609,8.67693 ,117.93609,6.86198 ), ('curveTo' ,117.93609,4.96417 ,118.36424,4.01526 ,119.22053,4.01526 ), ('curveTo' ,120.13222,4.01526 ,120.58806,4.91027 ,120.58806,6.70038 ), 'closePath', ('moveTo',38.30626,-7.28346),('lineTo',38.30626,-25.55261),('lineTo',85.15777,-25.55261),('lineTo',85.15777,-1.39019),('lineTo',90.46172,-1.39019),('lineTo',90.46172,-31.15121),('lineTo',32.70766,-31.15121),('lineTo',32.70766,-7.28346), 'closePath', ('moveTo' ,32.70766,14.52164 ), ('lineTo' ,32.70766,47.81862 ), ('lineTo' ,80.14849,47.81862 ), ('lineTo' ,90.46172,37.21073 ), ('lineTo' ,90.46172,20.12025 ), ('lineTo' ,85.15777,20.12025 ), ('lineTo' ,85.15777,30.72814 ), ('lineTo' ,73.66589,30.72814 ), ('lineTo' ,73.66589,42.22002 ), ('lineTo' ,38.30626,42.22002 ), ('lineTo' ,38.30626,14.52164 ), 'closePath', ('moveTo' ,79.2645,36.32674 ), ('lineTo' ,85.15777,36.32674 ), ('lineTo' ,79.2645,42.22002 ), 'closePath', ], strokeColor=strokeColor,strokeWidth=strokeWidth,fillColor=fillColor, dx=dx, dy=dy))
| 4,996
|
def draw(self): fillColor = self.fillColor strokeColor = self.strokeColor g = Group() bg = self.background shadow = self.shadow if bg: shadow = Color(bg.red*shadow,bg.green*shadow,bg.blue*shadow) self._paintLogo(g,dy=-2.5, dx=2,fillColor=shadow) self._paintLogo(g,fillColor=fillColor) g.skew(kx=10, ky=0) g.shift(0,35.5) G = Group() G.add(g) _w, _h = 129, 86 w, h = self.width, self.height if w!=_w or h!=_h: G.scale(w/float(_w),h/float(_h)) if bg is not None: G.insert(0,Rect(0,0,w,h,fillColor=bg,strokeColor=None))
|
def draw(self): fillColor = self.fillColor strokeColor = self.strokeColor g = Group() bg = self.background shadow = self.shadow if bg: shadow = Color(bg.red*shadow,bg.green*shadow,bg.blue*shadow) self._paintLogo(g,dy=-2.5, dx=2,fillColor=shadow) self._paintLogo(g,fillColor=fillColor,strokeColor=strokeColor) g.skew(kx=self.skewX, ky=self.skewY) g.shift(self._dx,self._dy) G = Group() G.add(g) _w, _h = 129, 86 w, h = self.width, self.height if w!=_w or h!=_h: G.scale(w/float(_w),h/float(_h)) if bg is not None: G.insert(0,Rect(0,0,w,h,fillColor=bg,strokeColor=None))
| 4,997
|
def draw(self): fillColor = self.fillColor strokeColor = self.strokeColor g = Group() bg = self.background shadow = self.shadow if bg: shadow = Color(bg.red*shadow,bg.green*shadow,bg.blue*shadow) self._paintLogo(g,dy=-2.5, dx=2,fillColor=shadow) self._paintLogo(g,fillColor=fillColor) g.skew(kx=10, ky=0) g.shift(0,35.5) G = Group() G.add(g) _w, _h = 129, 86 w, h = self.width, self.height if w!=_w or h!=_h: G.scale(w/float(_w),h/float(_h)) if bg is not None: G.insert(0,Rect(0,0,w,h,fillColor=bg,strokeColor=None))
|
def draw(self): fillColor = self.fillColor strokeColor = self.strokeColor g = Group() bg = self.background shadow = self.shadow if bg: shadow = Color(bg.red*shadow,bg.green*shadow,bg.blue*shadow) self._paintLogo(g,dy=-2.5, dx=2,fillColor=shadow) self._paintLogo(g,fillColor=fillColor) g.skew(kx=10, ky=0) g.shift(0,35.5) G = Group() G.add(g) _w, _h = 129, 86 w, h = self.width, self.height if w!=_w or h!=_h: G.scale(w/float(_w),h/float(_h)) if bg is not None: G.insert(0,Rect(0,0,w,h,fillColor=bg,strokeColor=None))
| 4,998
|
def _drawCell(self, cellval, cellstyle, (colpos, rowpos), (colwidth, rowheight)): #print "cellstyle is ", repr(cellstyle), id(cellstyle) if self._curcellstyle is not cellstyle: cur = self._curcellstyle if cur is None or cellstyle.color != cur.color: #print "setting cell color to %s" % `cellstyle.color` self.canv.setFillColor(cellstyle.color) if cur is None or cellstyle.leading != cur.leading or cellstyle.fontname != cur.fontname or cellstyle.fontsize != cur.fontsize: #print "setting font: %s, %s, %s" % (cellstyle.fontname, cellstyle.fontsize, cellstyle.leading) self.canv.setFont(cellstyle.fontname, cellstyle.fontsize, cellstyle.leading) self._curcellstyle = cellstyle #print "leading is ", cellstyle.leading, "size is", cellstyle.fontsize just = cellstyle.alignment #print "alignment is ", just if just == 'LEFT': draw = self.canv.drawString x = colpos + cellstyle.leftPadding elif just in ('CENTRE', 'CENTER'): draw = self.canv.drawCentredString x = colpos + colwidth * 0.5 elif just == 'RIGHT': draw = self.canv.drawRightString x = colpos + colwidth - cellstyle.rightPadding else: raise ValueError, 'Invalid justification %s' % just
|
def _drawCell(self, cellval, cellstyle, (colpos, rowpos), (colwidth, rowheight)): #print "cellstyle is ", repr(cellstyle), id(cellstyle) if self._curcellstyle is not cellstyle: cur = self._curcellstyle if cur is None or cellstyle.color != cur.color: #print "setting cell color to %s" % `cellstyle.color` self.canv.setFillColor(cellstyle.color) if cur is None or cellstyle.leading != cur.leading or cellstyle.fontname != cur.fontname or cellstyle.fontsize != cur.fontsize: #print "setting font: %s, %s, %s" % (cellstyle.fontname, cellstyle.fontsize, cellstyle.leading) self.canv.setFont(cellstyle.fontname, cellstyle.fontsize, cellstyle.leading) self._curcellstyle = cellstyle #print "leading is ", cellstyle.leading, "size is", cellstyle.fontsize just = cellstyle.alignment #print "alignment is ", just if just == 'LEFT': draw = self.canv.drawString x = colpos + cellstyle.leftPadding elif just in ('CENTRE', 'CENTER'): draw = self.canv.drawCentredString x = colpos + colwidth * 0.5 elif just == 'RIGHT': draw = self.canv.drawRightString x = colpos + colwidth - cellstyle.rightPadding else: raise ValueError, 'Invalid justification %s' % just
| 4,999
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.