11 from PyQt4.QtGui import * |
11 from PyQt4.QtGui import * |
12 from PyQt4.Qsci import QsciPrinter |
12 from PyQt4.Qsci import QsciPrinter |
13 |
13 |
14 import Preferences |
14 import Preferences |
15 |
15 |
|
16 |
16 class Printer(QsciPrinter): |
17 class Printer(QsciPrinter): |
17 """ |
18 """ |
18 Class implementing the QextScintillaPrinter with a header. |
19 Class implementing the QextScintillaPrinter with a header. |
19 """ |
20 """ |
20 def __init__(self, mode = QPrinter.ScreenResolution): |
21 def __init__(self, mode=QPrinter.ScreenResolution): |
21 """ |
22 """ |
22 Constructor |
23 Constructor |
23 |
24 |
24 @param mode mode of the printer (QPrinter.PrinterMode) |
25 @param mode mode of the printer (QPrinter.PrinterMode) |
25 """ |
26 """ |
48 @param area the drawing area (QRect) |
49 @param area the drawing area (QRect) |
49 @param pagenr the page number (int) |
50 @param pagenr the page number (int) |
50 """ |
51 """ |
51 fn = self.docName() |
52 fn = self.docName() |
52 |
53 |
53 header = QApplication.translate('Printer', |
54 header = QApplication.translate('Printer', |
54 '{0} - Printed on {1}, {2} - Page {3}')\ |
55 '{0} - Printed on {1}, {2} - Page {3}')\ |
55 .format(fn, self.date, self.time, pagenr) |
56 .format(fn, self.date, self.time, pagenr) |
56 |
57 |
57 painter.save() |
58 painter.save() |
58 painter.setFont(self.headerFont) # set our header font |
59 painter.setFont(self.headerFont) # set our header font |