rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
line.fillColor = col line.strokeColor = None line.strokeWidth = 0 group.add(line) r = r + (c1.red - c0.red)/num g = g + (c1.green - c0.green)/num b = b + (c1.blue - c0.blue)/num
stripe.fillColor = col stripe.strokeColor = None stripe.strokeWidth = 0 group.add(stripe) if num > 1: r = r + (c1.red - c0.red) / (num-1) g = g + (c1.green - c0.green) / (num-1) b = b + (c1.blue - c0.blue) / (num-1)
def draw(self): # general widget bits group = Group() rect = Rect(self.x, self.y, self.width, self.height) rect.strokeColor = self.strokeColor rect.strokeWidth = self.strokeWidth rect.fillColor = None group.add(rect)
for y in xrange(self.y, self.y + self.height, self.height/num): line = Rect(self.x, y, self.width, self.height/num)
if num == 1: yVals = [self.y] else: yVals = frange(self.y, self.y + h, h/num) for y in yVals: stripe = Rect(self.x, y, w, h/num)
def draw(self): # general widget bits group = Group() rect = Rect(self.x, self.y, self.width, self.height) rect.strokeColor = self.strokeColor rect.strokeWidth = self.strokeWidth rect.fillColor = None group.add(rect)
g = Grid0() g.x = 20 g.y = 530 g.demo() D.add(g) g = Grid0() g.x = 140 g.y = 530 g.delta0 = 10 g.demo() D.add(g) g = Grid0() g.x = 260 g.y = 530 g.orientation = 'horizontal' g.demo() D.add(g) sr = ShadedRect0() sr.x = 20 sr.y = 390 sr.fillColorStart = colors.Color(0, 0, 0) sr.fillColorEnd = colors.Color(1, 1, 1) sr....
for row in range(5): y = 530 - row*120 if row == 0: for col in range(3): x = 20 + col*120 g = Grid0() g.x = x g.y = y g.useRects = 0 g.useLines = 1 if col == 0: pass elif col == 1: g.delta0 = 10 elif col == 2: g.orientation = 'horizontal' g.demo() D.add(g) elif row == 1: for col in range(3): x = 20 + col*120 g = Grid0(...
def test(): D = Drawing(450,650) g = Grid0() g.x = 20 g.y = 530 g.demo() D.add(g) g = Grid0() g.x = 140 g.y = 530 g.delta0 = 10 g.demo() D.add(g) g = Grid0() g.x = 260 g.y = 530 g.orientation = 'horizontal' g.demo() D.add(g) sr = ShadedRect0() sr.x = 20 sr.y = 390 sr.fillColorStart = colors.Color(0, 0, 0) sr.fillCo...
self._rowHeghts = H
self._rowHeights = H
def _calc(self): H = self._rowHeights W = self._colWidths
if sys.argv.len()!=3 or sys.argv[1]!='-release':
if len(sys.argv)!=3 or sys.argv[1]!='-release':
def find_src_files(L,d,N): if string.upper(os.path.basename(d))=='CVS': return #ignore all CVS for n in N: fn = os.path.normcase(os.path.normpath(os.path.join(d,n))) if os.path.isfile(fn): L.append(fn)
c.drawInlineImage('pythonpowered.gif',2*inch, 7*inch)
gif = os.path.join(os.path.dirname(unittest.__file__),'pythonpowered.gif') c.drawInlineImage(gif,2*inch, 7*inch)
def makeDocument(filename, pageCallBack=None): #the extra arg is a hack added later, so other #tests can get hold of the canvas just before it is #saved global titlelist, closeit titlelist = [] closeit = 0 c = canvas.Canvas(filename) c.setPageCompression(0) c.setPageCallBack(pageCallBack) framePageForm(c) # define the...
c.drawInlineImage('pythonpowered.gif',2*inch, 5*inch, inch, inch)
c.drawInlineImage(gif,2*inch, 5*inch, inch, inch)
def makeDocument(filename, pageCallBack=None): #the extra arg is a hack added later, so other #tests can get hold of the canvas just before it is #saved global titlelist, closeit titlelist = [] closeit = 0 c = canvas.Canvas(filename) c.setPageCompression(0) c.setPageCallBack(pageCallBack) framePageForm(c) # define the...
(w, h) = c.drawImage('pythonpowered.gif', (1.5 + i)*inch, 3*inch)
(w, h) = c.drawImage(gif, (1.5 + i)*inch, 3*inch)
def makeDocument(filename, pageCallBack=None): #the extra arg is a hack added later, so other #tests can get hold of the canvas just before it is #saved global titlelist, closeit titlelist = [] closeit = 0 c = canvas.Canvas(filename) c.setPageCompression(0) c.setPageCallBack(pageCallBack) framePageForm(c) # define the...
c.drawImage('pythonpowered.gif', 3*inch, 1.2*inch, w, h, mask=myMask)
c.drawImage(gif, 3*inch, 1.2*inch, w, h, mask=myMask)
def makeDocument(filename, pageCallBack=None): #the extra arg is a hack added later, so other #tests can get hold of the canvas just before it is #saved global titlelist, closeit titlelist = [] closeit = 0 c = canvas.Canvas(filename) c.setPageCompression(0) c.setPageCallBack(pageCallBack) framePageForm(c) # define the...
def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.color = colors.green self.strokeColor = None def demo(self): D = shapes.Drawing(200, 100) et = RTriangle0() et.x=50 et.y=0 et.draw() D.add(et) labelFontSize = 10 D.add(shapes.String(et.x+(et.size/2),(et.y-(1.2*labelFontSize)), self.__class__.__name__, fill...
def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.color = colors.green self.strokeColor = None def draw(self): s = float(self.size) g = shapes.Group() ae = s*0.125 triangle = shapes.Polygon(points = [ self.x, self.y, self.x+s, self.y, self.x,self.y+s], fillColor = self.color, strokeColor = self.strokeC...
def draw(self): # general widget bits s = self.size # abbreviate as we will use this a lot g = shapes.Group() # Triangle specific bits ae = s*0.125 #(ae = 'an eighth') triangle = shapes.Polygon(points = [ self.x, self.y, self.x+s, self.y, self.x+(s/2),self.y+s], fillColor = self.color, strokeColor = self.s...
def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.color = colors.yellow self.strokeColor = None def demo(self): D = shapes.Drawing(200, 100) o = Octagon0() o.x=50 o.y=0 o.draw() D.add(o) labelFontSize = 10 D.add(shapes.String(o.x+(o.size/2),(o.y-(1.2*labelFontSize)), self.__class__.__name__, fillColor=col...
def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.color = colors.yellow self.strokeColor = None def draw(self): s = float(self.size) g = shapes.Group() athird=s/3 octagon = shapes.Polygon(points=[self.x+athird, self.y, self.x, self.y+athird, self.x, self.y+(athird*2), self.x+athird, self.y+s, self.x+(...
def draw(self): # general widget bits s = self.size # abbreviate as we will use this a lot g = shapes.Group() # Triangle specific bits ae = s*0.125 #(ae = 'an eighth') triangle = shapes.Polygon(points = [ self.x, self.y, self.x+s, self.y, self.x,self.y+s], fillColor = self.color, strokeColor = self.strokeC...
_attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor', 'color'), crossColor = AttrMapValue(isColorOrNone), boxColor = AttrMapValue(isColorOrNone), crosswidth = AttrMapValue(isNumber), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.crossColor = colors.red self.boxColor = colors.black self.crossw...
_attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor', 'color'), crossColor = AttrMapValue(isColorOrNone), boxColor = AttrMapValue(isColorOrNone), crosswidth = AttrMapValue(isNumber), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.crossColor = colors.red self.boxColor = colors.black self.crossw...
def draw(self): # general widget bits s = self.size # abbreviate as we will use this a lot g = shapes.Group() # Octagon specific bits athird=s/3
_attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor', 'color'), tickColor = AttrMapValue(isColorOrNone), boxColor = AttrMapValue(isColorOrNone), tickwidth = AttrMapValue(isNumber), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.tickColor = colors.red self.boxColor = colors.black self.tickwidth...
_attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor', 'color'), tickColor = AttrMapValue(isColorOrNone), boxColor = AttrMapValue(isColorOrNone), tickwidth = AttrMapValue(isNumber), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.tickColor = colors.red self.boxColor = colors.black self.tickwidth...
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+1, self.y+1, s-2, s-2, fillColor = None, strokeColor = self.boxColor, strokeWidth=2) g.add(box) crossLine1 = shapes.Line(self.x+(s*0.15), self.y+(s*0.15), se...
_attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor',), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.color = colors.yellow def demo(self): D = shapes.Drawing(200, 100) sf = SmileyFace0() sf.x=50 sf.y=0 sf.draw() D.add(sf) labelFontSize = 10 D.add(shapes.String(sf.x+(sf.size/2),(sf.y-(1.2*la...
_attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor',), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.color = colors.yellow def draw(self): s = float(self.size) g = shapes.Group() outerCircle = shapes.Circle(cx = (self.x+(s/2)), cy = (self.y+(s/2)), r = s/2, fillColor = self.color, stroke...
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+1, self.y+1, s-2, s-2, fillColor = None, strokeColor = self.boxColor, strokeWidth=2) g.add(box)
_attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor', 'color'), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 def demo(self): D = shapes.Drawing(200, 100) ss = StopSign0() ss.x=50 ss.y=0 ss.draw() D.add(ss) labelFontSize = 10 D.add(shapes.String(ss.x+(ss.size/2),(ss.y-(1.2*labelFontSize)), self._...
_attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor', 'color'), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 def draw(self): s = float(self.size) g = shapes.Group() athird=s/3 outerOctagon = shapes.Polygon(points=[self.x+athird, self.y, self.x, self.y+athird, self.x, self.y+(athird*2), self....
def draw(self): # general widget bits s = self.size # abbreviate as we will use this a lot g = shapes.Group() # SmileyFace specific bits outerCircle = shapes.Circle(cx = (self.x+(s/2)), cy = (self.y+(s/2)), r = s/2, fillColor = self.color, strokeColor = colors.black, strokeWidth=s/38.) g.add(outerCircle)
_attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor', 'color'), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 def demo(self): D = shapes.Drawing(200, 100) ne = NoEntry0() ne.x=50 ne.y=0 ne.draw() D.add(ne) labelFontSize = 10 D.add(shapes.String(ne.x+(ne.size/2),(ne.y-(1.2*labelFontSize)), self.__...
_attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor', 'color'), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 def draw(self): s = float(self.size) g = shapes.Group() outerCircle = shapes.Circle(cx = (self.x+(s/2)), cy = (self.y+(s/2)), r = s/2, fillColor = None, strokeColor = colors.black, str...
def draw(self): # general widget bits s = self.size # abbreviate as we will use this a lot g = shapes.Group() # stop-sign specific bits athird=s/3
_attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor', 'color'), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 def demo(self): D = shapes.Drawing(200, 100) na = NotAllowed0() na.x=50 na.y=0 na.draw() D.add(na) labelFontSize = 10 D.add(shapes.String(na.x+(na.size/2),(na.y-(1.2*labelFontSize)), self...
_attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor', 'color'), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 def draw(self): s = float(self.size) g = shapes.Group() outerCircle = shapes.Circle(cx = (self.x+(s/2)), cy = (self.y+(s/2)), r = (s/2)-(s/10), fillColor = None, strokeColor = colors.r...
def draw(self): # general widget bits s = self.size # abbreviate as we will use this a lot g = shapes.Group() # no-entry-sign specific bits outerCircle = shapes.Circle(cx = (self.x+(s/2)), cy = (self.y+(s/2)), r = s/2, fillColor = None, strokeColor = colors.black, strokeWidth=1) g.add(outerCircle)
def __init__(self): self.x = 0 self.y = 0 self.size = 100 def demo(self): D = shapes.Drawing(200, 100) ns = NoSmoking0() ns.x=50 ns.y=0 ns.draw() D.add(ns) labelFontSize = 10 D.add(shapes.String(ns.x+(ns.size/2),(ns.y-(1.2*labelFontSize)), self.__class__.__name__, fillColor=colors.black, textAnchor='middle', fontSize=...
def __init__(self): self.x = 0 self.y = 0 self.size = 100 def draw(self): s = float(self.size) g = shapes.Group() newx = self.x+(s/2)-(s/3.5) newy = self.y+(s/2)-(s/32) cigarrette1 = shapes.Rect(x = newx, y = newy, width = (s/2), height =(s/16), fillColor = colors.ghostwhite, strokeColor = colors.gray, strokeWidth=...
def draw(self): # general widget bits s = self.size # abbreviate as we will use this a lot g = shapes.Group() # not=allowed specific bits outerCircle = shapes.Circle(cx = (self.x+(s/2)), cy = (self.y+(s/2)), r = (s/2)-(s/10), fillColor = None, strokeColor = colors.red, strokeWidth=s/10.) g.add(outerCircle) centerx=s...
_attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor', 'color'), exmarkColor = AttrMapValue( isColorOrNone), backColor = AttrMapValue( isColorOrNone), exmarkWidth = AttrMapValue( isNumber), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.exmarkColor = colors.black self.backColor = colors.gold se...
_attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor', 'color'), exmarkColor = AttrMapValue( isColorOrNone), backColor = AttrMapValue( isColorOrNone), exmarkWidth = AttrMapValue( isNumber), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.exmarkColor = colors.black self.backColor = colors.gold se...
def draw(self): # general widget bits s = self.size # abbreviate as we will use this a lot g = shapes.Group() # no-smoking-sign specific bits newx = self.x+(s/2)-(s/3.5) newy = self.y+(s/2)-(s/32) cigarrette1 = shapes.Rect(x = newx, y = newy, width = (s/2), height =(s/16), fillColor = colors.ghostwhite, strokeColor =...
_attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor', 'color'), diskColor = AttrMapValue(isColor), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.diskColor = colors.black def demo(self): D = shapes.Drawing(200, 100) fd = FloppyDisk0() fd.x=50 fd.y=0 fd.draw() D.add(fd) labelFontSize = 10 D.ad...
_attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor', 'color'), diskColor = AttrMapValue(isColor), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.diskColor = colors.black def draw(self): s = float(self.size) g = shapes.Group() diskBody = shapes.Rect(x=self.x, y=self.y+(s/100), width=s, he...
def demo(self): D = shapes.Drawing(200, 100) yn = YesNo0() yn.x = 15 yn.y = 25 yn.size = 70 yn.testValue = 0 yn.draw() D.add(yn) yn2 = YesNo0() yn2.x = 120 yn2.y = 25 yn2.size = 70 yn2.testValue = 1 yn2.draw() D.add(yn2) labelFontSize = 8 D.add(shapes.String(yn.x+(yn.size/2),(yn.y-(1.2*labelFontSize)), 'testValue=0', f...
_attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor',), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.color = colors.red def demo(self): D = shapes.Drawing(200, 100) a1 = ArrowOne0() a1.x=50 a1.y=0 a1.draw() D.add(a1) labelFontSize = 10 D.add(shapes.String(a1.x+(a1.size/2),(a1.y-(1.2*labelFo...
_attrMap = AttrMap(BASE=ETriangle0, UNWANTED=('strokeColor',), ) def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.color = colors.red def draw(self): s = float(self.size) g = shapes.Group() body = shapes.Rect(x=self.x, y=(self.y+(s/2))-(s/6), width=2*(s/3), height=(s/3), fillColor = self.color, strok...
def draw(self): # general widget bits s = self.size # abbreviate as we will use this a lot g = shapes.Group()
def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.color = colors.blue def demo(self): D = shapes.Drawing(200, 100) a2 = ArrowTwo0() a2.x=50 a2.y=0 a2.draw() D.add(a2) labelFontSize = 10 D.add(shapes.String(a2.x+(a2.size/2),(a2.y-(1.2*labelFontSize)), self.__class__.__name__, fillColor=colors.black, textAn...
def __init__(self): self.x = 0 self.y = 0 self.size = 100 self.color = colors.blue def draw(self): s = float(self.size) g = shapes.Group() body = shapes.Rect(x=self.x, y=(self.y+(s/2))-(s/24), width=9*(s/10), height=(s/12), fillColor = self.color, strokeColor = None, strokeWidth=0) g.add(body) head = shapes.Polyg...
def draw(self): # general widget bits s = self.size # abbreviate as we will use this a lot g = shapes.Group()
if self.vecttor[index]!=value:
if self.vector[index]!=value:
def __setitem__(self, index, value): if self.vecttor[index]!=value: L = list(self.vector) L[index] = value self.vector = tuple(L)
addWidths(fontName, font.getWidths())
def testMetrics(): # load the standard ones: for baseFontName in standardFonts: encoding = WinAnsiEncoding fontName = baseFontName + '-WinAnsi' font = Type1Font(fontName, baseFontName, encoding) addWidths(fontName, font.getWidths()) #test it msg = 'Hello World' w = stringWidth(msg, fontName, 10)# print 'width of "%s" i...
zenc = SingleByteEncoding('WinAnsiEncoding')
zenc = Encoding('WinAnsiEncoding')
def testFonts(): # make a custom encoded font. import reportlab.pdfgen.canvas c = reportlab.pdfgen.canvas.Canvas('testfonts.pdf') c.setPageCompression(0) c.setFont('Helvetica', 12) c.drawString(100, 700, 'The text below should be in a custom encoding in which all vowels become "z"') # invent a new language where vowel...
c.registerFont0(f)
c.addFont(f)
def testFonts(): # make a custom encoded font. import reportlab.pdfgen.canvas c = reportlab.pdfgen.canvas.Canvas('testfonts.pdf') c.setPageCompression(0) c.setFont('Helvetica', 12) c.drawString(100, 700, 'The text below should be in a custom encoding in which all vowels become "z"') # invent a new language where vowel...
c.registerFont0(Type1Font('Helvetica-WinAnsi', 'Helvetica-Oblique', WinAnsiEncoding))
c.addFont(Type1Font('Helvetica-WinAnsi', 'Helvetica-Oblique', WinAnsiEncoding))
def testFonts(): # make a custom encoded font. import reportlab.pdfgen.canvas c = reportlab.pdfgen.canvas.Canvas('testfonts.pdf') c.setPageCompression(0) c.setFont('Helvetica', 12) c.drawString(100, 700, 'The text below should be in a custom encoding in which all vowels become "z"') # invent a new language where vowel...
c.registerFont0(Type1Font('MacHelvNoEuro', 'Helvetica-Oblique', MacRomanEncoding))
c.addFont(Type1Font('MacHelvNoEuro', 'Helvetica-Oblique', MacRomanEncoding))
def testFonts(): # make a custom encoded font. import reportlab.pdfgen.canvas c = reportlab.pdfgen.canvas.Canvas('testfonts.pdf') c.setPageCompression(0) c.setFont('Helvetica', 12) c.drawString(100, 700, 'The text below should be in a custom encoding in which all vowels become "z"') # invent a new language where vowel...
euroMac = SingleByteEncoding('MacRomanEncoding')
euroMac = Encoding('MacRomanEncoding')
def testFonts(): # make a custom encoded font. import reportlab.pdfgen.canvas c = reportlab.pdfgen.canvas.Canvas('testfonts.pdf') c.setPageCompression(0) c.setFont('Helvetica', 12) c.drawString(100, 700, 'The text below should be in a custom encoding in which all vowels become "z"') # invent a new language where vowel...
c.registerFont0(Type1Font('MacHelvWithEuro', 'Helvetica-Oblique', euroMac))
c.addFont(Type1Font('MacHelvWithEuro', 'Helvetica-Oblique', euroMac))
def testFonts(): # make a custom encoded font. import reportlab.pdfgen.canvas c = reportlab.pdfgen.canvas.Canvas('testfonts.pdf') c.setPageCompression(0) c.setFont('Helvetica', 12) c.drawString(100, 700, 'The text below should be in a custom encoding in which all vowels become "z"') # invent a new language where vowel...
narrowEnc = SingleByteEncoding('WinAnsiEncoding')
narrowEnc = Encoding('WinAnsiEncoding')
def testFonts(): # make a custom encoded font. import reportlab.pdfgen.canvas c = reportlab.pdfgen.canvas.Canvas('testfonts.pdf') c.setPageCompression(0) c.setFont('Helvetica', 12) c.drawString(100, 700, 'The text below should be in a custom encoding in which all vowels become "z"') # invent a new language where vowel...
c.registerFont0(Type1Font('narrow', 'Helvetica-Oblique', narrowEnc))
c.addFont(Type1Font('narrow', 'Helvetica-Oblique', narrowEnc))
def testFonts(): # make a custom encoded font. import reportlab.pdfgen.canvas c = reportlab.pdfgen.canvas.Canvas('testfonts.pdf') c.setPageCompression(0) c.setFont('Helvetica', 12) c.drawString(100, 700, 'The text below should be in a custom encoding in which all vowels become "z"') # invent a new language where vowel...
ind = indentLevel(line) if ind <= startingIndent: break
stripped = string.strip(line) if len(stripped) == 0: continue elif stripped[0] == ' continue
def getFunctionBody(f, linesInFile): """Pass in the function object and the lines in the file. Since we will typically grab several things out of the same file. it extracts a multiline text block. Works with methods too.""" if hasattr(f, 'im_func'): #it's a method, drill down and get its function f = f.im_func extr...
extracted.append(line)
ind = indentLevel(line) if ind <= startingIndent: break else: extracted.append(line)
def getFunctionBody(f, linesInFile): """Pass in the function object and the lines in the file. Since we will typically grab several things out of the same file. it extracts a multiline text block. Works with methods too.""" if hasattr(f, 'im_func'): #it's a method, drill down and get its function f = f.im_func extr...
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 extr...
if filters is not None and not dictionary.has_key("Filters"):
if filters is not None and not dictionary.dict.has_key("Filters"):
def format(self, document): dictionary = self.dictionary # copy it for modification dictionary = PDFDictionary(dictionary.dict.copy()) content = self.content filters = self.filters if self.content is None: raise ValueError, "stream content not set" if filters is None: filters = document.defaultStreamFilters # only appl...
radius = self._radius = self._cx - 5
radius = self._radius = self._cx-self.x
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...
if '.' in path:
while '.' in path: if debug: print 'removed . from 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...
if abspath in path:
while abspath in path: if debug: print 'removed "%s" from path' % abspath
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...
__version__ = '$Id: ttfonts.py,v 1.1 2002/05/28 15:33:57 rgbecker Exp $'
__version__ = '$Id: ttfonts.py,v 1.2 2002/07/02 21:28:29 dinu_gherman Exp $'
def getSubsetInternalName(self, subset, doc): '''Returns the name of a PDF Font object corresponding to a given subset of this dynamic font. Use this function instead of PDFDocument.getInternalFontName.'''
while length > 1:
while length > 0:
def extractInfo(self, charInfo=1): """Extract typographic information from the loaded font file.
if char < 0x20 or char > 0x7E:
if char < 33 or char > 126 or chr(char) in \ ('[', ']', '(', ')', '{', '}', '<', '>', '/', '%'):
def extractInfo(self, charInfo=1): """Extract typographic information from the loaded font file.
length = length - 2
length = length - 1 break elif platformId == 1 and encodingId == 0 and languageId == 0 \ and nameId == 6: psName = self.get_chunk(string_data_offset + offset, length) for char in psName: char = ord(char) if char < 33 or char > 126 or chr(char) in \ ('[', ']', '(', ')', '{', '}', '<', '>', '/', '%'): raise TTFError, ...
def extractInfo(self, charInfo=1): """Extract typographic information from the loaded font file.
raise TTFError, 'Font does not have cmap for Unicode (platform 3, encoding 1, format 4)'
raise TTFError, 'Font does not have cmap for Unicode (platform 3, encoding 1, format 4 or platform 0 any encoding format 4)'
def extractInfo(self, charInfo=1): """Extract typographic information from the loaded font file.
return lambda v, s=start, e=end, f=f: f(v,s,e,_3d_dx=_3d_dx,_3d_dy=_3d_dy)
return lambda v, s=start, e=end, f=f,_3d_dx=_3d_dx,_3d_dy=_3d_dy: f(v,s,e,_3d_dx=_3d_dx,_3d_dy=_3d_dy)
def _getLineFunc(self, start, end, parent=None): _3d_dx = getattr(parent,'_3d_dx',None) if _3d_dx is not None: _3d_dy = getattr(parent,'_3d_dy',None) f = self._dataIndex and self._cyLine3d or self._cxLine3d return lambda v, s=start, e=end, f=f: f(v,s,e,_3d_dx=_3d_dx,_3d_dy=_3d_dy) else: f = self._dataIndex and self._cy...
if self.fillColor is not None:
if self._fillColor is not None:
def drawCentredString(self, x, y, text, text_anchor='middle'): if self.fillColor is not None: textLen = stringWidth(text, self._font,self._fontSize) if text_anchor=='end': x = x-textLen elif text_anchor=='middle': x = x - textLen/2 self.drawString(x,y,text)
mask=mask,
mask=self._mask,
def draw(self): #center it self.canv.drawImage(self.filename, 0, 0, self.drawWidth, self.drawHeight, mask=mask, )
(groupX, groupWidth) = self.categoryAxis.scale(colNo) x = groupX + (0.5 * self.groupSpacing * normFactor) y = self.valueAxis.scale(0) height = self.valueAxis.scale(datum) - y lineRow.append((x, y+height))
if datum is not None: (groupX, groupWidth) = self.categoryAxis.scale(colNo) x = groupX + (0.5 * self.groupSpacing * normFactor) y = self.valueAxis.scale(0) height = self.valueAxis.scale(datum) - y lineRow.append((x, y+height))
def calcPositions(self): """Works out where they go.
if callout: callout(self,g,thisx,y,colorNamePairs[count])
if callout: callout(self,g,thisx,y,(col,name))
def gAdd(t,g=g,fontName=fontName,fontSize=fontSize,fillColor=fillColor): t.fontName = fontName t.fontSize = fontSize t.fillColor = fillColor return g.add(t)
if S[-1]=='': del S[-1]
if S==[]: S = ['']
def _getFragWords(frags): ''' given a Parafrag list return a list of fragwords [[size, (f00,w00), ..., (f0n,w0n)],....,[size, (fm0,wm0), ..., (f0n,wmn)]] each pair f,w represents a style and some string each sublist represents a word ''' R = [] W = [] n = 0 for f in frags: text = f.text #del f.text # we can't do this u...
if sys.platform=='win32' and ('install' in sys.argv or 'install_ext' in sys.argv):
if sys.hexversion<0x2030000 and sys.platform=='win32' and ('install' in sys.argv or 'install_ext' in sys.argv):
def raiseConfigError(msg): import exceptions class ConfigError(exceptions.Exception): pass raise ConfigError(msg)
def _addObjImport(obj,I):
def _addObjImport(obj,I,n=None):
def _addObjImport(obj,I): '''add an import of obj's class to a dictionary of imports''' from inspect import getmodule c = obj.__class__ m = getmodule(c).__name__ cn = c.__name__ if not I.has_key(m): I[m] = [cn] elif cn not in I[m]: I[m].append(cn)
cn = c.__name__
n = n or c.__name__
def _addObjImport(obj,I): '''add an import of obj's class to a dictionary of imports''' from inspect import getmodule c = obj.__class__ m = getmodule(c).__name__ cn = c.__name__ if not I.has_key(m): I[m] = [cn] elif cn not in I[m]: I[m].append(cn)
I[m] = [cn] elif cn not in I[m]: I[m].append(cn)
I[m] = [n] elif n not in I[m]: I[m].append(n)
def _addObjImport(obj,I): '''add an import of obj's class to a dictionary of imports''' from inspect import getmodule c = obj.__class__ m = getmodule(c).__name__ cn = c.__name__ if not I.has_key(m): I[m] = [cn] elif cn not in I[m]: I[m].append(cn)
P.extend(args)
P.extend(list(args))
def definePath(pathSegs=[],isClipPath=0, dx=0, dy=0, **kw): O = [] P = [] for seg in pathSegs: if type(seg) not in [ListType,TupleType]: opName = seg args = [] else: opName = seg[0] args = seg[1:] if opName not in _PATH_OP_NAMES: raise ValueError, 'bad operator name %s' % opName op = _PATH_OP_NAMES.index(opName) if len...
else: self._syntax_error('<onDraw/> needs at least a name attribute')
else: self._syntax_error('<onDraw> needs at least a name attribute')
def start_onDraw(self,attr): defn = ParaFrag() if attr.has_key('name'): defn.name = attr['name'] else: self._syntax_error('<onDraw/> needs at least a name attribute')
def end_onDraw(self): if hasattr(self,'text'): self._syntax_error('Only <onDraw/> tag allowed') else: self.handle_data('')
self.handle_data('')
def start_onDraw(self,attr): defn = ParaFrag() if attr.has_key('name'): defn.name = attr['name'] else: self._syntax_error('<onDraw/> needs at least a name attribute')
print l.fontName,l.fontSize,l.textColor,l.bold, l.rise, '|%s|'%l.text[:25]
print l.fontName,l.fontSize,l.textColor,l.bold, l.rise, '|%s|'%l.text[:25], if hasattr(l,'cbDefn'): print 'cbDefn',l.cbDefn.name,l.cbDefn.label,l.cbDefn.kind else: print
def check_text(text,p=_parser): print '##########' text = cleanBlockQuotedText(text) l,rv,bv = p.parse(text,style) if rv is None: for l in _parser.errors: print l else: print 'ParaStyle', l.fontName,l.fontSize,l.textColor for l in rv: print l.fontName,l.fontSize,l.textColor,l.bold, l.rise, '|%s|'%l.text[:25]
child.setProperties(Widget.getProperties(self))
for i in child._attrMap.keys(): del child.__dict__[i] child = TypedPropertyElementWrapper(self,child)
def __getitem__(self, index): try: return self._children[index] except KeyError: child = self._prototype() #should we copy down? how to keep in synch? child.setProperties(Widget.getProperties(self)) self._children[index] = child return child
class DocstringTestCase(unittest.TestCase):
class DocstringTestCase(SecureTestCase):
def getModuleObjects(folder, rootName, typ): "Get a list of all function objects defined *somewhere* in a package." folders = [folder] + subFoldersOfFolder(folder) objects = [] for f in folders: sys.path.insert(0, f) os.chdir(f) pattern = os.path.join('*.py') prefix = f[string.find(f, rootName):] prefix = string.repl...
h = s/5 z = s/2 star = Polygon(points = [ h-z, 0-z, h*1.5-z, h*2.05-z, 0-z, h*3-z, h*1.95-z, h*3-z, z-z, s-z, h*3.25-z, h*3-z, s-z, h*3-z, s-h*1.5-z, h*2.05-z, s-h-z, 0-z, z-z, h-z, ],
star = Polygon(P,
def draw(self): s = float(self.size) #abbreviate as we will use this a lot g = Group()
"""This function produces two pdf files with examples of all the signs and symbols from this file.
"""This function produces three pdf files with examples of all the signs and symbols from this file.
def test(): """This function produces two pdf files with examples of all the signs and symbols from this file. """
rowCount = er - sr
rowCount = er - sr + 1
def _drawBkgrnd(self): nrows = self._nrows ncols = self._ncols for cmd, (sc, sr), (ec, er), arg in self._bkgrndcmds: if sc < 0: sc = sc + ncols if ec < 0: ec = ec + ncols if sr < 0: sr = sr + nrows if er < 0: er = er + nrows x0 = self._colpositions[sc] y0 = self._rowpositions[sr] x1 = self._colpositions[min(ec+1,ncols)...
colCount = ec - sc
colCount = ec - sc + 1
def _drawBkgrnd(self): nrows = self._nrows ncols = self._ncols for cmd, (sc, sr), (ec, er), arg in self._bkgrndcmds: if sc < 0: sc = sc + ncols if ec < 0: ec = ec + ncols if sr < 0: sr = sr + nrows if er < 0: er = er + nrows x0 = self._colpositions[sc] y0 = self._rowpositions[sr] x1 = self._colpositions[min(ec+1,ncols)...
group = transformNode(self.doc, "g", transform="") self.currGroup.appendChild(group)
currGroup, group = self.currGroup, transformNode(self.doc, "g", transform="") currGroup.appendChild(group)
def startGroup(self): if self.verbose: print "+++ begin SVGCanvas.startGroup" group = transformNode(self.doc, "g", transform="") self.currGroup.appendChild(group) self.currGroup = group if self.verbose: print "+++ end SVGCanvas.startGroup"
def endGroup(self):
return currGroup def endGroup(self,currGroup):
def startGroup(self): if self.verbose: print "+++ begin SVGCanvas.startGroup" group = transformNode(self.doc, "g", transform="") self.currGroup.appendChild(group) self.currGroup = group if self.verbose: print "+++ end SVGCanvas.startGroup"
if not self.currGroup.getAttribute("transform"): pass
self.currGroup = currGroup
def endGroup(self): if self.verbose: print "+++ begin SVGCanvas.endGroup" if not self.currGroup.getAttribute("transform"): pass #self.currGroup.removeAttribute("transform") # self.currGroup = self.currGroup.parentNode if self.verbose: print "+++ end SVGCanvas.endGroup"
self._canvas.startGroup()
currGroup = self._canvas.startGroup()
def drawGroup(self, group): if self.verbose: print "### begin _SVGRenderer.drawGroup"
self._canvas.endGroup()
def drawGroup(self, group): if self.verbose: print "### begin _SVGRenderer.drawGroup"
valueStep = P[1]-P[0]
if len(P)>1: valueStep = P[1]-P[0] else: oVS = self.valueStep self.valueStep = None P = self._calcTickPositions() self.valueStep = oVS if len(P)>1: valueStep = P[1]-P[0] else: valueStep = self._valueStep
def _setRange(self, dataSeries): """Set minimum and maximum axis values.
for r in R: f = r[1][0]
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 # we can't do this until...
for l in bfrag.lines[start:stop-1]:
lines = bfrag.lines[start:stop] for l in lines:
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 # we can't do this until...
words[-1].text = w[1][1]
words[-1].text = nText
def breakLines(self, width): """ Returns a broken line structure. There are two cases A) For the simple case of a single formatting input fragment the output is A fragment specifier with kind = 0 fontName, fontSize, leading, textColor lines= A list of lines Each line has two items. 1) unused width in points 2) word li...
words[-1].text = words[-1].text+' '
if nText!='' and nText[0]!=' ': words[-1].text = words[-1].text + ' '
def breakLines(self, width): """ Returns a broken line structure. There are two cases A) For the simple case of a single formatting input fragment the output is A fragment specifier with kind = 0 fontName, fontSize, leading, textColor lines= A list of lines Each line has two items. 1) unused width in points 2) word li...
words[-1].text = words[-1].text + ' ' + w[1][1]
words[-1].text = words[-1].text + ' ' + nText
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...
self.decimalPlaces = places self.decimalSeparator = decimalSep self.thousandSeparator = thousandSep
self.places = places self.dot = decimalSep self.comma = thousandSep
def __init__(self, places=2, decimalSep='.', thousandSep=None, prefix=None, suffix=None): self.decimalPlaces = places self.decimalSeparator = decimalSep self.thousandSeparator = thousandSep self.prefix = prefix self.suffix = suffix
places, sep = self.decimalPlaces, self.decimalSeparator
places, sep = self.places, self.dot
def format(self, num): # positivize the numbers sign=num<0 if sign: num = -num places, sep = self.decimalPlaces, self.decimalSeparator strip = places<=0 if places and strip: places = -places strInt, strFrac = (('%.' + str(places) + 'f') % num).split('.')
strInt, strFrac = (('%.' + str(places) + 'f') % num).split('.')
strInt = ('%.' + str(places) + 'f') % num if places: strInt, strFrac = strInt.split('.') strFrac = sep + strFrac if strip: while strFrac and strFrac[-1] in ['0',sep]: strFrac = strFrac[:-1] else: strFrac = ''
def format(self, num): # positivize the numbers sign=num<0 if sign: num = -num places, sep = self.decimalPlaces, self.decimalSeparator strip = places<=0 if places and strip: places = -places strInt, strFrac = (('%.' + str(places) + 'f') % num).split('.')
if self.thousandSeparator is not None:
if self.comma is not None:
def format(self, num): # positivize the numbers sign=num<0 if sign: num = -num places, sep = self.decimalPlaces, self.decimalSeparator strip = places<=0 if places and strip: places = -places strInt, strFrac = (('%.' + str(places) + 'f') % num).split('.')
strNew = self.thousandSeparator + right + strNew
strNew = self.comma + right + strNew
def format(self, num): # positivize the numbers sign=num<0 if sign: num = -num places, sep = self.decimalPlaces, self.decimalSeparator strip = places<=0 if places and strip: places = -places strInt, strFrac = (('%.' + str(places) + 'f') % num).split('.')
strFrac = sep + strFrac if strip: while strFrac and strFrac[-1] in ['0',sep]: strFrac = strFrac[:-1]
def format(self, num): # positivize the numbers sign=num<0 if sign: num = -num places, sep = self.decimalPlaces, self.decimalSeparator strip = places<=0 if places and strip: places = -places strInt, strFrac = (('%.' + str(places) + 'f') % num).split('.')
return (NameString, AttDict, ContentList, ExtraStuff)
return (NameString, AttDict, ContentList, ExtraStuff), len(xmltext)
def parsexml0(xmltext, startingat=0, toplevel=1, # snarf in some globals strip=string.strip, split=string.split, find=string.find, entityReplacer=unEscapeContentList, #len=len, None=None #LENCDATAMARKER=LENCDATAMARKER, CDATAMARKER=CDATAMARKER ): """simple recursive descent xml parser... return (dictionary, endcharacter...
filename = os.path.splitext(self.sourceFilename)[0] + '.pdf'
if self.sourceFilename: filename = os.path.splitext(self.sourceFilename)[0] + '.pdf'
def saveAsPresentation(self): """Write the PDF document, one slide per page.""" if self.verbose: print 'saving presentation...' pageSize = (self.pageWidth, self.pageHeight) filename = os.path.splitext(self.sourceFilename)[0] + '.pdf' if self.outDir: filename = os.path.join(self.outDir,os.path.basename(filename)) if sel...
canv = canvas.Canvas(filename, pagesize = pageSize)
outfile = cStringIO.StringIO() canv = canvas.Canvas(outfile, pagesize = pageSize)
def saveAsPresentation(self): """Write the PDF document, one slide per page.""" if self.verbose: print 'saving presentation...' pageSize = (self.pageWidth, self.pageHeight) filename = os.path.splitext(self.sourceFilename)[0] + '.pdf' if self.outDir: filename = os.path.join(self.outDir,os.path.basename(filename)) if sel...
filename = os.path.splitext(self.sourceFilename)[0] + '.pdf' doc = SimpleDocTemplate(filename, pagesize=rl_config.defaultPageSize, showBoundary=0)
if self.sourceFilename : filename = os.path.splitext(self.sourceFilename)[0] + '.pdf' outfile = cStringIO.StringIO() doc = SimpleDocTemplate(outfile, pagesize=rl_config.defaultPageSize, showBoundary=0)
def saveAsHandout(self): """Write the PDF document, multiple slides per page."""
self.saveAsHandout()
return self.saveAsHandout()
def save(self): "Save the PDF document."
self.saveAsPresentation()
return self.saveAsPresentation()
def save(self): "Save the PDF document."
rawdata = open(datafilename).read()
def process(datafilename, notes=0, handout=0, cols=0, verbose=0, outDir=None): "Process one PythonPoint source file." from reportlab.tools.pythonpoint.stdparser import PPMLParser parser = PPMLParser() parser.sourceFilename = datafilename rawdata = open(datafilename).read() parser.feed(rawdata) pres = parser.getPresenta...
pres.save()
pdfcontent = pres.save()
def process(datafilename, notes=0, handout=0, cols=0, verbose=0, outDir=None): "Process one PythonPoint source file." from reportlab.tools.pythonpoint.stdparser import PPMLParser parser = PPMLParser() parser.sourceFilename = datafilename rawdata = open(datafilename).read() parser.feed(rawdata) pres = parser.getPresenta...
return pdfcontent
def process(datafilename, notes=0, handout=0, cols=0, verbose=0, outDir=None): "Process one PythonPoint source file." from reportlab.tools.pythonpoint.stdparser import PPMLParser parser = PPMLParser() parser.sourceFilename = datafilename rawdata = open(datafilename).read() parser.feed(rawdata) pres = parser.getPresenta...
self.filename = filename
self._file = self.filename = filename
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...
self._img = ImageReader(self.filename)
self._img = ImageReader(self._file) del self._file
def __getattr__(self,a): if a=='_img': from reportlab.lib.utils import ImageReader #this may raise an error self._img = ImageReader(self.filename) return self._img elif a in ('drawWidth','drawHeight','imageWidth','imageHeight'): self._setup_inner() return self.__dict__[a] raise AttributeError(a)
do_exec('mv docs/reference/*.pdf %s'%dst) do_exec('mv docs/reference/*.pdf %s'%htmldir)
do_exec('cp docs/reference/*.pdf %s' % htmldir) do_exec('mv docs/reference/*.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 -...
do_exec('mv docs/userguide/*.pdf %s'%dst) do_exec('mv docs/userguide/*.pdf %s'%htmldir)
do_exec('cp docs/userguide/*.pdf %s' % htmldir) do_exec('mv docs/userguide/*.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 -...
folder = os.path.dirname(sys.argv[0])
folder = os.path.dirname(sys.argv[0]) or os.getcwd()
def makeSuite(folder): "Build a test suite of all available test files." allTests = unittest.TestSuite() sys.path.insert(0, folder) for filename in GlobDirectoryWalker(folder, 'test_*.py'): modname = os.path.splitext(os.path.basename(filename))[0] try: module = __import__(modname) allTests.addTest(module.makeSuite())...
self.assertEquals(map(lambda x:x.text, fragList), [u'Hello ',u'\xc2\xa9',u' copyright'])
self.assertEquals(map(lambda x:x.text, fragList), [u'Hello ',u'\xa9',u' copyright'])
def testEntityUnicode(self): "Numeric entities should be unescaped by parser" txt = u"Hello &#169; copyright" fragList = ParaParser().parse(txt, self.style)[1] self.assertEquals(map(lambda x:x.text, fragList), [u'Hello ',u'\xc2\xa9',u' copyright'])
story.append(FrameBreak())
def code(txt): story.append(Preformatted(txt,styleSheet['Code'])) code('''import reportlab.rl_config reportlab.rl_config.warnOnMissingFontGlyphs = 0 from reportlab.pdfbase import pdfmetrics fontDir = os.path.join(os.path.dirname(reportlab.__file__),'fonts') face = pdfmetrics.EmbeddedType1Face(os.path.join(fontDir,'LeE...
def getCommentary(): """Returns the story for the commentary - all the paragraphs.""" styleSheet = getSampleStyleSheet() story = [] story.append(Paragraph(""" PLATYPUS User Guide and Test Script """, styleSheet['Heading1'])) spam = """ Welcome to PLATYPUS! Platypus stands for "Page Layout and Typography Using Scri...
story.append(platypus.Preformatted(code, styleSheet['Code'], dedent=4))
story.append(Preformatted(code, styleSheet['Code'], dedent=4))
def wrap(self, availWidth, availHeight): """This will be called by the enclosing frame before objects are asked their size, drawn or whatever. It returns the size actually used.""" return (self.width, self.height)
from reportlab.lib.utils import haveImages, _RL_DIR, rl_isfile, open_for_read if haveImages: gif = os.path.join(_RL_DIR,'test','pythonpowered.gif') if rl_isfile(gif): data = [] t = data.append furl = gif.replace(os.sep,'/') if sys.platform=='win32' and furl[1]==':': furl = furl[0]+'|'+furl[2:] if furl[0]!='/': furl = '...
def wrap(self, availWidth, availHeight): """This will be called by the enclosing frame before objects are asked their size, drawn or whatever. It returns the size actually used.""" return (self.width, self.height)
"""Draw an ellipse with foci at (x1,y1) (x2,y2).
"""Draw an ellipse defined by an enclosing rectangle. Note that (x1,y1) and (x2,y2) are the corner points of the enclosing rectangle.
def ellipse(self, x1, y1, x2, y2, stroke=1, fill=0): """Draw an ellipse with foci at (x1,y1) (x2,y2). Uses bezierArc, which conveniently handles 360 degrees. Special thanks to Robert Kern.""" ### XXXX above documentation is WRONG. Exactly what are (x1,y1), (x2,y2)? pointList = pdfgeom.bezierArc(x1,y1, x2,y2, 0, 360) ...