src/eric7/QScintilla/Exporters/ExporterPDF.py

branch
eric7
changeset 9487
78cb053591c9
parent 9473
3f23dbf37dbe
child 9500
5771348ded12
equal deleted inserted replaced
9486:5a8179763e38 9487:78cb053591c9
9 9
10 # This code is a port of the C++ code found in SciTE 1.74 10 # This code is a port of the C++ code found in SciTE 1.74
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.Qsci import QsciScintilla 13 from PyQt6.Qsci import QsciScintilla
14 from PyQt6.QtGui import QFontInfo 14 from PyQt6.QtGui import QColor, QFontInfo
15 15
16 from eric7 import Preferences 16 from eric7 import Preferences
17 from eric7.EricGui.EricOverrideCursor import EricOverrideCursor 17 from eric7.EricGui.EricOverrideCursor import EricOverrideCursor
18 from eric7.EricWidgets import EricMessageBox 18 from eric7.EricWidgets import EricMessageBox
19 19
511 style.font |= 2 511 style.font |= 2
512 if font.bold(): 512 if font.bold():
513 style.font |= 1 513 style.font |= 1
514 514
515 colour = lex.color(istyle) 515 colour = lex.color(istyle)
516 if colour.name() == "#ffffff":
517 # map white to black for readability on paper
518 colour = QColor("#000000")
516 style.fore = self.__getPDFRGB(colour) 519 style.fore = self.__getPDFRGB(colour)
517 self.pr.style[istyle] = style 520 self.pr.style[istyle] = style
518 521
519 # get substyles 522 # get substyles
520 subs_start, subs_count = self.editor.getSubStyleRange(istyle) 523 subs_start, subs_count = self.editor.getSubStyleRange(istyle)
633 self.tr( 636 self.tr(
634 """<p>The source could not be exported to""" 637 """<p>The source could not be exported to"""
635 """ <b>{0}</b>.</p><p>Reason: {1}</p>""" 638 """ <b>{0}</b>.</p><p>Reason: {1}</p>"""
636 ).format(filename, str(err)), 639 ).format(filename, str(err)),
637 ) 640 )
641
642
643 def createExporter(editor, parent=None):
644 """
645 Function to instantiate an exporter object.
646
647 @param editor reference to the editor object
648 @type QScintilla.Editor.Editor
649 @param parent parent object of the exporter (defaults to None)
650 @type QObject (optional)
651 @return exporter object
652 @rtype ExporterPDF
653 """
654 return ExporterPDF(editor, parent=parent)

eric ide

mercurial