rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
os.system("python genAll.py -s")
os.system("%s genAll.py -s" % sys.executable)
def test0(self): "Test if all manuals buildable from source."
r = os.path.splitext(self.pfbFileName)[0] + ext if os.path.isfile(r): return r
r_basename = os.path.splitext(self.pfbFileName)[0] for e in possible_exts: if os.path.isfile(r_basename + e): return r_basename + e
def findT1File(self,ext='.pfb'): if hasattr(self,'pfbFileName'): r = os.path.splitext(self.pfbFileName)[0] + ext if os.path.isfile(r): return r try: r = _fontdata.findT1File(self.name) except: afm = bruteForceSearchForAFM(self.name) if afm: if ext == '.pfb': pfb = os.path.splitext(afm)[0] + 'pfb' if os.path.isfile(pfb)...
pfb = os.path.splitext(afm)[0] + 'pfb' if os.path.isfile(pfb): r = pfb else: r = None
for e in possible_exts: pfb = os.path.splitext(afm)[0] + e if os.path.isfile(pfb): r = pfb else: r = None
def findT1File(self,ext='.pfb'): if hasattr(self,'pfbFileName'): r = os.path.splitext(self.pfbFileName)[0] + ext if os.path.isfile(r): return r try: r = _fontdata.findT1File(self.name) except: afm = bruteForceSearchForAFM(self.name) if afm: if ext == '.pfb': pfb = os.path.splitext(afm)[0] + 'pfb' if os.path.isfile(pfb)...
pfb = os.path.splitext(afm)[0] + '.pfb'
for e in ('.pfb', '.PFB'): pfb = os.path.splitext(afm)[0] + e if os.path.isfile(pfb): break
def getTypeFace(faceName): """Lazily construct known typefaces if not found""" try: return _typefaces[faceName] except KeyError: # not found, construct it if known if faceName in standardFonts: face = TypeFace(faceName) registerTypeFace(face) #print 'auto-constructing type face %s' % face.name return face else: #try a ...
imagedata.append('BI') imagedata.append('/Width %0.2f /Height %0.2f' %(info[0], info[1])) imagedata.append('/BitsPerComponent 8') imagedata.append('/ColorSpace /%s' % colorSpace) imagedata.append('/Filter [ /ASCII85Decode /DCTDecode]') imagedata.append('ID')
imagedata.append('BI /W %d /H %d /BPC 8 /CS /%s /F [/A85 /DCT] ID' % (info[0], info[1], colorSpace))
def drawInlineImage(self, 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""" self._currentPageHasImages = 1
imagedata.append('BI')
def drawInlineImage(self, 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""" self._currentPageHasImages = 1
imagedata.append('/W %0.2f /H %0.2f /BPC 8 /CS /RGB /F [/A85 /Fl]' % (imgwidth, imgheight)) imagedata.append('ID')
imagedata.append('BI /W %d /H %d /BPC 8 /CS /RGB /F [/A85 /Fl] ID' % (imgwidth, imgheight))
def drawInlineImage(self, 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""" self._currentPageHasImages = 1
L.strokeColor = self.strokeColor L.strokeWidth = self.strokeWidth L.strokeDashArray = self.strokeDashArray
L.strokeColor = strokeColor L.strokeWidth = strokeWidth L.strokeDashArray = strokeDashArray
def _makeLines(self,g,start,end,strokeColor,strokeWidth,strokeDashArray): for i in range(self._catCount + 1): y = self._y + i*self._barWidth L = Line(self._x+start, y, self._x+end, y) L.strokeColor = self.strokeColor L.strokeWidth = self.strokeWidth L.strokeDashArray = self.strokeDashArray g.add(L)
self._parent._parent._in -= 1
self._parent._parent._in = self._parent._parent._in - 1
def __call__(self, *args, **kwargs) : """The fake method is called, print it then call the real one.""" if not self._parent._parent._in : self._precomment() self._parent._parent._PyWrite(" %s.%s(%s)" % (self._parent._name, self._action, apply(buildargs, args, kwargs))) self._postcomment() self._parent._parent._in = ...
self._parent._contextlevel -= 1
self._parent._contextlevel = self._parent._contextlevel - 1
def _precomment(self) : """Outputs comments before the method call.""" if self._action == "showPage" : self._parent._PyWrite("\n # Ends page %i" % self._parent._pagenumber) elif self._action == "saveState" : state = {} d = self._parent._object.__dict__ for name in self._parent._object.STATE_ATTRIBUTES: state[name] =...
elif self._action == "endForm" :
elif self._action in [ "endForm", "drawPath", "clipPath" ] :
def _postcomment(self) : """Outputs comments after the method call.""" if self._action == "showPage" : self._parent._pagenumber = self._parent._pagenumber + 1 self._parent._PyWrite("\n # Begins page %i" % self._parent._pagenumber) elif self._action == "endForm" : self._parent._PyWrite("")
for op, (sc, sr), (ec, er), weight, color in cmds:
for c in cmds: c = tuple(c) (sc,sr), (ec,er) = c[1:3]
def _cr_0(self,n,cmds): for op, (sc, sr), (ec, er), weight, color in cmds: if sr>=n: continue if er>=n: er = n-1 self._addCommand((op, (sc, sr), (ec, er), weight, color))
self._addCommand((op, (sc, sr), (ec, er), weight, color))
self._addCommand((c[0],)+((sc, sr), (ec, er))+c[3:])
def _cr_0(self,n,cmds): for op, (sc, sr), (ec, er), weight, color in cmds: if sr>=n: continue if er>=n: er = n-1 self._addCommand((op, (sc, sr), (ec, er), weight, color))
for op, (sc, sr), (ec, er), weight, color in cmds:
for c in cmds: c = tuple(c) (sc,sr), (ec,er) = c[1:3]
def _cr_1_1(self,n,repeatRows, cmds): for op, (sc, sr), (ec, er), weight, color in cmds: if sr>=0 and sr>=repeatRows and sr<n and er>=0 and er<n: continue if sr>=repeatRows and sr<n: sr=repeatRows elif sr>=repeatRows and sr>=n: sr=sr+repeatRows-n if er>=repeatRows and er<n: er=repeatRows elif er>=repeatRows and er>=n: ...
self._addCommand((op, (sc, sr), (ec, er), weight, color))
self._addCommand((c[0],)+((sc, sr), (ec, er))+c[3:])
def _cr_1_1(self,n,repeatRows, cmds): for op, (sc, sr), (ec, er), weight, color in cmds: if sr>=0 and sr>=repeatRows and sr<n and er>=0 and er<n: continue if sr>=repeatRows and sr<n: sr=repeatRows elif sr>=repeatRows and sr>=n: sr=sr+repeatRows-n if er>=repeatRows and er<n: er=repeatRows elif er>=repeatRows and er>=n: ...
for op, (sc, sr), (ec, er), weight, color in cmds:
for c in cmds: c = tuple(c) (sc,sr), (ec,er) = c[1:3]
def _cr_1_0(self,n,cmds): for op, (sc, sr), (ec, er), weight, color in cmds: if er>=0 and er<n: continue if sr>=0 and sr<n: sr=0 if sr>=n: sr = sr-n if er>=n: er = er-n self._addCommand((op, (sc, sr), (ec, er), weight, color))
self._addCommand((op, (sc, sr), (ec, er), weight, color))
self._addCommand((c[0],)+((sc, sr), (ec, er))+c[3:])
def _cr_1_0(self,n,cmds): for op, (sc, sr), (ec, er), weight, color in cmds: if er>=0 and er<n: continue if sr>=0 and sr<n: sr=0 if sr>=n: sr = sr-n if er>=n: er = er-n self._addCommand((op, (sc, sr), (ec, er), weight, color))
elif type(array) == ListType or type(Array) == TupleType:
elif type(array) == ListType or type(array) == TupleType:
def setDash(self, array=[], phase=0): """Two notations. pass two numbers, or an array and phase""" if type(array) == IntType or type(array) == FloatType: self._code.append('[%s %s] 0 d' % (array, phase)) elif type(array) == ListType or type(Array) == TupleType: assert phase <= len(array), "setDash phase must be l.t.e....
def __init__(self,fn='rl_dbgmemo.dbg',mode='w',getScript=1,modules=(),capture_traceback=1, **kw):
def __init__(self,fn='rl_dbgmemo.dbg',mode='w',getScript=1,modules=(),capture_traceback=1, stdout=None, **kw):
def __init__(self,fn='rl_dbgmemo.dbg',mode='w',getScript=1,modules=(),capture_traceback=1, **kw): import time, socket self.fn = fn if mode!='w': return self.store = store = {} if capture_traceback and sys.exc_info() != (None,None,None): import traceback s = getStringIO() traceback.print_exc(None,s) store['__traceback']...
if hasattr(os,'uname'): store.update({ 'uname': os.uname(), 'ctermid': os.ctermid(), 'getgid': os.getgid(), 'getuid': os.getuid(), 'getegid': os.getegid(), 'geteuid': os.geteuid(), 'getlogin': os.getlogin(), 'getgroups': os.getgroups(), 'getpgrp': os.getpgrp(), 'getpid': os.getpid(), 'getppid': os.getppid(), })
def __init__(self,fn='rl_dbgmemo.dbg',mode='w',getScript=1,modules=(),capture_traceback=1, **kw): import time, socket self.fn = fn if mode!='w': return self.store = store = {} if capture_traceback and sys.exc_info() != (None,None,None): import traceback s = getStringIO() traceback.print_exc(None,s) store['__traceback']...
store['__script'] = open(fn,'r').read()
try: store['__script'] = (fn,open(fn,'r').read()) except: pass
def __init__(self,fn='rl_dbgmemo.dbg',mode='w',getScript=1,modules=(),capture_traceback=1, **kw): import time, socket self.fn = fn if mode!='w': return self.store = store = {} if capture_traceback and sys.exc_info() != (None,None,None): import traceback s = getStringIO() traceback.print_exc(None,s) store['__traceback']...
print k[2:]
self._writeln(k[2:])
def _show_module_versions(self,k,v): print k[2:] K = v.keys() K.sort() for k in K: vk = v[k] try: m = recursiveImport(k,sys.path[:],1) d = getattr(m,'__version__',None)==vk and 'SAME' or 'DIFFERENT' except: m = None d = '??????unknown??????' print ' %s = %s (%s)' % (k,vk,d)
print ' %s = %s (%s)' % (k,vk,d)
self._writeln(' %s = %s (%s)' % (k,vk,d))
def _show_module_versions(self,k,v): print k[2:] K = v.keys() K.sort() for k in K: vk = v[k] try: m = recursiveImport(k,sys.path[:],1) d = getattr(m,'__version__',None)==vk and 'SAME' or 'DIFFERENT' except: m = None d = '??????unknown??????' print ' %s = %s (%s)' % (k,vk,d)
print '
self._writeln('
def _banner(self,k,what): print '###################%s %s##################' % (what,k[2:])
print v
self._writeln(v)
def _show_lines(self,k,v): self._start(k) print v self._finish(k)
pprint.pprint(v)
pprint.pprint(v,self.stdout)
def _show_payload(self,k,v): if v: import pprint self._start(k) pprint.pprint(v) self._finish(k)
'__script': _show_lines,
'__script': _show_file,
def _show_payload(self,k,v): if v: import pprint self._start(k) pprint.pprint(v) self._finish(k)
if k not in self.specials.keys(): print '%-15s = %s' % (k,self.store[k])
if k not in self.specials.keys(): self._writeln('%-15s = %s' % (k,self.store[k]))
def show(self): K = self.store.keys() K.sort() for k in K: if k not in self.specials.keys(): print '%-15s = %s' % (k,self.store[k]) for k in K: if k in self.specials.keys(): apply(self.specials[k],(self,k,self.store[k]))
fnroot = os.path.join(getattr(self,'outDir','.'), fnRoot or (getattr(self,'fileNamePattern',(self.__class__.__name__+'%03d')) % getattr(self,'chartId',0)))
outDir = getattr(self,'outDir','.') if not os.path.isabs(outDir): outDir = os.path.join(os.path.dirname(sys.argv[0]),outDir) if not os.path.isdir(outDir): os.makedirs(outDir) fnroot = os.path.normpath(os.path.join(outDir, fnRoot or (getattr(self,'fileNamePattern',(self.__class__.__name__+'%03d')) % getattr(self,'chartI...
def save(self, formats=None, verbose=None, fnRoot=None): "Saves copies of self in desired location and formats" ext = '' fnroot = os.path.join(getattr(self,'outDir','.'), fnRoot or (getattr(self,'fileNamePattern',(self.__class__.__name__+'%03d')) % getattr(self,'chartId',0)))
if verbose: print "generating PDF file %s" % repr(filename)
if verbose: print "generating PDF file %s" % filename
def save(self, formats=None, verbose=None, fnRoot=None): "Saves copies of self in desired location and formats" ext = '' fnroot = os.path.join(getattr(self,'outDir','.'), fnRoot or (getattr(self,'fileNamePattern',(self.__class__.__name__+'%03d')) % getattr(self,'chartId',0)))
if verbose: print "generating GIF file %s" % repr(filename)
if verbose: print "generating GIF file %s" % filename
def save(self, formats=None, verbose=None, fnRoot=None): "Saves copies of self in desired location and formats" ext = '' fnroot = os.path.join(getattr(self,'outDir','.'), fnRoot or (getattr(self,'fileNamePattern',(self.__class__.__name__+'%03d')) % getattr(self,'chartId',0)))
if verbose: print "generating PNG file %s" % repr(filename)
if verbose: print "generating PNG file %s" % filename
def save(self, formats=None, verbose=None, fnRoot=None): "Saves copies of self in desired location and formats" ext = '' fnroot = os.path.join(getattr(self,'outDir','.'), fnRoot or (getattr(self,'fileNamePattern',(self.__class__.__name__+'%03d')) % getattr(self,'chartId',0)))
if verbose: print "generating TIFF file %s" % repr(filename)
if verbose: print "generating TIFF file %s" % filename
def save(self, formats=None, verbose=None, fnRoot=None): "Saves copies of self in desired location and formats" ext = '' fnroot = os.path.join(getattr(self,'outDir','.'), fnRoot or (getattr(self,'fileNamePattern',(self.__class__.__name__+'%03d')) % getattr(self,'chartId',0)))
if verbose: print "generating JPG file %s" % repr(filename)
if verbose: print "generating JPG file %s" % filename
def save(self, formats=None, verbose=None, fnRoot=None): "Saves copies of self in desired location and formats" ext = '' fnroot = os.path.join(getattr(self,'outDir','.'), fnRoot or (getattr(self,'fileNamePattern',(self.__class__.__name__+'%03d')) % getattr(self,'chartId',0)))
if verbose: print "generating EPS file %s" % repr(filename)
if verbose: print "generating EPS file %s" % filename
def save(self, formats=None, verbose=None, fnRoot=None): "Saves copies of self in desired location and formats" ext = '' fnroot = os.path.join(getattr(self,'outDir','.'), fnRoot or (getattr(self,'fileNamePattern',(self.__class__.__name__+'%03d')) % getattr(self,'chartId',0)))
arguments += "%s, " % repr(arg)
arguments = arguments + ("%s, " % repr(arg))
def buildargs(*args, **kwargs) : """Constructs a printable list of arguments suitable for use in source function calls.""" arguments = "" for arg in args : arguments += "%s, " % repr(arg) for (kw, val) in kwargs.items() : arguments += "%s=%s, " % (kw, repr(val)) if arguments[-2:] == ", " : arguments = arguments[:-2] re...
arguments += "%s=%s, " % (kw, repr(val))
arguments = arguments+ ("%s=%s, " % (kw, repr(val)))
def buildargs(*args, **kwargs) : """Constructs a printable list of arguments suitable for use in source function calls.""" arguments = "" for arg in args : arguments += "%s, " % repr(arg) for (kw, val) in kwargs.items() : arguments += "%s=%s, " % (kw, repr(val)) if arguments[-2:] == ", " : arguments = arguments[:-2] re...
self._parent._parent._in += 1
self._parent._parent._in = self._parent._parent._in + 1
def __call__(self, *args, **kwargs) : """The fake method is called, print it then call the real one.""" if not self._parent._parent._in : self._precomment() self._parent._parent._PyWrite(" %s.%s(%s)" % (self._parent._name, self._action, apply(buildargs, args, kwargs))) self._postcomment() self._parent._parent._in +=...
self.__class__._number += 1
self.__class__._number = self.__class__._number + 1
def __call__(self, *args, **kwargs) : """Real object initialisation is made here, because now we've got the arguments.""" if not self._initdone : self.__class__._number += 1 methodname = apply(self._postinit, args, kwargs) self._parent._PyWrite("\n # create PDF%sObject number %i\n %s = %s.%s(%s)" % (methodname[5:...
self._parent._contextlevel += 1
self._parent._contextlevel = self._parent._contextlevel + 1
def _precomment(self) : """Outputs comments before the method call.""" if self._action == "showPage" : self._parent._PyWrite("\n # Ends page %i" % self._parent._pagenumber) elif self._action == "saveState" : state = {} d = self._parent._object.__dict__ for name in self._parent._object.STATE_ATTRIBUTES: state[name] =...
self._parent._formnumber += 1
self._parent._formnumber = self._parent._formnumber + 1
def _precomment(self) : """Outputs comments before the method call.""" if self._action == "showPage" : self._parent._PyWrite("\n # Ends page %i" % self._parent._pagenumber) elif self._action == "saveState" : state = {} d = self._parent._object.__dict__ for name in self._parent._object.STATE_ATTRIBUTES: state[name] =...
self._parent._pagenumber += 1
self._parent._pagenumber = self._parent._pagenumber + 1
def _postcomment(self) : """Outputs comments after the method call.""" if self._action == "showPage" : self._parent._pagenumber += 1 self._parent._PyWrite("\n # Begins page %i" % self._parent._pagenumber) elif self._action == "endForm" : self._parent._PyWrite("")
P=pyRXP.Parser(**kw)
P=_pyRXP.Parser(**kw)
def goodTest(x,t,tb=0,**kw): try: P=pyRXP.Parser(**kw) r = P(x) rb = 0 except: et, ev, None = sys.exc_info() r = '%s %s' % (et.__name__, str(ev)) rb = 1 s = '' for k,v in kw.items(): s = s+', %s=%s' % (k,str(v)) if type(t) is type(''): t = t.replace('\r','\\r') t = t.replace('\n','\\n') if type(r) is type(''): r = r.r...
print 'Parser(%s)(%s)-->'%(s[2:],repr(x)),r,
print '%s.Parser(%s)(%s)-->'%(_pyRXP.__name__,s[2:],repr(x)),r,
def goodTest(x,t,tb=0,**kw): try: P=pyRXP.Parser(**kw) r = P(x) rb = 0 except: et, ev, None = sys.exc_info() r = '%s %s' % (et.__name__, str(ev)) rb = 1 s = '' for k,v in kw.items(): s = s+', %s=%s' % (k,str(v)) if type(t) is type(''): t = t.replace('\r','\\r') t = t.replace('\n','\\n') if type(r) is type(''): r = r.r...
if '__doc__' in sys.argv: print pyRXP.__doc__ else: try: for k,v in pyRXP.parser_flags.items(): eval('pyRXP.Parser(%s=%d)' % (k,v)) print 'Parser keywords OK' except: traceback.print_exc() print 'Parser keywords BAD' try: for k,v in pyRXP.parser_flags.items(): eval('pyRXP.Parser()("<a/>",%s=%d)' % (k,v)) print 'Parser(...
run()
def failTest(x,t,tb=1,**kw): goodTest(x,t,tb,**kw)
os.environ['CVSROOT']=':pserver:%s@cvs1:/cvsroot/reportlab' % USER
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) os.environ['CVSROOT']=':pserver:%s@cvs1:/cvsroot/reportlab' % USER if release: do_exec(cvs+' tag %s' % release, 'the tag phase') do_exec(cvs+' co reportlab', 'the down...
if hasattr(v, 'minWidth'): return v.minWidth()
if hasattr(v, 'minWidth'): try: return v.minWidth() except AttributeError: pass
def _elementWidth(self,v,s): t = type(v) if t in _SeqTypes: w = 0 for e in v: ew = self._elementWidth(e,s) if ew is None: return None w = max(w,ew) return w elif isinstance(v,Flowable) and v._fixedWidth: if hasattr(v, 'width'): return v.width if hasattr(v, 'drawWidth'): return v.drawWidth # Even if something is fixedWi...
os.chdir('docs/graphguide') do_exec(python + ' gengraphguide.py') os.chdir(d) do_exec('cp docs/graphguide/*.pdf %s' % htmldir) do_exec('mv docs/graphguide/*.pdf %s' % dst)
def cvs_checkout(d): os.chdir(d) cvsdir = os.path.join(d,projdir) recursive_rmdir(cvsdir) recursive_rmdir('docs') cvs = find_exe('cvs') python = find_exe('python') if cvs is None: os.exit(1) os.environ['CVSROOT']=':pserver:%s@cvs.reportlab.sourceforge.net:/cvsroot/reportlab' % USER if release: do_exec(cvs+(' export -...
del f.text
def _getFragWords(frags): ''' given a fragment list return a list of lists [[size, (f00,w00), ..., (f0n,w0n)],....,[size, (fm0,wm0), ..., (f0n,wmn)]] each pair f,w represents a style and some string each sublist represents a word ''' R = [] W = [] n = 0 for f in frags: text = f.text del f.text if text!='': S = string.s...
if spotName and density < 1:
if density<1:
def __init__(self, cyan=0, magenta=0, yellow=0, black=0, spotName=None, density=1): """ Initialize with four colors in range [0-1]. the optional spotName and density may be of use to specific renderers. The spotName is intended for use as an identifier to the rendere not client programs. """ self.cyan = cyan self.magen...
r = density*(r-1)*1.+1 g = density*(g-1)*1.+1 b = density*(b-1)*1.+1
r = density*(r-1)+1 g = density*(g-1)+1 b = density*(b-1)+1
def __init__(self, cyan=0, magenta=0, yellow=0, black=0, spotName=None, density=1): """ Initialize with four colors in range [0-1]. the optional spotName and density may be of use to specific renderers. The spotName is intended for use as an identifier to the rendere not client programs. """ self.cyan = cyan self.magen...
ascent=getFont(self.labelFontName).face.ascent if ascent==0: ascent=0.718
ascent=getFont(self.labelFontName).face.ascent/1000. if ascent==0: ascent=0.718
def draw(self): g = Group() ys = self.bottomPadding+(self.triangleHeight/2)+self.sourceLabelOffset+self.sourceLabelFontSize if self.background: x,y = self._getDrawingDimensions() g.add(Rect(-self.leftPadding,-ys,x,y, strokeColor=None, strokeWidth=0, fillColor=self.background))
g.add(sr.draw())
g.add(sr)
def draw(self): g = Group() ys = self.bottomPadding+(self.triangleHeight/2)+self.sourceLabelOffset+self.sourceLabelFontSize if self.background: x,y = self._getDrawingDimensions() g.add(Rect(-self.leftPadding,-ys,x,y, strokeColor=None, strokeWidth=0, fillColor=self.background))
g.add(String(x+(self.boxWidth/2),((self.boxHeight/2)-(ascent/2)),
g.add(String(x+self.boxWidth/2.,(self.boxHeight-ascent)/2.),
def draw(self): g = Group() ys = self.bottomPadding+(self.triangleHeight/2)+self.sourceLabelOffset+self.sourceLabelFontSize if self.background: x,y = self._getDrawingDimensions() g.add(Rect(-self.leftPadding,-ys,x,y, strokeColor=None, strokeWidth=0, fillColor=self.background))
path = filter(None,basDir)
path = filter(None,path)
def recursiveImport(modulename, baseDir=None, noCWD=0, debug=0): """Dynamically imports possible packagized module, or raises ImportError""" import imp parts = string.split(modulename, '.') name = parts[0] if baseDir is None: path = sys.path[:] else: if type(baseDir) not in SeqTypes: path = [baseDir] else: path = list...
1) To reord error data dbg = DebugMemo(fn='dbgmemo.dbg',myVar=value)
1) To record error data dbg = DebugMemo(fn='dbgmemo.dbg',myVar=value) dbg.add(anotherPayload='aaaa',andagain='bbb')
def _className(self): '''Return a shortened class name''' try: name = self.__class__.__name__ i=string.rfind(name,'.') if i>=0: return name[i+1:] return name except AttributeError: return str(self)
dbg = DebugMemo(fn='dbgmemo.dbg',mode='r') dbg.show()
dbg = DebugMemo(fn='dbgmemo.dbg',mode='r') dbg.load() dbg.show()
def _className(self): '''Return a shortened class name''' try: name = self.__class__.__name__ i=string.rfind(name,'.') if i>=0: return name[i+1:] return name except AttributeError: return str(self)
dbg = DebugMemo(fn='dbgmemo.dbg',mode='r') myTestFunc(dbg.payload('myVar'))
dbg = DebugMemo(fn='dbgmemo.dbg',mode='r') dbg.load() myTestFunc(dbg.payload('myVar'),dbg.payload('andagain')) in addition to the payload variables the dump records many useful bits of information which are also printed in the show() method.
def _className(self): '''Return a shortened class name''' try: name = self.__class__.__name__ i=string.rfind(name,'.') if i>=0: return name[i+1:] return name except AttributeError: return str(self)
if cLine!=[]: lines.append((space_available, cLine))
if cLine!=[]: lines.append((maxwidth - currentwidth, cLine))
def breakLines(self, width): """ Returns a broken line structure. There are two cases A) For the simple case of a single formatting input fragment the output is A fragment specifier with kind = 0 fontName, fontSize, leading, textColor lines= A list of lines Each line has two items. 1) unused width in points 2) word li...
return '\\"%s\\"' % string.join(map(lambda k,D=D: D.get(k,'?'),K),'.')
return (sys.platform == 'win32' and '\\"%s\\"' or '"%s"') % string.join(map(lambda k,D=D: D.get(k,'?'),K),'.')
def libart_version(): K = ('LIBART_MAJOR_VERSION','LIBART_MINOR_VERSION','LIBART_MICRO_VERSION') D = {} for l in open('libart_lgpl/configure.in','r').readlines(): l = string.split(string.strip(l),'=') if len(l)>1 and string.strip(l[0]) in K: D[string.strip(l[0])] = string.strip(l[1]) if len(D)==3: break return '\\"%s\\...
def describe(aColor):
def describe(aColor,mode=0):
def describe(aColor): # finds nearest match to one you provide. Useful when # trying to replicate a web page and you only have the # RGB values namedColors = getAllNamedColors() closest = (10, None, None) #big number, name, color for (name, color) in namedColors.items(): distance = colorDistance(aColor, color) if dis...
print 'best match is %s, distance %0.4f' % (closest[1], closest[0])
if mode<=1: s = 'best match is %s, distance %0.4f' % (closest[1], closest[0]) if mode==0: print s else: return s elif mode==2: return (closest[1], closest[0]) else: raise ValueError, "Illegal value for mode "+str(mode)
def describe(aColor): # finds nearest match to one you provide. Useful when # trying to replicate a web page and you only have the # RGB values namedColors = getAllNamedColors() closest = (10, None, None) #big number, name, color for (name, color) in namedColors.items(): distance = colorDistance(aColor, color) if dis...
box = shapes.Rect(self.x, self.y, s, s,
box = shapes.Rect(self.x+1, self.y+1, s-2, s-2,
def draw(self): # general widget bits s = self.size # abbreviate as we will use this a lot g = shapes.Group() # crossbox specific bits box = shapes.Rect(self.x, self.y, s, s, fillColor = None, strokeColor = self.boxColor, strokeWidth=2) g.add(box) crossLine1 = shapes.Line(self.x+(s*0.15), self.y+(s*0.15), self.x+(s*...
box = shapes.Rect(self.x, self.y, s, s,
box = shapes.Rect(self.x+1, self.y+1, s-2, s-2,
def draw(self): # general widget bits s = self.size # abbreviate as we will use this a lot g = shapes.Group() # tickbox specific bits box = shapes.Rect(self.x, self.y, s, s, fillColor = None, strokeColor = self.boxColor, strokeWidth=2) g.add(box)
diskBody = shapes.Rect(x=self.x, y=self.y, width=s, height=s,
diskBody = shapes.Rect(x=self.x, y=self.y+(s/100), width=s, height=s-(s/100),
def draw(self): # general widget bits s = self.size # abbreviate as we will use this a lot g = shapes.Group()
metalcover = shapes.Rect(x=self.x+(s*0.2), y=(self.y)-(s*0.01), width=s*0.5, height=s*0.35,
metalcover = shapes.Rect(x=self.x+(s*0.2), y=(self.y), width=s*0.5, height=s*0.35,
def draw(self): # general widget bits s = self.size # abbreviate as we will use this a lot g = shapes.Group()
coverslot = shapes.Rect(x=self.x+(s*0.28), y=(self.y)+(s*0.03), width=s*0.12, height=s*0.28,
coverslot = shapes.Rect(x=self.x+(s*0.28), y=(self.y)+(s*0.035), width=s*0.12, height=s*0.28,
def draw(self): # general widget bits s = self.size # abbreviate as we will use this a lot g = shapes.Group()
_theta_x = .5 _theta_y = .5
_attrMap = AttrMap(BASE=VerticalBarChart, theta_x = AttrMapValue(isNumber, desc='dx/dz'), theta_y = AttrMapValue(isNumber, desc='dy/dz'), ) theta_x = .5 theta_y = .5
def sort(self): self._data.sort(_cmpFakeItem) #for t in self._data: print t
_3d_depth = seriesCount*self.barWidth+(seriesCount-1)*self.barSpacing
_3d_depth = seriesCount*self.barWidth+(seriesCount+1)*self.barSpacing
def calcBarPositions(self): VerticalBarChart.calcBarPositions(self) seriesCount = self._seriesCount if self.categoryAxis.style=='parallel_3d': _3d_depth = seriesCount*self.barWidth+(seriesCount-1)*self.barSpacing else: _3d_depth = self.barWidth _3d_depth *= self._normFactor self._3d_dx = self._theta_x*_3d_depth self._3...
_3d_depth = self.barWidth
_3d_depth = self.barWidth + 2*self.barSpacing
def calcBarPositions(self): VerticalBarChart.calcBarPositions(self) seriesCount = self._seriesCount if self.categoryAxis.style=='parallel_3d': _3d_depth = seriesCount*self.barWidth+(seriesCount-1)*self.barSpacing else: _3d_depth = self.barWidth _3d_depth *= self._normFactor self._3d_dx = self._theta_x*_3d_depth self._3...
self._3d_dx = self._theta_x*_3d_depth self._3d_dy = self._theta_y*_3d_depth
self._3d_dx = self.theta_x*_3d_depth self._3d_dy = self.theta_y*_3d_depth
def calcBarPositions(self): VerticalBarChart.calcBarPositions(self) seriesCount = self._seriesCount if self.categoryAxis.style=='parallel_3d': _3d_depth = seriesCount*self.barWidth+(seriesCount-1)*self.barSpacing else: _3d_depth = self.barWidth _3d_depth *= self._normFactor self._3d_dx = self._theta_x*_3d_depth self._3...
z0 = self._normFactor*rowNo*(self.barWidth+self.barSpacing)
z0 = self._normFactor*(rowNo*(self.barWidth+self.barSpacing)+self.barSpacing)
def _calc_z0(self,rowNo): if self.categoryAxis.style=='parallel_3d': z0 = self._normFactor*rowNo*(self.barWidth+self.barSpacing) else: z0 = 0 return z0
z0 = 0
z0 = self._normFactor*self.barSpacing
def _calc_z0(self,rowNo): if self.categoryAxis.style=='parallel_3d': z0 = self._normFactor*rowNo*(self.barWidth+self.barSpacing) else: z0 = 0 return z0
x += z0*self._theta_x y += z0*self._theta_y
x += z0*self.theta_x y += z0*self.theta_y
def _makeBar(self,g,x,y,width,height,rowNo,style): z0 = self._calc_z0(rowNo) z1 = z0 + self.barWidth*self._normFactor if height<0: y += height height = -height x += z0*self._theta_x y += z0*self._theta_y g.add((0,z0,z1,x,y,width,height,rowNo,style))
x += z0*self._theta_x y += z0*self._theta_y
x += z0*self.theta_x y += z0*self.theta_y
def _addBarLabel(self, g, rowNo, colNo, x, y, width, height): z0 = self._calc_z0(rowNo) z1 = z0 x += z0*self._theta_x y += z0*self._theta_y g.add((1,z0,z1,x,y,width,height,rowNo,colNo))
theta_x = self._theta_x theta_y = self._theta_y
theta_x = self.theta_x theta_y = self.theta_y
def makeBars(self): from utils3d import _draw_3d_bar fg = _FakeGroup() self._makeBars(fg,fg) fg.sort() g = Group() theta_x = self._theta_x theta_y = self._theta_y for t in fg.value(): if t[0]==1: z0,z1,x,y,width,height,rowNo,colNo = t[1:] VerticalBarChart._addBarLabel(self,g,rowNo,colNo,x,y,width,height) elif t[0]==0: ...
if args['width'] <> 'None': self._curImage.width = self.ceval('image',args,'width') if args['height'] <> 'None': self._curImage.height = self.ceval('image',args,'height')
self._curImage.width = self.ceval('image',args,'width') self._curImage.height = self.ceval('image',args,'height')
def start_image(self, args): self._curImage = pythonpoint.PPImage() self._curImage.filename = self._arg('image',args,'filename') if args['width'] <> 'None': self._curImage.width = self.ceval('image',args,'width') if args['height'] <> 'None': self._curImage.height = self.ceval('image',args,'height')
_3d_depth = nSeries*zDepth+(n+1)*self.zSpace
_3d_depth = nSeries*zDepth+(nSeries+1)*self.zSpace
def calcPositions(self): HorizontalLineChart.calcPositions(self) nSeries = self._seriesCount zSpace = self.zSpace zDepth = self.zDepth if self.categoryAxis.style=='parallel_3d': _3d_depth = nSeries*zDepth+(n+1)*self.zSpace else: _3d_depth = zDepth + 2*zSpace self._3d_dx = self.theta_x*_3d_depth self._3d_dy = self.theta...
data = _data + [data]
data = list(_data) + [data]
def _getConfigureData(self): cA = self.categoryAxis data = self.data if cA.style!='parallel': _data = data data = max(map(len,_data))*[0] for d in _data: for i in xrange(len(d)): data[i] += d[i] or 0 data = _data + [data] self._configureData = data
return [getrefcount(eval(x,L,G0))-1 for x in defns.split()]
return ' '.join([str(getrefcount(eval(x,L,G0))-1) for x in defns.split()])
def getrc(defns,depth=1): from sys import getrefcount, _getframe f = _getframe(depth) G0 = f.f_globals L = f.f_locals if L is not G0: LL = [L] while 1: f = f.f_back G = f.f_globals L = f.f_locals if G is not G0 or G is L: break LL.append(L) L = {} for l in reversed(LL): L.update(l) else: L = L.copy() G0 = G0.copy() ret...
return ' '.join(["%s %d-->%d" % (x,v,w) for x,v,w in zip(defns.split(),rcv0,rcv1) if v!=w])
return ' '.join(["%s %s-->%s" % (x,v,w) for x,v,w in zip(defns.split(),rcv0.split(),rcv1.split()) if v!=w])
def checkrc(defns,rcv0): rcv1 = getrc(defns,2) return ' '.join(["%s %d-->%d" % (x,v,w) for x,v,w in zip(defns.split(),rcv0,rcv1) if v!=w])
eg("""canvas.ellipse(x, y, width, height, stroke=1, fill=0)""")
eg("""canvas.ellipse(x1,y1, x2,y2, stroke=1, fill=0)""")
eg(""" def __init__(self,filename, pagesize=(595.27,841.89), bottomup = 1, pageCompression=0, encoding=rl_config.defaultEncoding, verbosity=0): """)
imagedata=['BI /W %d /H %d /BPC 8 /CS /RGB /F [/A85 /Fl] ID' % (imgwidth, imgheight))]
imagedata=['BI /W %d /H %d /BPC 8 /CS /RGB /F [/A85 /Fl] ID' % (imgwidth, imgheight)]
def PIL_imagedata(self): if not zlib: warnOnce('zlib not available') return image = self.image myimage = image.convert('RGB') imgwidth, imgheight = myimage.size
self.width = 129
self.width = 130
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 = self.skewY = self._dx = 0 self.skewX = 10 self._dy = 35.5 self.showPage = 1
_w, _h = 129, 86
_w, _h = 130, 86
def draw(self): fillColor = self.fillColor strokeColor = self.strokeColor g = Group() bg = self.background shadow = self.shadow x, y = self.x, self.y 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=st...
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 x, y = self.x, self.y 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=st...
creatorcode, filetype = _KNOWN_MAC_EXT[ext]
creatorcode, filetype = _KNOWN_MAC_EXT[string.upper(ext)]
def markfilename(filename,creatorcode=None,filetype=None,ext='PDF'): try: if creatorcode is None or filetype is None and ext is not None: try: creatorcode, filetype = _KNOWN_MAC_EXT[ext] except: return macfs.FSSpec(filename).SetCreatorType(creatorcode,filetype) macostools.touched(filename) except: pass
class PageBreak(Spacer): """Move on to the next page in the document. This works by consuming all remaining space in the frame!"""
class UseUpSpace(Flowable):
def draw(self): pass
return "PageBreak()"
return "%s()" % self.__class__.__name__
def __repr__(self): return "PageBreak()"
x = i = H = pS = 0
x = i = H = pS = hx = 0
def split(self, availWidth, availHeight): canv = self.canv C = self._content x = i = H = pS = 0 n = len(C) I2W = {} for x in xrange(n): c = C[x] I = c._ptoinfo if I not in I2W.keys(): T = I.trailer Hdr = I.header tW, tH = _listWrapOn(T, availWidth, self.canv) tSB = T[0].getSpaceBefore() I2W[I] = T,tW,tH,tSB else: T,tW,...
if x: h += max(c.getSpaceBefore()-pS,0)
if x: hx = max(c.getSpaceBefore()-pS,0) h += hx
def split(self, availWidth, availHeight): canv = self.canv C = self._content x = i = H = pS = 0 n = len(C) I2W = {} for x in xrange(n): c = C[x] I = c._ptoinfo if I not in I2W.keys(): T = I.trailer Hdr = I.header tW, tH = _listWrapOn(T, availWidth, self.canv) tSB = T[0].getSpaceBefore() I2W[I] = T,tW,tH,tSB else: T,tW,...
if H+tH+max(tSB,pS)>=availHeight-_FUZZ: break
tHS = tH+max(tSB,pS) if H+tHS>=availHeight-_FUZZ: break
def split(self, availWidth, availHeight): canv = self.canv C = self._content x = i = H = pS = 0 n = len(C) I2W = {} for x in xrange(n): c = C[x] I = c._ptoinfo if I not in I2W.keys(): T = I.trailer Hdr = I.header tW, tH = _listWrapOn(T, availWidth, self.canv) tSB = T[0].getSpaceBefore() I2W[I] = T,tW,tH,tSB else: T,tW,...
aH = (availHeight - H - max(pS,tSB) - tH)*0.99
aH = (availHeight-H-tHS-hx)*0.99999
def split(self, availWidth, availHeight): canv = self.canv C = self._content x = i = H = pS = 0 n = len(C) I2W = {} for x in xrange(n): c = C[x] I = c._ptoinfo if I not in I2W.keys(): T = I.trailer Hdr = I.header tW, tH = _listWrapOn(T, availWidth, self.canv) tSB = T[0].getSpaceBefore() I2W[I] = T,tW,tH,tSB else: T,tW,...
if SS: from doctemplate import FrameBreak F = [FrameBreak()] if SS:
F = [UseUpSpace()] if len(SS)>1:
def split(self, availWidth, availHeight): canv = self.canv C = self._content x = i = H = pS = 0 n = len(C) I2W = {} for x in xrange(n): c = C[x] I = c._ptoinfo if I not in I2W.keys(): T = I.trailer Hdr = I.header tW, tH = _listWrapOn(T, availWidth, self.canv) tSB = T[0].getSpaceBefore() I2W[I] = T,tW,tH,tSB else: T,tW,...
R1 = C[:i-1]+T
R1 = C[:i]+T+F
def split(self, availWidth, availHeight): canv = self.canv C = self._content x = i = H = pS = 0 n = len(C) I2W = {} for x in xrange(n): c = C[x] I = c._ptoinfo if I not in I2W.keys(): T = I.trailer Hdr = I.header tW, tH = _listWrapOn(T, availWidth, self.canv) tSB = T[0].getSpaceBefore() I2W[I] = T,tW,tH,tSB else: T,tW,...
return R1 + [PTOContainer(R2,deepcopy(I.trailer),deepcopy(I.header))]
T = R1 + [PTOContainer(R2,deepcopy(I.trailer),deepcopy(I.header))] return T
def split(self, availWidth, availHeight): canv = self.canv C = self._content x = i = H = pS = 0 n = len(C) I2W = {} for x in xrange(n): c = C[x] I = c._ptoinfo if I not in I2W.keys(): T = I.trailer Hdr = I.header tW, tH = _listWrapOn(T, availWidth, self.canv) tSB = T[0].getSpaceBefore() I2W[I] = T,tW,tH,tSB else: T,tW,...
def asString(self, format, verbose=None):
def asString(self, format, verbose=None, preview=0):
def asString(self, format, verbose=None): """Converts to an 8 bit string in given format.""" assert format in ['pdf','ps','eps','gif','png','jpg','jpeg','bmp','ppm','tiff','tif','py','pict','pct'], 'Unknown file format "%s"' % format from reportlab import rl_config #verbose = verbose is not None and (verbose,) or (geta...
preview = getattr(self,'preview',1),
preview = preview,
def asString(self, format, verbose=None): """Converts to an 8 bit string in given format.""" assert format in ['pdf','ps','eps','gif','png','jpg','jpeg','bmp','ppm','tiff','tif','py','pict','pct'], 'Unknown file format "%s"' % format from reportlab import rl_config #verbose = verbose is not None and (verbose,) or (geta...
self.handle_data(templ % self.getSequencer())
self.handle_data(templ % self._seq)
def start_seq(self, attr): #if it has a template, use that; otherwise try for id; #otherwise take default sequence if attr.has_key('template'): templ = attr['template'] self.handle_data(templ % self.getSequencer()) return elif attr.has_key('id'): id = attr['id'] else: id = None output = self._seq.nextf(id) self.handle_...
self._seq = None
def __init__(self,verbose=0): # the sequencing stuff presumes access to a sequencer. # this may be set with setSequencer(); if a <seq> tag # is encountered and it has not been set, a default # sequencer will be provided. self._seq = None if _xmllib_newStyle: xmllib.XMLParser.__init__(self,verbose=verbose) else: xmllib...