6 """ |
6 """ |
7 Module implementing a compatability interface class to QsciScintilla. |
7 Module implementing a compatability interface class to QsciScintilla. |
8 """ |
8 """ |
9 |
9 |
10 import contextlib |
10 import contextlib |
|
11 import enum |
11 |
12 |
12 from PyQt6.Qsci import QsciScintilla, QsciScintillaBase |
13 from PyQt6.Qsci import QsciScintilla, QsciScintillaBase |
13 from PyQt6.QtCore import QPoint, Qt, pyqtSignal, pyqtSlot |
14 from PyQt6.QtCore import QPoint, Qt, pyqtSignal, pyqtSlot |
14 from PyQt6.QtGui import QColor, QPalette |
15 from PyQt6.QtGui import QColor, QPalette |
15 from PyQt6.QtWidgets import QApplication, QListWidget |
16 from PyQt6.QtWidgets import QApplication, QListWidget |
|
17 |
|
18 |
|
19 class QsciScintillaPrintColorMode(enum.IntEnum): |
|
20 """ |
|
21 Class defining the various print color modes. |
|
22 """ |
|
23 |
|
24 Normal = QsciScintillaBase.SC_PRINT_NORMAL |
|
25 InvertLight = QsciScintillaBase.SC_PRINT_INVERTLIGHT |
|
26 BlackOnWhite = QsciScintillaBase.SC_PRINT_BLACKONWHITE |
|
27 ColorOnWhite = QsciScintillaBase.SC_PRINT_COLOURONWHITE |
|
28 ColorOnWhiteDefaultBackground = QsciScintillaBase.SC_PRINT_COLOURONWHITEDEFAULTBG |
|
29 ScreenColors = QsciScintillaBase.SC_PRINT_SCREENCOLOURS |
16 |
30 |
17 |
31 |
18 class QsciScintillaCompat(QsciScintilla): |
32 class QsciScintillaCompat(QsciScintilla): |
19 """ |
33 """ |
20 Class implementing a compatability interface to QsciScintilla. |
34 Class implementing a compatability interface to QsciScintilla. |
1787 @rtype tuple of (int, int) |
1801 @rtype tuple of (int, int) |
1788 """ |
1802 """ |
1789 pos = self.positionFromPoint(point) |
1803 pos = self.positionFromPoint(point) |
1790 return self.lineIndexFromPosition(pos) |
1804 return self.lineIndexFromPosition(pos) |
1791 |
1805 |
|
1806 if "setPrintColorMode" not in QsciScintilla.__dict__: |
|
1807 |
|
1808 def setPrintColorMode(self, colorMode): |
|
1809 """ |
|
1810 Public method to set the print color mode (i.e. background handling). |
|
1811 |
|
1812 @param colorMode color mode to be set |
|
1813 @type QsciScintillaPrintColorMode |
|
1814 """ |
|
1815 self.SendScintilla(QsciScintilla.SCI_SETPRINTCOLOURMODE, colorMode) |
|
1816 |
1792 |
1817 |
1793 ## ######################################################################### |
1818 ## ######################################################################### |
1794 ## ## Methods below have been added to QScintilla starting with version 2.x. |
1819 ## ## Methods below have been added to QScintilla starting with version 2.x. |
1795 ## ######################################################################### |
1820 ## ######################################################################### |
1796 ## |
1821 ## |