11 # Original code: Copyright 1998-2006 by Neil Hodgson <neilh@scintilla.org> |
11 # Original code: Copyright 1998-2006 by Neil Hodgson <neilh@scintilla.org> |
12 |
12 |
13 from PyQt6.QtGui import QFontInfo |
13 from PyQt6.QtGui import QFontInfo |
14 from PyQt6.Qsci import QsciScintilla |
14 from PyQt6.Qsci import QsciScintilla |
15 |
15 |
16 from E5Gui import E5MessageBox |
16 from E5Gui import EricMessageBox |
17 from E5Gui.E5OverrideCursor import E5OverrideCursor |
17 from E5Gui.EricOverrideCursor import EricOverrideCursor |
18 |
18 |
19 from .ExporterBase import ExporterBase |
19 from .ExporterBase import ExporterBase |
20 |
20 |
21 import Preferences |
21 import Preferences |
22 |
22 |
554 if fontSize > 0: |
554 if fontSize > 0: |
555 self.pr.fontSize += fontSize |
555 self.pr.fontSize += fontSize |
556 else: |
556 else: |
557 self.pr.fontSize = PDF_FONTSIZE_DEFAULT |
557 self.pr.fontSize = PDF_FONTSIZE_DEFAULT |
558 |
558 |
559 with E5OverrideCursor(), open(filename, "w", encoding="cp1250", |
559 with EricOverrideCursor(), open(filename, "w", encoding="cp1250", |
560 errors="backslashreplace") as f: |
560 errors="backslashreplace") as f: |
561 # save file in win ansi using cp1250 |
561 # save file in win ansi using cp1250 |
562 try: |
562 try: |
563 # initialise PDF rendering |
563 # initialise PDF rendering |
564 ot = PDFObjectTracker(f) |
564 ot = PDFObjectTracker(f) |
623 pos += 1 |
623 pos += 1 |
624 |
624 |
625 # write required stuff and close the PDF file |
625 # write required stuff and close the PDF file |
626 self.pr.endPDF() |
626 self.pr.endPDF() |
627 except OSError as err: |
627 except OSError as err: |
628 E5MessageBox.critical( |
628 EricMessageBox.critical( |
629 self.editor, |
629 self.editor, |
630 self.tr("Export source"), |
630 self.tr("Export source"), |
631 self.tr( |
631 self.tr( |
632 """<p>The source could not be exported to""" |
632 """<p>The source could not be exported to""" |
633 """ <b>{0}</b>.</p><p>Reason: {1}</p>""") |
633 """ <b>{0}</b>.</p><p>Reason: {1}</p>""") |