def printout(self, filepath=None, pages=None): """Print the selected pages ('None' => all pages !). If filepath is given the output will be to a file, otherwise the default printer. #Or should I use the print dialog? """ printer = Printer(filename=filepath) first = True # to control 'newPage' npages = len(self.pages) # total number of pages if (pages == None): pages = range(1, npages + 1) for pn in pages: p = self.pages[pn - 1] # add header/footer (class, subject, ...) text = u"%s - %s (%s)" % (argSub( _("Class %1"), (self.className, )), self.subjectName, argSub(_("page %1 of %2"), (unicode(pn), unicode(npages)))) ti = TextItem(p, text) ti.setFont(self.titleFont) ti.setPos(XTITLE, YTITLE - self.titleSpace) LineH(p, XTITLE, 0.0, self.titleFont.getWidth(text), UNDERLINEWIDTH, getColour(u"#606060")) if not first: printer.newPage() printer.render(p.gScene) first = False printer.end()
def markSpellingError(self): self.spellItem = LineH(self.canvas, self.x, self.tline.yReal + self.tline.height, self.getWidth(), SPELLTHICKNESS, colours("spell"))