(self, canv)
| 881 | self.text = newtext |
| 882 | |
| 883 | def drawOn(self, canv): |
| 884 | # for a string in a section, this will be drawn several times; |
| 885 | # so any substitution into the text should be in a temporary |
| 886 | # variable |
| 887 | if self.hasInfo: |
| 888 | # provide a dictionary of stuff which might go into |
| 889 | # the string, so they can number pages, do headers |
| 890 | # etc. |
| 891 | info = {} |
| 892 | info['title'] = canv._doc.info.title |
| 893 | info['author'] = canv._doc.info.author |
| 894 | info['subject'] = canv._doc.info.subject |
| 895 | info['page'] = canv.getPageNumber() |
| 896 | drawText = self.text % info |
| 897 | else: |
| 898 | drawText = self.text |
| 899 | |
| 900 | if self.color is None: |
| 901 | return |
| 902 | lines = string.split(string.strip(drawText), '\\n') |
| 903 | canv.saveState() |
| 904 | |
| 905 | canv.setFont(self.font, self.size) |
| 906 | |
| 907 | r,g,b = checkColor(self.color) |
| 908 | canv.setFillColorRGB(r,g,b) |
| 909 | cur_y = self.y |
| 910 | for line in lines: |
| 911 | if self.align == TA_LEFT: |
| 912 | canv.drawString(self.x, cur_y, line) |
| 913 | elif self.align == TA_CENTER: |
| 914 | canv.drawCentredString(self.x, cur_y, line) |
| 915 | elif self.align == TA_RIGHT: |
| 916 | canv.drawRightString(self.x, cur_y, line) |
| 917 | cur_y = cur_y - 1.2*self.size |
| 918 | |
| 919 | canv.restoreState() |
| 920 | |
| 921 | class PPDrawing: |
| 922 | def __init__(self): |
nothing calls this directly
no test coverage detected