bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def demo(self): """Shows basic use of a bar chart"""
def demo(self): """Shows basic use of a bar chart"""
5,800
def demo(self): """Shows basic use of a bar chart"""
def demo(self): """Shows basic use of a bar chart"""
5,801
def calcBarPositions(self): """Works out where they go.
def _findMinMaxValues(self): """Find the minimum and maximum value of the data we have.""" data = self.data m, M = Auto, Auto for row in data: for val in row: if val < m: m = val if val > M: M = val return m, M def calcBarPositions0(self): """Works out where they go.
5,802
def sample4a(): "Make a bar chart showing value axis region staring at *exactly* zero." drawing = Drawing(400, 200) data = [(13, 20)] bc = VerticalBarChart() bc.x = 50 bc.y = 50 bc.height = 125 bc.width = 300 bc.data = data bc.strokeColor = colors.black bc.valueAxis.valueMin = 0 ### bc.valueAxis.valueMax = 60 bc.v...
def sample4a(): "Make a bar chart showing value axis region starting at *exactly* zero." drawing = Drawing(400, 200) data = [(13, 20)] bc = VerticalBarChart() bc.x = 50 bc.y = 50 bc.height = 125 bc.width = 300 bc.data = data bc.strokeColor = colors.black bc.valueAxis.valueMin = 0 ### bc.valueAxis.valueMax = 60 bc....
5,803
def sample4a(): "Make a bar chart showing value axis region staring at *exactly* zero." drawing = Drawing(400, 200) data = [(13, 20)] bc = VerticalBarChart() bc.x = 50 bc.y = 50 bc.height = 125 bc.width = 300 bc.data = data bc.strokeColor = colors.black bc.valueAxis.valueMin = 0 ### bc.valueAxis.valueMax = 60 bc.v...
def sample4a(): "Make a bar chart showing value axis region staring at *exactly* zero." drawing = Drawing(400, 200) data = [(13, 20)] bc = VerticalBarChart() bc.x = 50 bc.y = 50 bc.height = 125 bc.width = 300 bc.data = data bc.strokeColor = colors.black bc.valueAxis.valueMin = 0 ### bc.valueAxis.valueMax = 60 bc.v...
5,804
def sample4b(): "Make a bar chart showing value axis region staring *below* zero." drawing = Drawing(400, 200) data = [(13, 20)] bc = VerticalBarChart() bc.x = 50 bc.y = 50 bc.height = 125 bc.width = 300 bc.data = data bc.strokeColor = colors.black bc.valueAxis.valueMin = -10 ### bc.valueAxis.valueMax = 60 bc.valu...
def sample4b(): "Make a bar chart showing value axis region starting *below* zero." drawing = Drawing(400, 200) data = [(13, 20)] bc = VerticalBarChart() bc.x = 50 bc.y = 50 bc.height = 125 bc.width = 300 bc.data = data bc.strokeColor = colors.black bc.valueAxis.valueMin = -10 ### bc.valueAxis.valueMax = 60 bc.val...
5,805
def sample4b(): "Make a bar chart showing value axis region staring *below* zero." drawing = Drawing(400, 200) data = [(13, 20)] bc = VerticalBarChart() bc.x = 50 bc.y = 50 bc.height = 125 bc.width = 300 bc.data = data bc.strokeColor = colors.black bc.valueAxis.valueMin = -10 ### bc.valueAxis.valueMax = 60 bc.valu...
def sample4b(): "Make a bar chart showing value axis region staring *below* zero." drawing = Drawing(400, 200) data = [(13, 20)] bc = VerticalBarChart() bc.x = 50 bc.y = 50 bc.height = 125 bc.width = 300 bc.data = data bc.strokeColor = colors.black bc.valueAxis.valueMin = -10 ### bc.valueAxis.valueMax = 60 bc.valu...
5,806
def sample4c(): "Make a bar chart showing value axis region staring *above* zero." drawing = Drawing(400, 200) data = [(13, 20)] bc = VerticalBarChart() bc.x = 50 bc.y = 50 bc.height = 125 bc.width = 300 bc.data = data bc.strokeColor = colors.black bc.valueAxis.valueMin = 10 ### bc.valueAxis.valueMax = 60 bc.value...
def sample4c(): "Make a bar chart showing value axis region staring *above* zero." drawing = Drawing(400, 200) data = [(13, 20)] bc = VerticalBarChart() bc.x = 50 bc.y = 50 bc.height = 125 bc.width = 300 bc.data = data bc.strokeColor = colors.black bc.valueAxis.valueMin = 10 ### bc.valueAxis.valueMax = 60 bc.value...
5,807
def __init__(self, filename, width=None, height=None, kind='direct', mask="auto", lazy=1): """If size to draw at not specified, get it from the image.""" self.hAlign = 'CENTER' self._mask = mask # if it is a JPEG, will be inlined within the file - # but we still need to know its size now fp = hasattr(filename,'read') i...
def __init__(self, filename, width=None, height=None, kind='direct', mask="auto", lazy=1): """If size to draw at not specified, get it from the image.""" self.hAlign = 'CENTER' self._mask = mask # if it is a JPEG, will be inlined within the file - # but we still need to know its size now fp = hasattr(filename,'read') i...
5,808
def _setup_inner(self): width = self._width height = self._height kind = self._kind (self.imageWidth, self.imageHeight) = self._img.getSize() if self._lazy>=2: del self._img if kind in ['direct','absolute']: self.drawWidth = width or self.imageWidth self.drawHeight = height or self.imageHeight elif kind in ['percentage...
def _setup_inner(self): width = self._width height = self._height kind = self._kind img = self._img if img: self.imageWidth, self.imageHeight = img.getSize() if self._lazy>=2: del self._img if kind in ['direct','absolute']: self.drawWidth = width or self.imageWidth self.drawHeight = height or self.imageHeight elif kind...
5,809
def linearlyInterpolatedColor(c0, c1, x0, x1, x): """ Linearly interpolates colors. Can handle RGB, CMYK and PCMYK colors - give ValueError if colours aren't the same. Doesn't currently handle 'Spot Color Interpolation'. """ if c0.__class__ != c1.__class__: raise ValueError, "Color classes must be the same for interpo...
def linearlyInterpolatedColor(c0, c1, x0, x1, x): """ Linearly interpolates colors. Can handle RGB, CMYK and PCMYK colors - give ValueError if colours aren't the same. Doesn't currently handle 'Spot Color Interpolation'. """ if c0.__class__ != c1.__class__: raise ValueError, "Color classes must be the same for interpo...
5,810
def calcBarPositions(self): """Works out where they go. default vertical.
def calcBarPositions(self): """Works out where they go. default vertical.
5,811
def calcBarPositions(self): """Works out where they go. default vertical.
def calcBarPositions(self): """Works out where they go. default vertical.
5,812
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))
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))
5,813
def getAttributes(self,attr,attrMap): A = {} for k, v in attr.items(): k = string.lower(k) if k in attrMap.keys(): j = attrMap[k] func = j[1] try: A[j[0]] = (func is None) and v or apply(func,(v,)) except: self.syntax_error('%s: invalid value %s'%(k,v)) else: self.syntax_error('invalid attribute name %s'%k) return A
def getAttributes(self,attr,attrMap): A = {} for k, v in attr.items(): k = string.lower(k) if k in attrMap.keys(): j = attrMap[k] func = j[1] try: A[j[0]] = (func is None) and v or apply(func,(v,)) except: self._syntax_error('%s: invalid value %s'%(k,v)) else: self.syntax_error('invalid attribute name %s'%k) return A
5,814
def getAttributes(self,attr,attrMap): A = {} for k, v in attr.items(): k = string.lower(k) if k in attrMap.keys(): j = attrMap[k] func = j[1] try: A[j[0]] = (func is None) and v or apply(func,(v,)) except: self.syntax_error('%s: invalid value %s'%(k,v)) else: self.syntax_error('invalid attribute name %s'%k) return A
def getAttributes(self,attr,attrMap): A = {} for k, v in attr.items(): k = string.lower(k) if k in attrMap.keys(): j = attrMap[k] func = j[1] try: A[j[0]] = (func is None) and v or apply(func,(v,)) except: self.syntax_error('%s: invalid value %s'%(k,v)) else: self._syntax_error('invalid attribute name %s'%k) return A
5,815
def _reset(self, style): '''reset the parser''' xmllib.XMLParser.reset(self)
def _reset(self, style): '''reset the parser''' xmllib.XMLParser.reset(self)
5,816
def _AsciiHexTest(text='What is the average velocity of a sparrow?'): "Do the obvious test for whether Ascii Hex encoding works" print 'Plain text:', text encoded = _AsciiHexEncode(text) print 'Encoded:', encoded decoded = _AsciiHexDecode(encoded) print 'Decoded:', decoded if decoded == text: print 'Passed' else: print...
def _AsciiHexTest(text='What is the average velocity of a sparrow?'): "Do the obvious test for whether Ascii Hex encoding works" print 'Plain text:', text encoded = _AsciiHexEncode(text) print 'Encoded:', encoded decoded = _AsciiHexDecode(encoded) print 'Decoded:', decoded if decoded == text: print 'Passed' else: print...
5,817
def _setRange(self, dataSeries): """Set minimum and maximum axis values.
def _setRange(self, dataSeries): """Set minimum and maximum axis values.
5,818
def beforeBuild(self): # keep track of the last run self._lastEntries = self._entries[:] self.clearEntries()
def beforeBuild(self): # keep track of the last run self._lastEntries = self._entries[:] self.clearEntries()
5,819
def notify(self, kind, stuff): """DocTemplate framework can call this with all kinds of events; we say we are interested in 'TOCEntry' events.""" if kind == 'TOCEntry': (level, text, pageNum) = stuff self.addEntry(level, text, pageNum) #print 'TOC notified of ', stuff
def notify(self, kind, stuff): """DocTemplate framework can call this with all kinds of events; we say we are interested in 'TOCEntry' events.""" if kind == 'TOCEntry': (level, text, pageNum) = stuff self.addEntry(level, text, pageNum) #print 'TOC notified of ', stuff
5,820
def addEntries(self, listOfEntries): """Bulk creation. If you knew the titles but not the page numbers, you could supply them to get sensible output on the first run.""" for (level, text, pageNum) in listOfEntries: self.addEntry(level, text, pageNum)
def addEntries(self, listOfEntries): """Bulk creation. If you knew the titles but not the page numbers, you could supply them to get sensible output on the first run.""" for (level, text, pageNum) in listOfEntries: self.addEntry(level, text, pageNum)
5,821
def drawOn(self, canvas, x, y, _sW=0): """Don't do this at home! The standard calls for implementing draw(); we are hooking this in order to delegate ALL the drawing work to the embedded table object""" self._table.drawOn(canvas, x, y, _sW)
def drawOn(self, canvas, x, y, _sW=0): """Don't do this at home! The standard calls for implementing draw(); we are hooking this in order to delegate ALL the drawing work to the embedded table object""" self._table.drawOn(canvas, x, y, _sW)
5,822
def drawOn(self, canvas, x, y, _sW=0): """Don't do this at home! The standard calls for implementing draw(); we are hooking this in order to delegate ALL the drawing work to the embedded table object""" self._table.drawOn(canvas, x, y, _sW)
def drawOn(self, canvas, x, y, _sW=0): """Don't do this at home!The standard calls for implementing draw(); we are hooking this in order to delegate ALL the drawing work to the embedded table object""" self._table.drawOn(canvas, x, y, _sW)
5,823
def drawOn(self, canvas, x, y, _sW=0): """Don't do this at home! The standard calls for implementing draw(); we are hooking this in order to delegate ALL the drawing work to the embedded table object""" self._table.drawOn(canvas, x, y, _sW)
def drawOn(self, canvas, x, y, _sW=0): """Don't do this at home! The standard calls for implementing draw(); we are hooking this in order to delegate ALL the drawing work to the embedded table object""" self._table.drawOn(canvas, x, y, _sW)
5,824
def getSampleTOCData(depth=3): """Returns a longish block of page numbers and headings over 3 levels""" from random import randint pgNum = 2 data = [] for chapter in range(1,8): data.append(0, """Chapter %d with a really long name which will hopefully wrap onto a second line, fnding out if the right things happen with ...
def getSampleTOCData(depth=3): """Returns a longish block of page numbers and headings over 3 levels""" from random import randint pgNum = 2 data = [] for chapter in range(1,8): data.append((0, """Chapter %d with a really long name which will hopefully wrap onto a second line, fnding out if the right things happen with...
5,825
def getSampleTOCData(depth=3): """Returns a longish block of page numbers and headings over 3 levels""" from random import randint pgNum = 2 data = [] for chapter in range(1,8): data.append(0, """Chapter %d with a really long name which will hopefully wrap onto a second line, fnding out if the right things happen with ...
def getSampleTOCData(depth=3): """Returns a longish block of page numbers and headings over 3 levels""" from random import randint pgNum = 2 data = [] for chapter in range(1,8): data.append(0, """Chapter %d with a really long name which will hopefully wrap onto a second line, fnding out if the right things happen with ...
5,826
def getSampleTOCData(depth=3): """Returns a longish block of page numbers and headings over 3 levels""" from random import randint pgNum = 2 data = [] for chapter in range(1,8): data.append(0, """Chapter %d with a really long name which will hopefully wrap onto a second line, fnding out if the right things happen with ...
def getSampleTOCData(depth=3): """Returns a longish block of page numbers and headings over 3 levels""" from random import randint pgNum = 2 data = [] for chapter in range(1,8): data.append(0, """Chapter %d with a really long name which will hopefully wrap onto a second line, fnding out if the right things happen with ...
5,827
def getSampleTOCData(depth=3): """Returns a longish block of page numbers and headings over 3 levels""" from random import randint pgNum = 2 data = [] for chapter in range(1,8): data.append(0, """Chapter %d with a really long name which will hopefully wrap onto a second line, fnding out if the right things happen with ...
def getSampleTOCData(depth=3): """Returns a longish block of page numbers and headings over 3 levels""" from random import randint pgNum = 2 data = [] for chapter in range(1,8): data.append(0, """Chapter %d with a really long name which will hopefully wrap onto a second line, fnding out if the right things happen with ...
5,828
def getSampleStory(depth=3): """Makes a story with lots of paragraphs. Uses the random TOC data and makes paragraphs to correspond to each.""" from reportlab.platypus.doctemplate import randomText from random import randint styles = getSampleStyleSheet() TOCData = getSampleTOCData(depth) story = [Paragraph("This is ...
def getSampleStory(depth=3): """Makes a story with lots of paragraphs. Uses the random TOC data and makes paragraphs to correspond to each.""" from reportlab.platypus.doctemplate import randomText from random import randint styles = getSampleStyleSheet() TOCData = getSampleTOCData(depth) story = [Paragraph("This is ...
5,829
def afterInit(self): """Set up the page templates""" frameT = Frame(self.leftMargin, self.bottomMargin, self.width, self.height, id='normal') self.addPageTemplates([PageTemplate(id='Front',frames=frameT), PageTemplate(id='Body',frames=frameT) ]) # just need a unique key generator for outline entries; # easiest is to co...
def afterInit(self): """Set up the page templates""" frameT = Frame(self.leftMargin, self.bottomMargin, self.width, self.height, id='normal') self.addPageTemplates([PageTemplate(id='Front',frames=frameT), PageTemplate(id='Body',frames=frameT) ]) # just need a unique key generator for outline entries; # easiest is to co...
5,830
def afterFlowable(self, flowable): """Our rule for the table of contents is simply to take the text of H1, H2 and H3 elements. We broadcast a notification to the DocTemplate, which should inform the TOC and let it pull them out. Also build an outline""" self._uniqueKey = self._uniqueKey + 1 if hasattr(flowable, 'style...
def afterFlowable(self, flowable): """Our rule for the table of contents is simply to take the text of H1, H2 and H3 elements. We broadcast a notification to the DocTemplate, which should inform the TOC and let it pull them out. Also build an outline""" self._uniqueKey = self._uniqueKey + 1 if hasattr(flowable, 'style...
5,831
def afterFlowable(self, flowable): """Our rule for the table of contents is simply to take the text of H1, H2 and H3 elements. We broadcast a notification to the DocTemplate, which should inform the TOC and let it pull them out. Also build an outline""" self._uniqueKey = self._uniqueKey + 1 if hasattr(flowable, 'style...
def afterFlowable(self, flowable): """Our rule for the table of contents is simply to take the text of H1, H2 and H3 elements. We broadcast a notification to the DocTemplate, which should inform the TOC and let it pull them out. Also build an outline""" self._uniqueKey = self._uniqueKey + 1 if hasattr(flowable, 'style...
5,832
def afterFlowable(self, flowable): """Our rule for the table of contents is simply to take the text of H1, H2 and H3 elements. We broadcast a notification to the DocTemplate, which should inform the TOC and let it pull them out. Also build an outline""" self._uniqueKey = self._uniqueKey + 1 if hasattr(flowable, 'style...
defafterFlowable(self,flowable):"""OurruleforthetableofcontentsissimplytotakethetextofH1,H2andH3elements.WebroadcastanotificationtotheDocTemplate,whichshouldinformtheTOCandletitpullthemout.Alsobuildanoutline"""self._uniqueKey=self._uniqueKey+1ifhasattr(flowable,'style'):ifflowable.style.name=='Heading1':self.notify0('T...
5,833
def beforePage(self): """decorate the page""" self.canv.saveState() self.canv.setStrokeColor(colors.red) self.canv.setLineWidth(5) self.canv.line(66,72,66,PAGE_HEIGHT-72) self.canv.setFont('Times-Roman',12) self.canv.drawString(4 * inch, 0.75 * inch, "Page %d" % doc.page) self.canv.restoreState()
def beforePage(self): """decorate the page""" self.canv.saveState() self.canv.setStrokeColor(colors.red) self.canv.setLineWidth(5) self.canv.line(66,72,66,PAGE_HEIGHT-72) self.canv.setFont('Times-Roman',12) self.canv.drawString(4 * inch, 0.75 * inch, "Page %d" % doc.page) self.canv.restoreState()
5,834
def beforePage(self): """decorate the page""" self.canv.saveState() self.canv.setStrokeColor(colors.red) self.canv.setLineWidth(5) self.canv.line(66,72,66,PAGE_HEIGHT-72) self.canv.setFont('Times-Roman',12) self.canv.drawString(4 * inch, 0.75 * inch, "Page %d" % doc.page) self.canv.restoreState()
def beforePage(self): """decorate the page""" self.canv.saveState() self.canv.setStrokeColor(colors.red) self.canv.setLineWidth(5) self.canv.line(66,72,66,PAGE_HEIGHT-72) self.canv.setFont('Times-Roman',12) self.canv.drawString(4 * inch, 0.75 * inch, "Page %d" % doc.page) self.canv.restoreState()
5,835
def loadImageFromSRC(self, im): "Extracts the stream, width and height" if im._image.format=='JPEG': fp=image.fp fp.seek(0) self.loadImageFromJPEG(fp) else: zlib = import_zlib() if not zlib: return self.width, self.height = im.getSize() raw = im.getRGBData() assert(len(raw) == self.width*self.height, "Wrong amount of d...
def loadImageFromSRC(self, im): "Extracts the stream, width and height" if im._image.format=='JPEG': fp=im._image.fp fp.seek(0) self.loadImageFromJPEG(fp) else: zlib = import_zlib() if not zlib: return self.width, self.height = im.getSize() raw = im.getRGBData() assert(len(raw) == self.width*self.height, "Wrong amount ...
5,836
def toColor(arg,default=None): '''try to map an arbitrary arg to a color instance''' if isinstance(arg,Color): return arg tArg = type(arg) if tArg in _SeqTypes: return Color(arg[0],arg[1],arg[2]) elif tArg == StringType: C = getAllNamedColors() s = string.lower(arg) if C.has_key(s): return C[s] try: s = eval(arg) if is...
def toColor(arg,default=None): '''try to map an arbitrary arg to a color instance''' if isinstance(arg,Color): return arg tArg = type(arg) if tArg in _SeqTypes: assert 3<=len(arg)<=4, 'Can only convert 3 and 4 sequences to color' assert 0<=min(arg) and max(arg)<=1 return len(arg)==3 and Color(arg[0],arg[1],arg[2]) or C...
5,837
def toColor(arg,default=None): '''try to map an arbitrary arg to a color instance''' if isinstance(arg,Color): return arg tArg = type(arg) if tArg in _SeqTypes: return Color(arg[0],arg[1],arg[2]) elif tArg == StringType: C = getAllNamedColors() s = string.lower(arg) if C.has_key(s): return C[s] try: s = eval(arg) if is...
def toColor(arg,default=None): '''try to map an arbitrary arg to a color instance''' if isinstance(arg,Color): return arg tArg = type(arg) if tArg in _SeqTypes: return Color(arg[0],arg[1],arg[2]) elif tArg == StringType: C = getAllNamedColors() s = string.lower(arg) if C.has_key(s): return C[s] try: return toColor(eval...
5,838
def expandUserNodes0(self): """Return a new drawing which only contains primitive shapes."""
def expandUserNodes0(self): """Return a new drawing which only contains primitive shapes."""
5,839
def __init__(self,filename, pagesize=None, bottomup = 1, pageCompression=None, encoding = None, invariant = None, verbosity=0): """Create a canvas of a given size. etc. Most of the attributes are private - we will use set/get methods as the preferred interface. Default page size is A4.""" if pagesize is None: pagesize...
def __init__(self,filename, pagesize=None, bottomup = 1, pageCompression=None, encoding = None, invariant = None, verbosity=0): """Create a canvas of a given size. etc. Most of the attributes are private - we will use set/get methods as the preferred interface. Default page size is A4.""" if pagesize is None: pagesize...
5,840
def checkPageSize(self,canv,doc): '''This gets called by the template framework If canv size != doc 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 #R...
def checkPageSize(self,canv,doc): '''This gets called by the template framework If canv size != doc 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 #R...
5,841
def checkPageSize(self,canv,doc): '''This gets called by the template framework If canv size != doc 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 #R...
def checkPageSize(self,canv,doc): '''This gets called by the template framework If canv size != doc 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 #R...
5,842
def SaveToFile(self, filename,canvas): """Open a file, and ask each object in turn to write itself to the file. Keep track of the file position at each point for use in the index at the end""" f = open(filename, 'wb') i = 1 self.xref = [] f.write("%PDF-1.2" + LINEEND) # for CID support f.write("%\355\354\266\276" + L...
def SaveToFile(self, filename,canvas): """Open a file, and ask each object in turn to write itself to the file. Keep track of the file position at each point for use in the index at the end""" if type(f)==type(''): f = open(filename, 'wb') else: f = filename i = 1 self.xref = [] f.write("%PDF-1.2" + LINEEND) # for ...
5,843
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(...
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...
5,844
def process(datafilename): parser = stdparser.PPMLParser() rawdata = open(datafilename).read() parser.feed(rawdata) pres = parser.getPresentation() pres.save() parser.close()
def process(datafilename): parser = stdparser.PPMLParser() rawdata = open(datafilename).read() parser.feed(rawdata) pres = parser.getPresentation() pres.save() parser.close()
5,845
def __init__(self, encoding=DEFAULT_ENCODING): self.encoding = encoding # mapping of internal identifier ("Page001") to PDF objectnumber and generation number (34, 0) self.idToObjectNumberAndVersion = {} # mapping of internal identifier ("Page001") to PDF object (PDFPage instance) self.idToObject = {} # internal id to ...
def __init__(self, encoding=DEFAULT_ENCODING, dummyoutline=0): self.encoding = encoding # mapping of internal identifier ("Page001") to PDF objectnumber and generation number (34, 0) self.idToObjectNumberAndVersion = {} # mapping of internal identifier ("Page001") to PDF object (PDFPage instance) self.idToObject = {} #...
5,846
def __init__(self, encoding=DEFAULT_ENCODING): self.encoding = encoding # mapping of internal identifier ("Page001") to PDF objectnumber and generation number (34, 0) self.idToObjectNumberAndVersion = {} # mapping of internal identifier ("Page001") to PDF object (PDFPage instance) self.idToObject = {} # internal id to ...
def __init__(self, encoding=DEFAULT_ENCODING): self.encoding = encoding # mapping of internal identifier ("Page001") to PDF objectnumber and generation number (34, 0) self.idToObjectNumberAndVersion = {} # mapping of internal identifier ("Page001") to PDF object (PDFPage instance) self.idToObject = {} # internal id to ...
5,847
def format(self): # register the Catalog/INfo and then format the objects one by one until exhausted # (possible infinite loop if there is a bug that continually makes new objects/refs...) # prepare outline outline = self.outline outline.prepare(self, canvas) cat = self.Catalog info = self.Info self.Reference(self.Cata...
def format(self): # register the Catalog/INfo and then format the objects one by one until exhausted # (possible infinite loop if there is a bug that continually makes new objects/refs...) # prepare outlinecat = self.Catalog info = self.Info self.Reference(self.Catalog) self.Reference(self.Info) # make std fonts (this ...
5,848
def testpage(document): P = PDFPage() P.Contents = teststream() pages = document.Pages P.Parent = document.Reference(pages) P.MediaBox = PDFArray([0, 0, 595, 841]) resources = PDFResourceDictionary() resources.allProcs() # enable all procsets resources.basicFonts() P.Resources = resources pages.addPage(P)
def testpage(document): P = PDFPage() P.Contents = teststream() pages = document.Pages P.Parent = document.Reference(pages) P.MediaBox = PDFArray([0, 0, 595, 841]) resources = PDFResourceDictionary() resources.allProcs() # enable all procsets resources.basicFonts() P.Resources = resources pages.addPage(P)
5,849
def testpage(document): P = PDFPage() P.Contents = teststream() pages = document.Pages P.Parent = document.Reference(pages) P.MediaBox = PDFArray([0, 0, 595, 841]) resources = PDFResourceDictionary() resources.allProcs() # enable all procsets resources.basicFonts() P.Resources = resources pages.addPage(P)
def testpage(document): P = PDFPage() P.Contents = teststream() pages = document.Pages P.Parent = document.Reference(pages) P.MediaBox = PDFArray([0, 0, 595, 841]) resources = PDFResourceDictionary() resources.allProcs() # enable all procsets resources.basicFonts() P.Resources = resources pages.addPage(P)
5,850
def format(self, document): return self.text '''
def format(self, document): return self.text '''
5,851
def format(self, document): self.BBox = self.BBox or PDFArray([self.lowerx, self.lowery, self.upperx, self.uppery]) self.Matrix = self.Matrix or PDFArray([1, 0, 0, 1, 0, 0]) if not self.Annots: self.Annots = None else: raise ValueError, "annotations not reimplemented yet" if not self.Contents: stream = self.stream if n...
def format(self, document): self.BBox = self.BBox or PDFArray([self.lowerx, self.lowery, self.upperx, self.uppery]) self.Matrix = self.Matrix or PDFArray([1, 0, 0, 1, 0, 0]) if not self.Annots: self.Annots = None else: raise ValueError, "annotations not reimplemented yet" if not self.Contents: stream = self.stream if n...
5,852
def format(self, document): strings = map(str, self.strings) # final conversion, in case of lazy objects return string.join(self.strings, "")
def format(self, document): strings = map(str, self.strings) # final conversion, in case of lazy objects return string.join(self.strings, "")
5,853
def _applyAttributes(obj, attr): for k, v in attr.items(): if type(v) is TupleType and v[0]=='relative': #AR 20/5/2000 - remove 1.5.2-ism #v = v[1]+getattr(obj,k,0) if hasattr(obj, k): v = v[1]+getattr(obj,k) else: v = v[1] setattr(obj,k,v)
def _applyAttributes(obj, attr): for k, v in attr.items(): if type(v) is TupleType and v[0]=='relative': #AR 20/5/2000 - remove 1.5.2-ism #v = v[1]+getattr(obj,k,0) if hasattr(obj, k): v = v[1]+getattr(obj,k) else: v = v[1] setattr(obj,k,v)
5,854
def _applyAttributes(obj, attr): for k, v in attr.items(): if type(v) is TupleType and v[0]=='relative': #AR 20/5/2000 - remove 1.5.2-ism #v = v[1]+getattr(obj,k,0) if hasattr(obj, k): v = v[1]+getattr(obj,k) else: v = v[1] setattr(obj,k,v)
def _applyAttributes(obj, attr): for k, v in attr.items(): if type(v) is TupleType and v[0]=='relative': #AR 20/5/2000 - remove 1.5.2-ism #v = v[1]+getattr(obj,k,0) if hasattr(obj, k): v = v[1]+getattr(obj,k) else: v = v[1] setattr(obj,k,v)
5,855
def _applyAttributes(obj, attr): for k, v in attr.items(): if type(v) is TupleType and v[0]=='relative': #AR 20/5/2000 - remove 1.5.2-ism #v = v[1]+getattr(obj,k,0) if hasattr(obj, k): v = v[1]+getattr(obj,k) else: v = v[1] setattr(obj,k,v)
def _applyAttributes(obj, attr): for k, v in attr.items(): if type(v) is TupleType and v[0]=='relative': #AR 20/5/2000 - remove 1.5.2-ism #v = v[1]+getattr(obj,k,0) if hasattr(obj, k): v = v[1]+getattr(obj,k) else: v = v[1] setattr(obj,k,v)
5,856
def _applyAttributes(obj, attr): for k, v in attr.items(): if type(v) is TupleType and v[0]=='relative': #AR 20/5/2000 - remove 1.5.2-ism #v = v[1]+getattr(obj,k,0) if hasattr(obj, k): v = v[1]+getattr(obj,k) else: v = v[1] setattr(obj,k,v)
def _applyAttributes(obj, attr): for k, v in attr.items(): if type(v) is TupleType and v[0]=='relative': #AR 20/5/2000 - remove 1.5.2-ism #v = v[1]+getattr(obj,k,0) if hasattr(obj, k): v = v[1]+getattr(obj,k) else: v = v[1] setattr(obj,k,v)
5,857
def _applyAttributes(obj, attr): for k, v in attr.items(): if type(v) is TupleType and v[0]=='relative': #AR 20/5/2000 - remove 1.5.2-ism #v = v[1]+getattr(obj,k,0) if hasattr(obj, k): v = v[1]+getattr(obj,k) else: v = v[1] setattr(obj,k,v)
def _applyAttributes(obj, attr): for k, v in attr.items(): if type(v) is TupleType and v[0]=='relative': #AR 20/5/2000 - remove 1.5.2-ism #v = v[1]+getattr(obj,k,0) if hasattr(obj, k): v = v[1]+getattr(obj,k) else: v = v[1] setattr(obj,k,v)
5,858
def handle_charref(self, name): try: if name[0] == 'x': n = string.atoi(name[1:], 16) else: n = string.atoi(name) except string.atoi_error: self.unknown_charref(name) return if 0 <=n<=255: self.handle_data(chr(n)) else: try: c = symenc[n] except KeyError: self.unknown_charref(name) return self._push(greek=1) self.handl...
def handle_charref(self, name): try: if name[0] == 'x': n = string.atoi(name[1:], 16) else: n = string.atoi(name) except string.atoi_error: self.unknown_charref(name) return if 0 <=n<=255: self.handle_data(chr(n)) else: try: c = symenc[n] except KeyError: self.unknown_charref(name) return self._push(greek=1) self.handl...
5,859
def _copyNamedContents(self,obj): self_contents = self.contents for (oldKey, oldValue) in self.__dict__.items(): if oldValue in self_contents: pos = self_contents.index(oldValue) setattr(obj, oldKey, obj.contents[pos])
def _copyContents(self,obj): for child in self.contents: obj.contents.append(child) def _copyNamedContents(self,obj,aKeys=None,noCopy=('contents',)): from copy import copy self_contents = self.contents for (oldKey, oldValue) in self.__dict__.items(): if oldValue in self_contents: pos = self_contents.index(oldValue) se...
5,860
def _copyNamedContents(self,obj): self_contents = self.contents for (oldKey, oldValue) in self.__dict__.items(): if oldValue in self_contents: pos = self_contents.index(oldValue) setattr(obj, oldKey, obj.contents[pos])
def _copyNamedContents(self,obj): self_contents = self.contents if not aKeys: aKeys = self._attrMap.keys() for (k, v) in self.__dict__.items(): if k in self_contents: pos = self_contents.index(v) setattr(obj, oldKey, obj.contents[pos])
5,861
def _copyNamedContents(self,obj): self_contents = self.contents for (oldKey, oldValue) in self.__dict__.items(): if oldValue in self_contents: pos = self_contents.index(oldValue) setattr(obj, oldKey, obj.contents[pos])
def _copyNamedContents(self,obj): self_contents = self.contents for (oldKey, oldValue) in self.__dict__.items(): if oldValue in self_contents: pos = self_contents.index(oldValue) setattr(obj, oldKey, obj.contents[pos])
5,862
def _copy(self,obj): """copies to obj""" obj._attrMap = self._attrMap.clone()
def _copy(self,obj): """copies to obj""" obj._attrMap = self._attrMap.clone()
5,863
def __init__(self, page, left, top, zoom): self.page = page; self.top=top; self.zoom=zoom
def __init__(self, page, left, top, zoom): self.page = page; self.top=top; self.zoom=zoom
5,864
def cvs_checkout(d): os.chdir(d) cvsdir = os.path.join(groupdir,projdir) recursive_rmdir(cvsdir) cvs = find_exe('cvs') if cvs is None: os.exit(1) os.environ['CVSROOT']=':pserver:%s@cvs.reportlab.sourceforge.net:/cvsroot/reportlab' % USER if release: do_exec(cvs+(' export -r %s %s' % (tagname,projdir)), 'the export ph...
def cvs_checkout(d): os.chdir(d) cvsdir = os.path.join(d,projdir) recursive_rmdir(cvsdir) cvs = find_exe('cvs') if cvs is None: os.exit(1) os.environ['CVSROOT']=':pserver:%s@cvs.reportlab.sourceforge.net:/cvsroot/reportlab' % USER if release: do_exec(cvs+(' export -r %s %s' % (tagname,projdir)), 'the export phase') e...
5,865
def setUp(self): from time import time from reportlab.lib.utils import get_rl_tempdir self._tempdir = get_rl_tempdir('reportlab_test','tmp_%d' % time()) _testmodulename = os.path.join(self._tempdir,'test_module_%d.py' % time()) f = open(_testmodulename,'w') f.write('__all__=[]\n') f.close() self._testmodulename = os.pa...
def setUp(self): from time import time from reportlab.lib.utils import get_rl_tempdir s = `int(time())` + `self.count` self.count += 1 self._tempdir = get_rl_tempdir('reportlab_test','tmp_%s' % s) _testmodulename = os.path.join(self._tempdir,'test_module_%s.py' % s) f = open(_testmodulename,'w') f.write('__all__=[]\n')...
5,866
def test(): #grab all drawings from the test module and write out. #make a page of links in HTML to assist viewing. import os from reportlab.graphics.testshapes import getAllTestDrawings drawings = [] if not os.path.isdir('pmout'): os.mkdir('pmout') htmlTop = """<html><head><title>renderGD output results</title></head>...
def test(): #grab all drawings from the test module and write out. #make a page of links in HTML to assist viewing. import os from reportlab.graphics.testshapes import getAllTestDrawings drawings = [] if not os.path.isdir('pmout'): os.mkdir('pmout') htmlTop = """<html><head><title>renderPM output results</title></head>...
5,867
def __init__(self,fn='rl_dbgmemo.dbg',mode='w',getScript=1,modules=(),**kw): import time, socket self.fn = fn if mode!='w': return self.store = store = {} if sys.exc_info() != (None,None,None): import traceback s = getStringIO() traceback.print_exc(None,s) store['__traceback'] = s.getvalue() cwd=os.getcwd() lcwd = os.l...
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 sys.exc_info() != (None,None,None): import traceback s = getStringIO() traceback.print_exc(None,s) store['__traceback'] = s.getvalue() cwd=os...
5,868
def __init__(self,fn='rl_dbgmemo.dbg',mode='w',getScript=1,modules=(),**kw): import time, socket self.fn = fn if mode!='w': return self.store = store = {} if sys.exc_info() != (None,None,None): import traceback s = getStringIO() traceback.print_exc(None,s) store['__traceback'] = s.getvalue() cwd=os.getcwd() lcwd = os.l...
def __init__(self,fn='rl_dbgmemo.dbg',mode='w',getScript=1,modules=(),**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'] = s.getvalue() cwd=o...
5,869
def split(self, aW, aH): S = self._CPage and [CondPageBreak(aH+1)] or [] for f in self._flowables: S.append(f) return S
def split(self, aW, aH): S = getattr(self,'_CPage',1) and [CondPageBreak(aH+1)] or [] for f in self._flowables: S.append(f) return S
5,870
def writeXref(self, f): self.startxref = f.tell() f.write('xref' + LINEEND) f.write('0 %d' % (len(self.objects) + 1) + LINEEND) f.write('0000000000 65535 f' + LINEEND) for pos in self.xref: f.write('%0.10d 00000 n' % pos + LINEEND)
defwriteXref(self,f):self.startxref=f.tell()f.write('xref'+LINEEND)f.write('0%d'%(len(self.objects)+1)+LINEEND)f.write('000000000065535f'+LINEEND)forposinself.xref:f.write('%0.10d00000n'%pos+LINEEND)
5,871
def writeTrailer(self, f): f.write('trailer' + LINEEND) f.write('<< /Size %d /Root %d 0 R /Info %d 0 R>>' % (len(self.objects) + 1, 1, self.infopos) + LINEEND) f.write('startxref' + LINEEND) f.write(str(self.startxref) + LINEEND)
def writeTrailer(self, f): f.write('trailer' + LINEEND) f.write('<< /Size %d /Root %d 0 R /Info %d 0 R>>' % (len(self.objects) + 1, 1, self.infopos) + LINEEND) f.write('startxref' + LINEEND) f.write(str(self.startxref) + LINEEND)
5,872
def centroid(P): '''compute average point of a set of points''' fn = float(len(P)) return reduce(lambda x,y: (x[0]+y[0]/fn,x[1]+y[1]/fn),P,(0,0))
def centroid(P): '''compute average point of a set of points''' return reduce(lambda x,y, fn=float(len(P)): (x[0]+y[0]/fn,x[1]+y[1]/fn),P,(0,0))
5,873
def goodTest(x,t,tb=0,**kw): try: P=_pyRXP.Parser(**kw) r = P(x) rb = 0 except: et, ev, _unused = 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 =...
def goodTest(x,t,tb=0,inOnly=0,**kw): try: P=_pyRXP.Parser(**kw) r = P(x) rb = 0 except: et, ev, _unused = 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...
5,874
def goodTest(x,t,tb=0,**kw): try: P=_pyRXP.Parser(**kw) r = P(x) rb = 0 except: et, ev, _unused = 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 =...
def goodTest(x,t,tb=0,**kw): try: P=_pyRXP.Parser(**kw) r = P(x) rb = 0 except: et, ev, _unused = 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 =...
5,875
def failTest(x,t,tb=1,**kw): goodTest(x,t,tb,**kw)
def failTest(x,t,tb=1,inOnly=0,**kw): goodTest(x,t,tb,inOnly=inOnly,**kw) def bigDepth(n): return n and '<tag%d>%s</tag%d>' % (n,bigDepth(n-1),n) or 'middle'
5,876
def _runTests(pyRXP): global _pyRXP _pyRXP = pyRXP print >>_logf, '############# Testing',pyRXP.__name__ try: for k,v in pyRXP.parser_flags.items(): eval('pyRXP.Parser(%s=%d)' % (k,v)) print >>_logf,'Parser keywords OK' _dot('.') except: traceback.print_exc() print >>_logf,'Parser keywords BAD' _dot('E') try: for k,v i...
deffailTest(bigDepth(257),"""Error Internal error, stack limit reached!\n""", inOnly=1) _runTests(pyRXP):failTest(bigDepth(257),"""Error Internal error, stack limit reached!\n""", inOnly=1) globalfailTest(bigDepth(257),"""Error Internal error, stack limit reached!\n""", inOnly=1) _pyRXPfailTest(bigDepth(257),"""Error I...
5,877
def _calc(self):
def _calc(self):
5,878
def _calc(self):
def_calc(self):
5,879
def _drawLines(self): for op, (sc, sr), (ec, er), weight, color in self._linecmds: if sc < 0: sc = sc + self._ncols if ec < 0: ec = ec + self._ncols if sr < 0: sr = sr + self._nrows if er < 0: er = er + self._nrows if op == 'GRID': self._drawBox( (sc, sr), (ec, er), weight, color) self._drawInnerGrid( (sc, sr), (ec, er...
def _drawLines(self): for op, (sc, sr), (ec, er), weight, color in self._linecmds: if sc < 0: sc = sc + self._ncols if ec < 0: ec = ec + self._ncols if sr < 0: sr = sr + self._nrows if er < 0: er = er + self._nrows getattr(self,_LineOpMap.get(op, '_drawUnknown' ))( (sc, sr), (ec, er), weight, color) self._curcolor = No...
5,880
def _splitRows(self,availHeight): self._calc() h = 0 n = 0 lim = len(self._rowHeights) while n<lim: hn = h + self._rowHeights[n] if hn>availHeight: break h = hn n = n + 1
def _splitRows(self,availHeight): h = 0 n = 0 lim = len(self._rowHeights) while n<lim: hn = h + self._rowHeights[n] if hn>availHeight: break h = hn n = n + 1
5,881
def split(self, availWidth, availHeight): if self.splitByRow: if self._width>availWidth: return [] return self._splitRows(availHeight) else: raise NotImplementedError
def split(self, availWidth, availHeight): if self.splitByRow: if self._width>availWidth: return [] return self._splitRows(availHeight) else: raise NotImplementedError
5,882
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.setFil...
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.setFil...
5,883
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.setFil...
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.setFil...
5,884
def test(): from reportlab.lib.units import inch rowheights = (24, 16, 16, 16, 16) rowheights2 = (24, 16, 16, 16, 30) colwidths = (50, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32) data = ( ('', 'Jan', 'Feb', 'Mar','Apr','May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'), ('Mugs', 0, 4, 17, 3, 21, 47, 12, 33, 2,...
def test(): from reportlab.lib.units import inch rowheights = (24, 16, 16, 16, 16) rowheights2 = (24, 16, 16, 16, 30) colwidths = (50, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32) data = ( ('', 'Jan', 'Feb', 'Mar','Apr','May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'), ('Mugs', 0, 4, 17, 3, 21, 47, 12, 33, 2,...
5,885
def func(x): W, H = _listWrapOn(self._content,x*availWidth,self.canv) W /= x H /= x return W, H
def func(x): W, H = _listWrapOn(self._content,x*availWidth,self.canv) W /= x H /= x return W, H
5,886
def func(x): W, H = _listWrapOn(self._content,x*availWidth,self.canv) W /= x H /= x return W, H
def func(x): W, H = _listWrapOn(self._content,x*availWidth,self.canv) W /= x H /= x return W, H
5,887
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 rl_isdir(dirname): continue possibles = glob.glob(dirname + os.sep + '*.[aA][fF][mM]')...
def bruteForceSearchForAFM(faceName): """Looks in all AFM files on path for face with given name. Returns AFM file name or None. Ouch!""" from reportlab.rl_config import T1SearchPath for dirname in T1SearchPath: if not rl_isdir(dirname): continue possibles = glob.glob(dirname + os.sep + '*.[aA][fF][mM]') for possibl...
5,888
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 rl_isdir(dirname): continue possibles = glob.glob(dirname + os.sep + '*.[aA][fF][mM]')...
def bruteForceSearchForAFM(faceName): """Looks in all AFM files on path for face with given name. Returns AFM file name or None. Ouch!""" import glob from reportlab.rl_config import T1SearchPath for dirname in T1SearchPath: if not rl_isdir(dirname): continue possibles = rl_glob(dirname + os.sep + '*.[aA][fF][mM]') f...
5,889
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))
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))
5,890
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))
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))
5,891
def do_exec(cmd, cmdname=None): i=os.popen(cmd,'r') print i.read() i = i.close() if i is not None: if cmdname is not None: print 'Error: %s '+ cmdname or cmd sys.exit(1)
def do_exec(cmd, cmdname=None): i=os.popen(cmd,'r') print i.read() i = i.close() if i is not None: if cmdname is not None: print 'Error: '+ cmdname or cmd sys.exit(1)
5,892
def getMacRomanWidths(self): #derive a MacRoman encoding vector MacRomanWidths = [0] * 256 for i in range(255): name = MacRomanNames[i] try: width = self.widthsByName[name] except: width = 0 MacRomanWidths[i] = width return MacRomanWidths
def getMacRomanWidths(self): #derive a MacRoman encoding vector MacRomanWidths = [0] * 256 for i in range(255): name = MacRomanNames[i] try: width = self.widthsByName[name] except: width = 0 MacRomanWidths[i] = width return MacRomanWidths
5,893
def registerFont(font): "Registers a font, including setting up info for accelerated stringWidth" #assert isinstance(font, Font), 'Not a Font: %s' % font _fonts[font.fontName] = font if not font._multiByte: if _stringWidth: _rl_accel.setFontInfo(string.lower(font.fontName), _dummyEncoding, font.face.ascent, font.face.d...
def registerFont(font): "Registers a font, including setting up info for accelerated stringWidth" #assert isinstance(font, Font), 'Not a Font: %s' % font fontName = str(font.fontName) _fonts[fontName] = font if not font._multiByte: if _stringWidth: _rl_accel.setFontInfo(string.lower(font.fontName), _dummyEncoding, font...
5,894
def registerFont(font): "Registers a font, including setting up info for accelerated stringWidth" #assert isinstance(font, Font), 'Not a Font: %s' % font _fonts[font.fontName] = font if not font._multiByte: if _stringWidth: _rl_accel.setFontInfo(string.lower(font.fontName), _dummyEncoding, font.face.ascent, font.face.d...
def registerFont(font): "Registers a font, including setting up info for accelerated stringWidth" #assert isinstance(font, Font), 'Not a Font: %s' % font _fonts[font.fontName] = font if not font._multiByte: if _stringWidth: _rl_accel.setFontInfo(string.lower(fontName), _dummyEncoding, font.face.ascent, font.face.descen...
5,895
def test(): helv = TypeFace('Helvetica') registerTypeFace(helv) print helv.glyphNames[0:30] wombat = TypeFace('Wombat') print wombat.glyphNames registerTypeFace(wombat) dumpFontData()
def test(): helv = TypeFace('Helvetica') registerTypeFace(helv) print helv.glyphNames[0:30] wombat = TypeFace('Wombat') print wombat.glyphNames registerTypeFace(wombat) dumpFontData()
5,896
def draw(self): # normalize slice data g = self.makeBackground() or Group()
def draw(self): # normalize slice data g = self.makeBackground() or Group()
5,897
def _fillSide(self,L,i,angle,strokeColor,strokeWidth,fillColor): rd = self.rad_dist(angle) if rd<self.rad_dist(self._sl3d[i].mid): p = [self.CX(i,0),self.CY(i,0), self.CX(i,1),self.CY(i,1), self.OX(i,angle,1),self.OY(i,angle,1), self.OX(i,angle,0),self.OY(i,angle,0)] L.append((rd,Polygon(p, strokeColor=strokeColor, fil...
def _fillSide(self,L,i,angle,strokeColor,strokeWidth,fillColor): rd = self.rad_dist(angle) if rd<self.rad_dist(self._sl3d[i].mid): p = [self.CX(i,0),self.CY(i,0), self.CX(i,1),self.CY(i,1), self.OX(i,angle,1),self.OY(i,angle,1), self.OX(i,angle,0),self.OY(i,angle,0)] L.append((rd,Polygon(p, strokeColor=strokeColor, fil...
5,898
def demo(self): D = Drawing(100, 100)
def demo(self): D = Drawing(100, 100)
5,899