src/eric7/QScintilla/QsciScintillaCompat.py

Sat, 13 Jan 2024 12:57:48 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 13 Jan 2024 12:57:48 +0100
branch
eric7
changeset 10497
0d7f1c8cd219
parent 10439
21c28b0f9e41
child 10876
ec224611090e
permissions
-rw-r--r--

Corrected a typo.

0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
10439
21c28b0f9e41 Updated copyright for 2024.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10431
diff changeset
3 # Copyright (c) 2004 - 2024 Detlev Offenbach <detlev@die-offenbachs.de>
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a compatability interface class to QsciScintilla.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
8243
cc717c2ae956 Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8218
diff changeset
10 import contextlib
10244
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
11 import enum
8243
cc717c2ae956 Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8218
diff changeset
12
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
13 from PyQt6.Qsci import QsciScintilla, QsciScintillaBase
10069
435cc5875135 Corrected and checked some code style issues (unused function arguments).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9977
diff changeset
14 from PyQt6.QtCore import QPoint, Qt, pyqtSignal, pyqtSlot
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
15 from PyQt6.QtGui import QColor, QPalette
8489
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
16 from PyQt6.QtWidgets import QApplication, QListWidget
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
18
10244
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
19 class QsciScintillaPrintColorMode(enum.IntEnum):
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
20 """
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
21 Class defining the various print color modes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
22 """
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
23
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
24 Normal = QsciScintillaBase.SC_PRINT_NORMAL
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
25 InvertLight = QsciScintillaBase.SC_PRINT_INVERTLIGHT
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
26 BlackOnWhite = QsciScintillaBase.SC_PRINT_BLACKONWHITE
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
27 ColorOnWhite = QsciScintillaBase.SC_PRINT_COLOURONWHITE
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
28 ColorOnWhiteDefaultBackground = QsciScintillaBase.SC_PRINT_COLOURONWHITEDEFAULTBG
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
29 ScreenColors = QsciScintillaBase.SC_PRINT_SCREENCOLOURS
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
30
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
31
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 class QsciScintillaCompat(QsciScintilla):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 Class implementing a compatability interface to QsciScintilla.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
35
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 This class implements all the functions, that were added to
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 QsciScintilla incrementally. This class ensures compatibility
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 to older versions of QsciScintilla.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
39
2347
a4a4d710ebe8 Fixed the feedback of a changed zoom value from the editors, shell or terminal to the view manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
40 @signal zoomValueChanged(int) emitted to signal a change of the zoom value
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
42
2347
a4a4d710ebe8 Fixed the feedback of a changed zoom value from the editors, shell or terminal to the view manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
43 zoomValueChanged = pyqtSignal(int)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
44
8318
962bce857696 Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8312
diff changeset
45 ArrowFoldStyle = QsciScintilla.FoldStyle.BoxedTreeFoldStyle.value + 1
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
46 ArrowTreeFoldStyle = ArrowFoldStyle + 1
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
47
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
48 UserSeparator = "\x04"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
49
7746
12d5e1e6abd1 QScintilla: pushed required QScintilla version to 2.11.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7639
diff changeset
50 IndicatorStyleMax = QsciScintilla.INDIC_GRADIENTCENTRE
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
51
8324
83084f088655 Continued porting eric to PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
52 # Maps PyQt6.QFont.Weight to the weights used by QScintilla
83084f088655 Continued porting eric to PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
53 QFontWeightMapping = {
83084f088655 Continued porting eric to PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
54 100: 0,
83084f088655 Continued porting eric to PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
55 200: 12,
83084f088655 Continued porting eric to PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
56 300: 25,
83084f088655 Continued porting eric to PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
57 400: 50,
83084f088655 Continued porting eric to PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
58 500: 57,
83084f088655 Continued porting eric to PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
59 600: 63,
83084f088655 Continued porting eric to PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
60 700: 75,
83084f088655 Continued porting eric to PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
61 800: 81,
83084f088655 Continued porting eric to PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
62 900: 87,
83084f088655 Continued porting eric to PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
63 }
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
64
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
65 def __init__(self, parent=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 Constructor
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
68
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
69 @param parent parent widget
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
70 @type QWidget
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 """
8218
7c09585bd960 Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8143
diff changeset
72 super().__init__(parent)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
73
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 self.zoom = 0
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
75
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 self.__targetSearchFlags = 0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 self.__targetSearchExpr = ""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 self.__targetSearchStart = 0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 self.__targetSearchEnd = -1
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80 self.__targetSearchActive = False
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
81
3393
080ace4829b4 Extended QsciScintillaCompat to allow to set the modified status and made the selection of an encoding in the editor change the modified state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3390
diff changeset
82 self.__modified = False
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
83
10346
96b387d43981 Corrected a glitch in 'QsciScintillaCompat.py'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10257
diff changeset
84 self.userListActivated.connect(self.__userListActivated)
3393
080ace4829b4 Extended QsciScintillaCompat to allow to set the modified status and made the selection of an encoding in the editor change the modified state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3390
diff changeset
85 self.modificationChanged.connect(self.__modificationChanged)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
86
8481
02865597d820 QsciScintillaCompat: fixed an issue causing completion lists to go off-screen.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8437
diff changeset
87 self.setAutoCompletionWidgetSize(40, 5)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
88
3393
080ace4829b4 Extended QsciScintillaCompat to allow to set the modified status and made the selection of an encoding in the editor change the modified state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3390
diff changeset
89 def __modificationChanged(self, m):
080ace4829b4 Extended QsciScintillaCompat to allow to set the modified status and made the selection of an encoding in the editor change the modified state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3390
diff changeset
90 """
080ace4829b4 Extended QsciScintillaCompat to allow to set the modified status and made the selection of an encoding in the editor change the modified state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3390
diff changeset
91 Private slot to handle the modificationChanged signal.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
92
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
93 @param m modification status
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
94 @type bool
3393
080ace4829b4 Extended QsciScintillaCompat to allow to set the modified status and made the selection of an encoding in the editor change the modified state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3390
diff changeset
95 """
080ace4829b4 Extended QsciScintillaCompat to allow to set the modified status and made the selection of an encoding in the editor change the modified state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3390
diff changeset
96 self.__modified = m
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
97
3393
080ace4829b4 Extended QsciScintillaCompat to allow to set the modified status and made the selection of an encoding in the editor change the modified state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3390
diff changeset
98 def isModified(self):
080ace4829b4 Extended QsciScintillaCompat to allow to set the modified status and made the selection of an encoding in the editor change the modified state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3390
diff changeset
99 """
080ace4829b4 Extended QsciScintillaCompat to allow to set the modified status and made the selection of an encoding in the editor change the modified state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3390
diff changeset
100 Public method to return the modification status.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
101
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
102 @return flag indicating the modification status
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
103 @rtype bool
3393
080ace4829b4 Extended QsciScintillaCompat to allow to set the modified status and made the selection of an encoding in the editor change the modified state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3390
diff changeset
104 """
080ace4829b4 Extended QsciScintillaCompat to allow to set the modified status and made the selection of an encoding in the editor change the modified state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3390
diff changeset
105 return self.__modified
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
106
3393
080ace4829b4 Extended QsciScintillaCompat to allow to set the modified status and made the selection of an encoding in the editor change the modified state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3390
diff changeset
107 def setModified(self, m):
080ace4829b4 Extended QsciScintillaCompat to allow to set the modified status and made the selection of an encoding in the editor change the modified state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3390
diff changeset
108 """
080ace4829b4 Extended QsciScintillaCompat to allow to set the modified status and made the selection of an encoding in the editor change the modified state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3390
diff changeset
109 Public slot to set the modification status.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
110
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
111 @param m new modification status
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
112 @type bool
3393
080ace4829b4 Extended QsciScintillaCompat to allow to set the modified status and made the selection of an encoding in the editor change the modified state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3390
diff changeset
113 """
080ace4829b4 Extended QsciScintillaCompat to allow to set the modified status and made the selection of an encoding in the editor change the modified state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3390
diff changeset
114 self.__modified = m
8218
7c09585bd960 Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8143
diff changeset
115 super().setModified(m)
3393
080ace4829b4 Extended QsciScintillaCompat to allow to set the modified status and made the selection of an encoding in the editor change the modified state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3390
diff changeset
116 self.modificationChanged.emit(m)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
117
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
118 def setLexer(self, lex=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120 Public method to set the lexer.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
121
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
122 @param lex lexer to be set or None to reset it.
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
123 @type QsciScintilla.QLexer
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124 """
8218
7c09585bd960 Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8143
diff changeset
125 super().setLexer(lex)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 if lex is None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127 self.clearStyles()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
128
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 def clearStyles(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
131 Public method to set the styles according the selected Qt style.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132 """
2084
d3f083dd0222 Made the fiveth set of Qt5 compatibility changes (some of the previous changes are backed out due to changes in PyQt4).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2077
diff changeset
133 palette = QApplication.palette()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
134 self.SendScintilla(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
135 QsciScintilla.SCI_STYLESETFORE,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
136 QsciScintilla.STYLE_DEFAULT,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
137 palette.color(QPalette.ColorRole.Text),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
138 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
139 self.SendScintilla(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
140 QsciScintilla.SCI_STYLESETBACK,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
141 QsciScintilla.STYLE_DEFAULT,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
142 palette.color(QPalette.ColorRole.Base),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
143 )
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144 self.SendScintilla(QsciScintilla.SCI_STYLECLEARALL)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145 self.SendScintilla(QsciScintilla.SCI_CLEARDOCUMENTSTYLE)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
146
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147 def monospacedStyles(self, font):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149 Public method to set the current style to be monospaced.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
150
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
151 @param font font to be used
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
152 @type QFont
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
153 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
154 try:
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
155 rangeLow = list(range(self.STYLE_DEFAULT))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
156 except AttributeError:
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
157 rangeLow = list(range(32))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 try:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
159 rangeHigh = list(range(self.STYLE_LASTPREDEFINED + 1, self.STYLE_MAX + 1))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160 except AttributeError:
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
161 rangeHigh = list(range(40, 128))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
162
4331
711e7c35a49b Changed code to make eric compatible to PyQt 5.5 (QByteArry issue).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4253
diff changeset
163 f = font.family().encode("utf-8")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164 ps = font.pointSize()
8324
83084f088655 Continued porting eric to PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
165 weight = -QsciScintillaCompat.QFontWeightMapping[font.weight()]
2472
4860fe0ed4a6 Extended the editor monospaced style to allow to set the weight, italic and underline properties.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2347
diff changeset
166 italic = font.italic()
4860fe0ed4a6 Extended the editor monospaced style to allow to set the weight, italic and underline properties.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2347
diff changeset
167 underline = font.underline()
2564
3eb07bb2afd4 Fixed an issue in QsciScintillaCompat setting monospaced styles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2537
diff changeset
168 bold = font.bold()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169 for style in rangeLow + rangeHigh:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
170 self.SendScintilla(QsciScintilla.SCI_STYLESETFONT, style, f)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
171 self.SendScintilla(QsciScintilla.SCI_STYLESETSIZE, style, ps)
2564
3eb07bb2afd4 Fixed an issue in QsciScintillaCompat setting monospaced styles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2537
diff changeset
172 try:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
173 self.SendScintilla(QsciScintilla.SCI_STYLESETWEIGHT, style, weight)
2564
3eb07bb2afd4 Fixed an issue in QsciScintillaCompat setting monospaced styles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2537
diff changeset
174 except AttributeError:
3eb07bb2afd4 Fixed an issue in QsciScintillaCompat setting monospaced styles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2537
diff changeset
175 self.SendScintilla(QsciScintilla.SCI_STYLESETBOLD, style, bold)
2537
0ff250733d45 Fixed a few PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2472
diff changeset
176 self.SendScintilla(QsciScintilla.SCI_STYLESETITALIC, style, italic)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
177 self.SendScintilla(QsciScintilla.SCI_STYLESETUNDERLINE, style, underline)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
178
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
179 def linesOnScreen(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
180 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
181 Public method to get the amount of visible lines.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
182
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
183 @return amount of visible lines
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
184 @rtype int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
185 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
186 return self.SendScintilla(QsciScintilla.SCI_LINESONSCREEN)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
187
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
188 def lineAt(self, pos):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
190 Public method to calculate the line at a position.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
191
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
192 This variant is able to calculate the line for positions in the
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
193 margins and for empty lines.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
194
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
195 @param pos position to calculate the line for
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
196 @type int or QPoint
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
197 @return linenumber at position or -1, if there is no line at pos (zero based)
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
198 @rtype int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
199 """
8260
2161475d9639 Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8243
diff changeset
200 scipos = (
2161475d9639 Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8243
diff changeset
201 pos
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
202 if isinstance(pos, int)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
203 else self.SendScintilla(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
204 QsciScintilla.SCI_POSITIONFROMPOINT, pos.x(), pos.y()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
205 )
8260
2161475d9639 Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8243
diff changeset
206 )
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
207 line = self.SendScintilla(QsciScintilla.SCI_LINEFROMPOSITION, scipos)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208 if line >= self.lines():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
209 line = -1
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
210 return line
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
211
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
212 def currentPosition(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
213 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
214 Public method to get the current position.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
215
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
216 @return absolute position of the cursor
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
217 @rtype int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
218 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
219 return self.SendScintilla(QsciScintilla.SCI_GETCURRENTPOS)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
220
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
221 def styleAt(self, pos):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
222 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
223 Public method to get the style at a position in the text.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
224
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
225 @param pos position in the text
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
226 @type int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
227 @return style at the requested position or 0, if the position
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
228 is negative or past the end of the document
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
229 @rtype int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
230 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
231 return self.SendScintilla(QsciScintilla.SCI_GETSTYLEAT, pos)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
232
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
233 def currentStyle(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
234 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
235 Public method to get the style at the current position.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
236
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
237 @return style at the current position
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
238 @rtype int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
239 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
240 return self.styleAt(self.currentPosition())
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
241
7949
17c0a4ec3cf0 Fixed export as HTML+ODT/PDF/RTF/TEX when text using substyles.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 7923
diff changeset
242 def getSubStyleRange(self, styleNr):
17c0a4ec3cf0 Fixed export as HTML+ODT/PDF/RTF/TEX when text using substyles.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 7923
diff changeset
243 """
17c0a4ec3cf0 Fixed export as HTML+ODT/PDF/RTF/TEX when text using substyles.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 7923
diff changeset
244 Public method to get the sub style range for given style number.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
245
7949
17c0a4ec3cf0 Fixed export as HTML+ODT/PDF/RTF/TEX when text using substyles.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 7923
diff changeset
246 @param styleNr Number of the base style
17c0a4ec3cf0 Fixed export as HTML+ODT/PDF/RTF/TEX when text using substyles.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 7923
diff changeset
247 @type int
17c0a4ec3cf0 Fixed export as HTML+ODT/PDF/RTF/TEX when text using substyles.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 7923
diff changeset
248 @return start index of the sub style and their count
17c0a4ec3cf0 Fixed export as HTML+ODT/PDF/RTF/TEX when text using substyles.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 7923
diff changeset
249 @rtype int, int
17c0a4ec3cf0 Fixed export as HTML+ODT/PDF/RTF/TEX when text using substyles.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 7923
diff changeset
250 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
251 start = self.SendScintilla(QsciScintilla.SCI_GETSUBSTYLESSTART, styleNr)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
252 count = self.SendScintilla(QsciScintilla.SCI_GETSUBSTYLESLENGTH, styleNr)
7949
17c0a4ec3cf0 Fixed export as HTML+ODT/PDF/RTF/TEX when text using substyles.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 7923
diff changeset
253 return start, count
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
254
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
255 def getEndStyled(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
256 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
257 Public method to get the last styled position.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
258
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
259 @return end position of the last styling run
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
260 @rtype int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
261 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
262 return self.SendScintilla(QsciScintilla.SCI_GETENDSTYLED)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
263
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
264 def startStyling(self, pos, mask):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
265 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
266 Public method to prepare styling.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
267
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
268 @param pos styling positition to start at
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
269 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
270 @param mask mask of bits to use for styling
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
271 @type int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
272 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
273 self.SendScintilla(QsciScintilla.SCI_STARTSTYLING, pos, mask)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
274
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
275 def setStyling(self, length, style):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
276 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
277 Public method to style some text.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
278
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
279 @param length length of text to style
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
280 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
281 @param style style to set for text
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
282 @type int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
283 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
284 self.SendScintilla(QsciScintilla.SCI_SETSTYLING, length, style)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
285
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
286 def charAt(self, pos):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
287 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
288 Public method to get the character at a position in the text observing
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289 multibyte characters.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
290
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
291 @param pos position in the text
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
292 @type int
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
293 @return character at the requested position or empty string, if the
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
294 position is negative or past the end of the document
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
295 @rtype str
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296 """
25
5163e6f94ba5 Ported the exporters to Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
297 ch = self.byteAt(pos)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
298 if ch and ord(ch) > 127 and self.isUtf8():
25
5163e6f94ba5 Ported the exporters to Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
299 if (ch[0] & 0xF0) == 0xF0:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
300 utf8Len = 4
25
5163e6f94ba5 Ported the exporters to Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
301 elif (ch[0] & 0xE0) == 0xE0:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
302 utf8Len = 3
25
5163e6f94ba5 Ported the exporters to Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
303 elif (ch[0] & 0xC0) == 0xC0:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
304 utf8Len = 2
3493
71f15675e89f Fixed an issue in QsciScintillaCompat.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3393
diff changeset
305 else:
71f15675e89f Fixed an issue in QsciScintillaCompat.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3393
diff changeset
306 utf8Len = 1
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
307 while len(ch) < utf8Len:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
308 pos += 1
25
5163e6f94ba5 Ported the exporters to Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
309 ch += self.byteAt(pos)
3933
16d9ef6e6e89 Extended code to get a single chracter in the editor to be more robust.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
310 try:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
311 return ch.decode("utf8")
3933
16d9ef6e6e89 Extended code to get a single chracter in the editor to be more robust.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
312 except UnicodeDecodeError:
16d9ef6e6e89 Extended code to get a single chracter in the editor to be more robust.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
313 if pos > 0:
16d9ef6e6e89 Extended code to get a single chracter in the editor to be more robust.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
314 # try it one position before; maybe we are in the
16d9ef6e6e89 Extended code to get a single chracter in the editor to be more robust.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
315 # middle of a unicode character
16d9ef6e6e89 Extended code to get a single chracter in the editor to be more robust.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
316 return self.charAt(pos - 1)
16d9ef6e6e89 Extended code to get a single chracter in the editor to be more robust.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
317 else:
16d9ef6e6e89 Extended code to get a single chracter in the editor to be more robust.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
318 return ""
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
319 else:
25
5163e6f94ba5 Ported the exporters to Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
320 return ch.decode()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
321
25
5163e6f94ba5 Ported the exporters to Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
322 def byteAt(self, pos):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
323 """
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
324 Public method to get the raw character (bytes) at a position in the
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
325 text.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
326
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
327 @param pos position in the text
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
328 @type int
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
329 @return raw character at the requested position or empty bytes, if the
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
330 position is negative or past the end of the document
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
331 @rtype bytes
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
332 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
333 char = self.SendScintilla(QsciScintilla.SCI_GETCHARAT, pos)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
334 if char == 0:
2684
b1d8db9a31bc Fix for the PDF exporter.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2677
diff changeset
335 return bytearray()
25
5163e6f94ba5 Ported the exporters to Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
336 if char < 0:
5163e6f94ba5 Ported the exporters to Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
337 char += 256
2684
b1d8db9a31bc Fix for the PDF exporter.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2677
diff changeset
338 return bytearray((char,))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
339
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
340 def foldLevelAt(self, line):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
341 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
342 Public method to get the fold level of a line of the document.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
343
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
344 @param line line number
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
345 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
346 @return fold level of the given line
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
347 @rtype int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
348 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
349 lvl = self.SendScintilla(QsciScintilla.SCI_GETFOLDLEVEL, line)
7267
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
350 return (
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
351 lvl & QsciScintilla.SC_FOLDLEVELNUMBERMASK
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
352 ) - QsciScintilla.SC_FOLDLEVELBASE
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
353
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
354 def foldFlagsAt(self, line):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
355 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
356 Public method to get the fold flags of a line of the document.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
357
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
358 @param line line number
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
359 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
360 @return fold flags of the given line
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
361 @rtype int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
362 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
363 lvl = self.SendScintilla(QsciScintilla.SCI_GETFOLDLEVEL, line)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
364 return lvl & ~QsciScintilla.SC_FOLDLEVELNUMBERMASK
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
365
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
366 def foldHeaderAt(self, line):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
367 """
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
368 Public method to determine, if a line of the document is a fold header
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
369 line.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
370
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
371 @param line line number
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
372 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
373 @return flag indicating a fold header line
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
374 @rtype bool
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
375 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
376 lvl = self.SendScintilla(QsciScintilla.SCI_GETFOLDLEVEL, line)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
377 return lvl & QsciScintilla.SC_FOLDLEVELHEADERFLAG
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
378
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
379 def foldExpandedAt(self, line):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
380 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
381 Public method to determine, if a fold is expanded.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
382
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
383 @param line line number
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
384 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
385 @return flag indicating the fold expansion state of the line
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
386 @rtype bool
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
387 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
388 return self.SendScintilla(QsciScintilla.SCI_GETFOLDEXPANDED, line)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
389
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
390 def setIndentationGuideView(self, view):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
391 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
392 Public method to set the view of the indentation guides.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
393
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
394 @param view view of the indentation guides (SC_IV_NONE, SC_IV_REAL,
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
395 SC_IV_LOOKFORWARD or SC_IV_LOOKBOTH)
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
396 @type int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
397 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
398 self.SendScintilla(QsciScintilla.SCI_SETINDENTATIONGUIDES, view)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
399
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
400 def indentationGuideView(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
401 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
402 Public method to get the indentation guide view.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
403
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
404 @return indentation guide view (SC_IV_NONE, SC_IV_REAL,
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
405 SC_IV_LOOKFORWARD or SC_IV_LOOKBOTH)
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
406 @rtype int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
407 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
408 return self.SendScintilla(QsciScintilla.SCI_GETINDENTATIONGUIDES)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
409
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
410 ###########################################################################
2659
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2658
diff changeset
411 ## methods below are missing from QScintilla
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
412 ###########################################################################
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
413
8481
02865597d820 QsciScintillaCompat: fixed an issue causing completion lists to go off-screen.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8437
diff changeset
414 def setAutoCompletionWidgetSize(self, chars, lines):
02865597d820 QsciScintillaCompat: fixed an issue causing completion lists to go off-screen.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8437
diff changeset
415 """
02865597d820 QsciScintillaCompat: fixed an issue causing completion lists to go off-screen.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8437
diff changeset
416 Public method to set the size of completion and user lists.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
417
8481
02865597d820 QsciScintillaCompat: fixed an issue causing completion lists to go off-screen.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8437
diff changeset
418 @param chars max. number of chars to show
02865597d820 QsciScintillaCompat: fixed an issue causing completion lists to go off-screen.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8437
diff changeset
419 @type int
02865597d820 QsciScintillaCompat: fixed an issue causing completion lists to go off-screen.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8437
diff changeset
420 @param lines max. number of lines to show
02865597d820 QsciScintillaCompat: fixed an issue causing completion lists to go off-screen.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8437
diff changeset
421 @type int
02865597d820 QsciScintillaCompat: fixed an issue causing completion lists to go off-screen.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8437
diff changeset
422 """
02865597d820 QsciScintillaCompat: fixed an issue causing completion lists to go off-screen.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8437
diff changeset
423 self.SendScintilla(QsciScintilla.SCI_AUTOCSETMAXWIDTH, chars)
02865597d820 QsciScintillaCompat: fixed an issue causing completion lists to go off-screen.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8437
diff changeset
424 self.SendScintilla(QsciScintilla.SCI_AUTOCSETMAXHEIGHT, lines)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
425
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
426 def zoomIn(self, zoom=1):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
427 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
428 Public method used to increase the zoom factor.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
429
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
430 @param zoom zoom factor increment
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
431 @type int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
432 """
8218
7c09585bd960 Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8143
diff changeset
433 super().zoomIn(zoom)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
434
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
435 def zoomOut(self, zoom=1):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
436 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
437 Public method used to decrease the zoom factor.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
438
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
439 @param zoom zoom factor decrement
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
440 @type int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
441 """
8218
7c09585bd960 Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8143
diff changeset
442 super().zoomOut(zoom)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
443
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
444 def zoomTo(self, zoom):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
445 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
446 Public method used to zoom to a specific zoom factor.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
447
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
448 @param zoom zoom factor
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
449 @type int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
450 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
451 self.zoom = zoom
8218
7c09585bd960 Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8143
diff changeset
452 super().zoomTo(zoom)
2347
a4a4d710ebe8 Fixed the feedback of a changed zoom value from the editors, shell or terminal to the view manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
453 self.zoomValueChanged.emit(self.zoom)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
454
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
455 def getZoom(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
456 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
457 Public method used to retrieve the current zoom factor.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
458
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
459 @return zoom factor
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
460 @rtype int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
461 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
462 return self.zoom
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
463
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
464 def editorCommand(self, cmd):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
465 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
466 Public method to perform a simple editor command.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
467
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
468 @param cmd the scintilla command to be performed
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
469 @type int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
470 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
471 self.SendScintilla(cmd)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
472
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
473 def scrollVertical(self, lines):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
474 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
475 Public method to scroll the text area.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
476
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
477 @param lines number of lines to scroll (negative scrolls up,
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
478 positive scrolls down)
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
479 @type int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
480 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
481 self.SendScintilla(QsciScintilla.SCI_LINESCROLL, 0, lines)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
482
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
483 def moveCursorToEOL(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
484 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
485 Public method to move the cursor to the end of line.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
486 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
487 self.SendScintilla(QsciScintilla.SCI_LINEEND)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
488
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
489 def moveCursorLeft(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
490 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
491 Public method to move the cursor left.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
492 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
493 self.SendScintilla(QsciScintilla.SCI_CHARLEFT)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
494
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
495 def moveCursorRight(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
496 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
497 Public method to move the cursor right.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
498 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
499 self.SendScintilla(QsciScintilla.SCI_CHARRIGHT)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
500
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
501 def moveCursorWordLeft(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
502 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
503 Public method to move the cursor left one word.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
504 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
505 self.SendScintilla(QsciScintilla.SCI_WORDLEFT)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
506
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
507 def moveCursorWordRight(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
508 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
509 Public method to move the cursor right one word.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
510 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
511 self.SendScintilla(QsciScintilla.SCI_WORDRIGHT)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
512
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
513 def newLineBelow(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
514 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
515 Public method to insert a new line below the current one.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
516 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
517 self.SendScintilla(QsciScintilla.SCI_LINEEND)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
518 self.SendScintilla(QsciScintilla.SCI_NEWLINE)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
519
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
520 def deleteBack(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
521 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
522 Public method to delete the character to the left of the cursor.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
523 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
524 self.SendScintilla(QsciScintilla.SCI_DELETEBACK)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
525
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
526 def delete(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
527 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
528 Public method to delete the character to the right of the cursor.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
529 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
530 self.SendScintilla(QsciScintilla.SCI_CLEAR)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
531
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
532 def deleteWordLeft(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
533 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
534 Public method to delete the word to the left of the cursor.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
535 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
536 self.SendScintilla(QsciScintilla.SCI_DELWORDLEFT)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
537
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
538 def deleteWordRight(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
539 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
540 Public method to delete the word to the right of the cursor.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
541 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
542 self.SendScintilla(QsciScintilla.SCI_DELWORDRIGHT)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
543
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
544 def deleteLineLeft(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
545 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
546 Public method to delete the line to the left of the cursor.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
547 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
548 self.SendScintilla(QsciScintilla.SCI_DELLINELEFT)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
549
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
550 def deleteLineRight(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
551 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
552 Public method to delete the line to the right of the cursor.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
553 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
554 self.SendScintilla(QsciScintilla.SCI_DELLINERIGHT)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
555
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
556 def extendSelectionLeft(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
557 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
558 Public method to extend the selection one character to the left.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
559 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
560 self.SendScintilla(QsciScintilla.SCI_CHARLEFTEXTEND)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
561
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
562 def extendSelectionRight(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
563 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
564 Public method to extend the selection one character to the right.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
565 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
566 self.SendScintilla(QsciScintilla.SCI_CHARRIGHTEXTEND)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
567
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
568 def extendSelectionWordLeft(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
569 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
570 Public method to extend the selection one word to the left.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
571 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
572 self.SendScintilla(QsciScintilla.SCI_WORDLEFTEXTEND)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
573
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
574 def extendSelectionWordRight(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
575 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
576 Public method to extend the selection one word to the right.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
577 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
578 self.SendScintilla(QsciScintilla.SCI_WORDRIGHTEXTEND)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
579
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
580 def extendSelectionToBOL(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
581 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
582 Public method to extend the selection to the beginning of the line.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
583 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
584 self.SendScintilla(QsciScintilla.SCI_VCHOMEEXTEND)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
585
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
586 def extendSelectionToEOL(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
587 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
588 Public method to extend the selection to the end of the line.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
589 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
590 self.SendScintilla(QsciScintilla.SCI_LINEENDEXTEND)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
591
2593
a2df0adce985 Added entires to convert the selection to upper/lower case to the edit menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2589
diff changeset
592 def hasSelection(self):
a2df0adce985 Added entires to convert the selection to upper/lower case to the edit menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2589
diff changeset
593 """
a2df0adce985 Added entires to convert the selection to upper/lower case to the edit menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2589
diff changeset
594 Public method to check for a selection.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
595
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
596 @return flag indicating the presence of a selection
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
597 @rtype bool
2593
a2df0adce985 Added entires to convert the selection to upper/lower case to the edit menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2589
diff changeset
598 """
a2df0adce985 Added entires to convert the selection to upper/lower case to the edit menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2589
diff changeset
599 return self.getSelection()[0] != -1
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
600
3164
a027fc190f82 Fixed a bug creating a project from a repository and implemented a bugfix method for an issue in QsciScintilla.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
601 def hasSelectedText(self):
a027fc190f82 Fixed a bug creating a project from a repository and implemented a bugfix method for an issue in QsciScintilla.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
602 """
a027fc190f82 Fixed a bug creating a project from a repository and implemented a bugfix method for an issue in QsciScintilla.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
603 Public method to indicate the presence of selected text.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
604
3164
a027fc190f82 Fixed a bug creating a project from a repository and implemented a bugfix method for an issue in QsciScintilla.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
605 This is an overriding method to cope with a bug in QsciScintilla.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
606
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
607 @return flag indicating the presence of selected text
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
608 @rtype bool
3164
a027fc190f82 Fixed a bug creating a project from a repository and implemented a bugfix method for an issue in QsciScintilla.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
609 """
a027fc190f82 Fixed a bug creating a project from a repository and implemented a bugfix method for an issue in QsciScintilla.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
610 return bool(self.selectedText())
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
611
2587
68cc83a68883 Added a function to QsciScintillaCompat to check for a rectangular selection.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2564
diff changeset
612 def selectionIsRectangle(self):
68cc83a68883 Added a function to QsciScintillaCompat to check for a rectangular selection.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2564
diff changeset
613 """
68cc83a68883 Added a function to QsciScintillaCompat to check for a rectangular selection.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2564
diff changeset
614 Public method to check, if the current selection is rectangular.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
615
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
616 @return flag indicating a rectangular selection
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
617 @rtype bool
2587
68cc83a68883 Added a function to QsciScintillaCompat to check for a rectangular selection.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2564
diff changeset
618 """
2650
1b495c651868 Fixed an issue causing the 'Selection only' entry to remain selectable in the Find and Find&Replace widget for a rectangular selection.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2632
diff changeset
619 startLine, startIndex, endLine, endIndex = self.getSelection()
7267
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
620 return (
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
621 startLine != -1
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
622 and startLine != endLine
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
623 and self.SendScintilla(QsciScintilla.SCI_SELECTIONISRECTANGLE)
7267
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
624 )
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
625
2589
a51b0c113ed7 Added the capability to sort lines spanned by a rectangular selection based on the selected text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2587
diff changeset
626 def getRectangularSelection(self):
a51b0c113ed7 Added the capability to sort lines spanned by a rectangular selection based on the selected text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2587
diff changeset
627 """
a51b0c113ed7 Added the capability to sort lines spanned by a rectangular selection based on the selected text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2587
diff changeset
628 Public method to retrieve the start and end of a rectangular selection.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
629
2589
a51b0c113ed7 Added the capability to sort lines spanned by a rectangular selection based on the selected text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2587
diff changeset
630 @return tuple with start line and index and end line and index
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
631 @rtype tuple of (int, int, int, int)
2589
a51b0c113ed7 Added the capability to sort lines spanned by a rectangular selection based on the selected text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2587
diff changeset
632 """
a51b0c113ed7 Added the capability to sort lines spanned by a rectangular selection based on the selected text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2587
diff changeset
633 if not self.selectionIsRectangle():
a51b0c113ed7 Added the capability to sort lines spanned by a rectangular selection based on the selected text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2587
diff changeset
634 return (-1, -1, -1, -1)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
635
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
636 startPos = self.SendScintilla(QsciScintilla.SCI_GETRECTANGULARSELECTIONANCHOR)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
637 endPos = self.SendScintilla(QsciScintilla.SCI_GETRECTANGULARSELECTIONCARET)
2589
a51b0c113ed7 Added the capability to sort lines spanned by a rectangular selection based on the selected text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2587
diff changeset
638 startLine, startIndex = self.lineIndexFromPosition(startPos)
a51b0c113ed7 Added the capability to sort lines spanned by a rectangular selection based on the selected text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2587
diff changeset
639 endLine, endIndex = self.lineIndexFromPosition(endPos)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
640
2589
a51b0c113ed7 Added the capability to sort lines spanned by a rectangular selection based on the selected text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2587
diff changeset
641 return (startLine, startIndex, endLine, endIndex)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
642
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
643 def setRectangularSelection(self, startLine, startIndex, endLine, endIndex):
2589
a51b0c113ed7 Added the capability to sort lines spanned by a rectangular selection based on the selected text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2587
diff changeset
644 """
a51b0c113ed7 Added the capability to sort lines spanned by a rectangular selection based on the selected text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2587
diff changeset
645 Public method to set a rectangular selection.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
646
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
647 @param startLine line number of the start of the selection
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
648 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
649 @param startIndex index number of the start of the selection
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
650 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
651 @param endLine line number of the end of the selection
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
652 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
653 @param endIndex index number of the end of the selection
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
654 @type int
2589
a51b0c113ed7 Added the capability to sort lines spanned by a rectangular selection based on the selected text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2587
diff changeset
655 """
a51b0c113ed7 Added the capability to sort lines spanned by a rectangular selection based on the selected text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2587
diff changeset
656 startPos = self.positionFromLineIndex(startLine, startIndex)
a51b0c113ed7 Added the capability to sort lines spanned by a rectangular selection based on the selected text.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2587
diff changeset
657 endPos = self.positionFromLineIndex(endLine, endIndex)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
658
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
659 self.SendScintilla(QsciScintilla.SCI_SETRECTANGULARSELECTIONANCHOR, startPos)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
660 self.SendScintilla(QsciScintilla.SCI_SETRECTANGULARSELECTIONCARET, endPos)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
661
10257
904c71a0e37f Modified some preferences default values to better reflect common user expectations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10244
diff changeset
662 def setRectangularSelectionModifier(self, modifier):
904c71a0e37f Modified some preferences default values to better reflect common user expectations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10244
diff changeset
663 """
904c71a0e37f Modified some preferences default values to better reflect common user expectations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10244
diff changeset
664 Public method to set the modifier key used to create a rectangular selection by
904c71a0e37f Modified some preferences default values to better reflect common user expectations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10244
diff changeset
665 doing a mouse drag.
904c71a0e37f Modified some preferences default values to better reflect common user expectations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10244
diff changeset
666
904c71a0e37f Modified some preferences default values to better reflect common user expectations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10244
diff changeset
667 @param modifier modifier key to be used
904c71a0e37f Modified some preferences default values to better reflect common user expectations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10244
diff changeset
668 @type Qt.KeyboardModifier
904c71a0e37f Modified some preferences default values to better reflect common user expectations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10244
diff changeset
669 """
904c71a0e37f Modified some preferences default values to better reflect common user expectations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10244
diff changeset
670 sciModifier = {
904c71a0e37f Modified some preferences default values to better reflect common user expectations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10244
diff changeset
671 Qt.KeyboardModifier.ControlModifier: QsciScintilla.SCMOD_CTRL,
904c71a0e37f Modified some preferences default values to better reflect common user expectations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10244
diff changeset
672 Qt.KeyboardModifier.AltModifier: QsciScintilla.SCMOD_ALT,
904c71a0e37f Modified some preferences default values to better reflect common user expectations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10244
diff changeset
673 Qt.KeyboardModifier.MetaModifier: QsciScintilla.SCMOD_SUPER,
904c71a0e37f Modified some preferences default values to better reflect common user expectations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10244
diff changeset
674 }.get(modifier, QsciScintilla.SCMOD_CTRL)
904c71a0e37f Modified some preferences default values to better reflect common user expectations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10244
diff changeset
675 self.SendScintilla(
904c71a0e37f Modified some preferences default values to better reflect common user expectations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10244
diff changeset
676 QsciScintilla.SCI_SETRECTANGULARSELECTIONMODIFIER, sciModifier
904c71a0e37f Modified some preferences default values to better reflect common user expectations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10244
diff changeset
677 )
904c71a0e37f Modified some preferences default values to better reflect common user expectations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10244
diff changeset
678
2658
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
679 def getSelectionCount(self):
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
680 """
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
681 Public method to get the number of active selections.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
682
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
683 @return number of active selection
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
684 @rtype int
2658
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
685 """
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
686 return self.SendScintilla(QsciScintilla.SCI_GETSELECTIONS)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
687
2658
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
688 def getSelectionN(self, index):
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
689 """
2965
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2763
diff changeset
690 Public method to get the start and end of a selection given by its
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2763
diff changeset
691 index.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
692
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
693 @param index index of the selection
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
694 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
695 @return tuple with start line and index and end line and index for the
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
696 given selection
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
697 @rtype tuple of (int, int, int, int)
2658
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
698 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
699 startPos = self.SendScintilla(QsciScintilla.SCI_GETSELECTIONNSTART, index)
2658
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
700 endPos = self.SendScintilla(QsciScintilla.SCI_GETSELECTIONNEND, index)
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
701 startLine, startIndex = self.lineIndexFromPosition(startPos)
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
702 endLine, endIndex = self.lineIndexFromPosition(endPos)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
703
2658
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
704 return (startLine, startIndex, endLine, endIndex)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
705
2658
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
706 def getSelections(self):
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
707 """
3011
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
708 Public method to get the start and end coordinates of all active
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
709 selections.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
710
2658
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
711 @return list of tuples with start line and index and end line and index
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
712 of each active selection
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
713 @rtype list of [tuple of (int, int, int, int)]
2658
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
714 """
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
715 selections = []
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
716 for index in range(self.getSelectionCount()):
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
717 selections.append(self.getSelectionN(index))
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
718 return selections
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
719
8713
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8581
diff changeset
720 def addCursor(self, line, index):
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8581
diff changeset
721 """
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8581
diff changeset
722 Public method to add an additional cursor.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
723
8713
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8581
diff changeset
724 @param line line number for the cursor
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8581
diff changeset
725 @type int
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8581
diff changeset
726 @param index index number for the cursor
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8581
diff changeset
727 @type int
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8581
diff changeset
728 """
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8581
diff changeset
729 pos = self.positionFromLineIndex(line, index)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
730
8713
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8581
diff changeset
731 if self.getSelectionCount() == 0:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8581
diff changeset
732 self.SendScintilla(QsciScintilla.SCI_SETSELECTION, pos, pos)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8581
diff changeset
733 else:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8581
diff changeset
734 self.SendScintilla(QsciScintilla.SCI_ADDSELECTION, pos, pos)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
735
8713
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8581
diff changeset
736 def enableMultiCursorSupport(self):
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8581
diff changeset
737 """
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8581
diff changeset
738 Public method to enable support for multi cursor editing.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8581
diff changeset
739 """
9570
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9474
diff changeset
740 # typing and pasting should insert in all selections at the same time
8713
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8581
diff changeset
741 self.SendScintilla(QsciScintilla.SCI_SETMULTIPLESELECTION, True)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
742 self.SendScintilla(QsciScintilla.SCI_SETADDITIONALSELECTIONTYPING, True)
9570
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9474
diff changeset
743 self.SendScintilla(
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9474
diff changeset
744 QsciScintilla.SCI_SETMULTIPASTE, QsciScintilla.SC_MULTIPASTE_EACH
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9474
diff changeset
745 )
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
746
2659
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2658
diff changeset
747 def setVirtualSpaceOptions(self, options):
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2658
diff changeset
748 """
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2658
diff changeset
749 Public method to set the virtual space usage options.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
750
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
751 @param options usage options to set (0 to 3)
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
752 @type int
2659
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2658
diff changeset
753 """
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2658
diff changeset
754 self.SendScintilla(QsciScintilla.SCI_SETVIRTUALSPACEOPTIONS, options)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
755
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
756 def getLineSeparator(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
757 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
758 Public method to get the line separator for the current eol mode.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
759
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
760 @return eol string
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
761 @rtype str
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
762 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
763 m = self.eolMode()
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7998
diff changeset
764 if m == QsciScintilla.EolMode.EolWindows:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
765 eol = "\r\n"
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7998
diff changeset
766 elif m == QsciScintilla.EolMode.EolUnix:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
767 eol = "\n"
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7998
diff changeset
768 elif m == QsciScintilla.EolMode.EolMac:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
769 eol = "\r"
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
770 else:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
771 eol = ""
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
772 return eol
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
773
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
774 def getEolIndicator(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
775 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
776 Public method to get the eol indicator for the current eol mode.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
777
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
778 @return eol indicator
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
779 @rtype str
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
780 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
781 m = self.eolMode()
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7998
diff changeset
782 if m == QsciScintilla.EolMode.EolWindows:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
783 eol = "CRLF"
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7998
diff changeset
784 elif m == QsciScintilla.EolMode.EolUnix:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
785 eol = "LF"
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7998
diff changeset
786 elif m == QsciScintilla.EolMode.EolMac:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
787 eol = "CR"
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
788 else:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
789 eol = ""
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
790 return eol
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
791
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
792 def setEolModeByEolString(self, eolStr):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
793 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
794 Public method to set the eol mode given the eol string.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
795
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
796 @param eolStr eol string
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
797 @type str
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
798 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
799 if eolStr == "\r\n":
8437
3408f5174e2f Simplified some code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8324
diff changeset
800 self.setEolMode(QsciScintilla.EolMode.EolWindows)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
801 elif eolStr == "\n":
8437
3408f5174e2f Simplified some code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8324
diff changeset
802 self.setEolMode(QsciScintilla.EolMode.EolUnix)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
803 elif eolStr == "\r":
8437
3408f5174e2f Simplified some code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8324
diff changeset
804 self.setEolMode(QsciScintilla.EolMode.EolMac)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
805
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
806 def detectEolString(self, txt):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
807 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
808 Public method to determine the eol string used.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
809
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
810 @param txt text from which to determine the eol string
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
811 @type str
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
812 @return eol string
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
813 @rtype str
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
814 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
815 if len(txt.split("\r\n", 1)) == 2:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
816 return "\r\n"
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
817 elif len(txt.split("\n", 1)) == 2:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
818 return "\n"
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
819 elif len(txt.split("\r", 1)) == 2:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
820 return "\r"
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
821 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
822 return None
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
823
404
44a541bea034 Added code to adjust the cursor flash time of the editor to the global settings.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 342
diff changeset
824 def getCursorFlashTime(self):
44a541bea034 Added code to adjust the cursor flash time of the editor to the global settings.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 342
diff changeset
825 """
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
826 Public method to get the flash (blink) time of the cursor in
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
827 milliseconds.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
828
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
829 The flash time is the time required to display, invert and restore the
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
830 caret display. Usually the text cursor is displayed for half the cursor
404
44a541bea034 Added code to adjust the cursor flash time of the editor to the global settings.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 342
diff changeset
831 flash time, then hidden for the same amount of time.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
832
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
833 @return flash time of the cursor in milliseconds
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
834 @rtype int
404
44a541bea034 Added code to adjust the cursor flash time of the editor to the global settings.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 342
diff changeset
835 """
44a541bea034 Added code to adjust the cursor flash time of the editor to the global settings.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 342
diff changeset
836 return 2 * self.SendScintilla(QsciScintilla.SCI_GETCARETPERIOD)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
837
404
44a541bea034 Added code to adjust the cursor flash time of the editor to the global settings.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 342
diff changeset
838 def setCursorFlashTime(self, time):
44a541bea034 Added code to adjust the cursor flash time of the editor to the global settings.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 342
diff changeset
839 """
4020
ea66934c7d74 Corrected a source docu typo.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3933
diff changeset
840 Public method to set the flash (blink) time of the cursor in
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
841 milliseconds.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
842
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
843 The flash time is the time required to display, invert and restore the
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
844 caret display. Usually the text cursor is displayed for half the cursor
404
44a541bea034 Added code to adjust the cursor flash time of the editor to the global settings.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 342
diff changeset
845 flash time, then hidden for the same amount of time.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
846
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
847 @param time flash time of the cursor in milliseconds
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
848 @type int
404
44a541bea034 Added code to adjust the cursor flash time of the editor to the global settings.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 342
diff changeset
849 """
44a541bea034 Added code to adjust the cursor flash time of the editor to the global settings.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 342
diff changeset
850 self.SendScintilla(QsciScintilla.SCI_SETCARETPERIOD, time // 2)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
851
3067
8fd7ae10de2b Implemented support for the new QScintilla feature to always highlight the caret line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3039
diff changeset
852 def getCaretLineAlwaysVisible(self):
8fd7ae10de2b Implemented support for the new QScintilla feature to always highlight the caret line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3039
diff changeset
853 """
8fd7ae10de2b Implemented support for the new QScintilla feature to always highlight the caret line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3039
diff changeset
854 Public method to determine, if the caret line is visible even if
8fd7ae10de2b Implemented support for the new QScintilla feature to always highlight the caret line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3039
diff changeset
855 the editor doesn't have the focus.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
856
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
857 @return flag indicating an always visible caret line
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
858 @rtype bool
3067
8fd7ae10de2b Implemented support for the new QScintilla feature to always highlight the caret line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3039
diff changeset
859 """
8fd7ae10de2b Implemented support for the new QScintilla feature to always highlight the caret line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3039
diff changeset
860 try:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
861 return self.SendScintilla(QsciScintilla.SCI_GETCARETLINEVISIBLEALWAYS)
3067
8fd7ae10de2b Implemented support for the new QScintilla feature to always highlight the caret line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3039
diff changeset
862 except AttributeError:
8fd7ae10de2b Implemented support for the new QScintilla feature to always highlight the caret line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3039
diff changeset
863 return False
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
864
3067
8fd7ae10de2b Implemented support for the new QScintilla feature to always highlight the caret line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3039
diff changeset
865 def setCaretLineAlwaysVisible(self, alwaysVisible):
8fd7ae10de2b Implemented support for the new QScintilla feature to always highlight the caret line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3039
diff changeset
866 """
8fd7ae10de2b Implemented support for the new QScintilla feature to always highlight the caret line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3039
diff changeset
867 Public method to set the caret line visible even if the editor doesn't
8fd7ae10de2b Implemented support for the new QScintilla feature to always highlight the caret line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3039
diff changeset
868 have the focus.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
869
3067
8fd7ae10de2b Implemented support for the new QScintilla feature to always highlight the caret line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3039
diff changeset
870 @param alwaysVisible flag indicating that the caret line shall be
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
871 visible even if the editor doesn't have the focus
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
872 @type bool
3067
8fd7ae10de2b Implemented support for the new QScintilla feature to always highlight the caret line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3039
diff changeset
873 """
8243
cc717c2ae956 Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8218
diff changeset
874 with contextlib.suppress(AttributeError):
3067
8fd7ae10de2b Implemented support for the new QScintilla feature to always highlight the caret line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3039
diff changeset
875 self.SendScintilla(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
876 QsciScintilla.SCI_SETCARETLINEVISIBLEALWAYS, alwaysVisible
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
877 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
878
6059
8f7c66c53c27 Added a context menu entry to "Execute Selection In Console".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
879 def canPaste(self):
8f7c66c53c27 Added a context menu entry to "Execute Selection In Console".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
880 """
8f7c66c53c27 Added a context menu entry to "Execute Selection In Console".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
881 Public method to test, if the paste action is available (i.e. if the
8f7c66c53c27 Added a context menu entry to "Execute Selection In Console".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
882 clipboard contains some text).
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
883
6059
8f7c66c53c27 Added a context menu entry to "Execute Selection In Console".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
884 @return flag indicating the availability of 'paste'
8f7c66c53c27 Added a context menu entry to "Execute Selection In Console".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
885 @rtype bool
8f7c66c53c27 Added a context menu entry to "Execute Selection In Console".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
886 """
8f7c66c53c27 Added a context menu entry to "Execute Selection In Console".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
887 return self.SendScintilla(QsciScintilla.SCI_CANPASTE)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
888
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
889 ###########################################################################
3169
7b1b754a60a6 Implemented a workaround for a non-working implementation of inputMethodEvent() in QScintilla 2.8.x. It simply overwrites these methods with empty ones in order to not loose selected text on focus out.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
890 ## methods to perform searches in target range
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
891 ###########################################################################
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
892
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
893 def positionFromPoint(self, point):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
894 """
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
895 Public method to calculate the scintilla position from a point in the
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
896 window.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
897
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
898 @param point point in the window
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
899 @type QPoint
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
900 @return scintilla position or -1 to indicate, that the point is not near
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
901 any character
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
902 @rtype int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
903 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
904 return self.SendScintilla(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
905 QsciScintilla.SCI_POSITIONFROMPOINTCLOSE, point.x(), point.y()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
906 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
907
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
908 def positionBefore(self, pos):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
909 """
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
910 Public method to get the position before the given position taking into
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
911 account multibyte characters.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
912
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
913 @param pos position
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
914 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
915 @return position before the given one
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
916 @rtype int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
917 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
918 return self.SendScintilla(QsciScintilla.SCI_POSITIONBEFORE, pos)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
919
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
920 def positionAfter(self, pos):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
921 """
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
922 Public method to get the position after the given position taking into
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
923 account multibyte characters.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
924
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
925 @param pos position
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
926 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
927 @return position after the given one
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
928 @rtype int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
929 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
930 return self.SendScintilla(QsciScintilla.SCI_POSITIONAFTER, pos)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
931
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
932 def lineEndPosition(self, line):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
933 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
934 Public method to determine the line end position of the given line.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
935
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
936 @param line line number
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
937 @type int
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
938 @return position of the line end disregarding line end characters
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
939 @rtype int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
940 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
941 return self.SendScintilla(QsciScintilla.SCI_GETLINEENDPOSITION, line)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
942
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
943 def __doSearchTarget(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
944 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
945 Private method to perform the search in target.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
946
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
947 @return flag indicating a successful search
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
948 @rtype bool
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
949 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
950 if self.__targetSearchStart == self.__targetSearchEnd:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
951 self.__targetSearchActive = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
952 return False
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
953
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
954 self.SendScintilla(QsciScintilla.SCI_SETTARGETSTART, self.__targetSearchStart)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
955 self.SendScintilla(QsciScintilla.SCI_SETTARGETEND, self.__targetSearchEnd)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
956 self.SendScintilla(QsciScintilla.SCI_SETSEARCHFLAGS, self.__targetSearchFlags)
502
7500b9d5b21d Fixed an issue in the editor related to unicode handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 448
diff changeset
957 targetSearchExpr = self._encodeString(self.__targetSearchExpr)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
958 pos = self.SendScintilla(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
959 QsciScintilla.SCI_SEARCHINTARGET, len(targetSearchExpr), targetSearchExpr
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
960 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
961
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
962 if pos == -1:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
963 self.__targetSearchActive = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
964 return False
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
965
9845
50d1cd44b2cb Fixed a bug searching with a regular expression (see issue488).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
966 targetEnd = self.SendScintilla(QsciScintilla.SCI_GETTARGETEND)
50d1cd44b2cb Fixed a bug searching with a regular expression (see issue488).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
967 if targetEnd == self.__targetSearchStart:
50d1cd44b2cb Fixed a bug searching with a regular expression (see issue488).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
968 return False
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
969
9845
50d1cd44b2cb Fixed a bug searching with a regular expression (see issue488).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
970 self.__targetSearchStart = targetEnd
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
971 return True
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
972
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
973 def getFoundTarget(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
974 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
975 Public method to get the recently found target.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
976
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
977 @return found target as a tuple of starting position and target length
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
978 @rtype tuple of (int, int)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
979 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
980 if self.__targetSearchActive:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
981 spos = self.SendScintilla(QsciScintilla.SCI_GETTARGETSTART)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
982 epos = self.SendScintilla(QsciScintilla.SCI_GETTARGETEND)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
983 return (spos, epos - spos)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
984 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
985 return (0, 0)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
986
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
987 def findFirstTarget(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
988 self,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
989 expr_,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
990 re_,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
991 cs_,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
992 wo_,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
993 begline=-1,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
994 begindex=-1,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
995 endline=-1,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
996 endindex=-1,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
997 ws_=False,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
998 posix=False,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
999 cxx11=False,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1000 ):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1001 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1002 Public method to search in a specified range of text without
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1003 setting the selection.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1004
6841
43af1e698c9d Editor: added extended regular expression support (C++11) as of QScintilla 2.11.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6734
diff changeset
1005 @param expr_ search expression
43af1e698c9d Editor: added extended regular expression support (C++11) as of QScintilla 2.11.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6734
diff changeset
1006 @type str
43af1e698c9d Editor: added extended regular expression support (C++11) as of QScintilla 2.11.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6734
diff changeset
1007 @param re_ flag indicating a regular expression
43af1e698c9d Editor: added extended regular expression support (C++11) as of QScintilla 2.11.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6734
diff changeset
1008 @type bool
43af1e698c9d Editor: added extended regular expression support (C++11) as of QScintilla 2.11.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6734
diff changeset
1009 @param cs_ flag indicating a case sensitive search
43af1e698c9d Editor: added extended regular expression support (C++11) as of QScintilla 2.11.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6734
diff changeset
1010 @type bool
43af1e698c9d Editor: added extended regular expression support (C++11) as of QScintilla 2.11.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6734
diff changeset
1011 @param wo_ flag indicating a word only search
43af1e698c9d Editor: added extended regular expression support (C++11) as of QScintilla 2.11.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6734
diff changeset
1012 @type bool
43af1e698c9d Editor: added extended regular expression support (C++11) as of QScintilla 2.11.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6734
diff changeset
1013 @param begline line number to start from (-1 to indicate current
43af1e698c9d Editor: added extended regular expression support (C++11) as of QScintilla 2.11.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6734
diff changeset
1014 position)
43af1e698c9d Editor: added extended regular expression support (C++11) as of QScintilla 2.11.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6734
diff changeset
1015 @type int
43af1e698c9d Editor: added extended regular expression support (C++11) as of QScintilla 2.11.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6734
diff changeset
1016 @param begindex index to start from (-1 to indicate current position)
43af1e698c9d Editor: added extended regular expression support (C++11) as of QScintilla 2.11.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6734
diff changeset
1017 @type int
43af1e698c9d Editor: added extended regular expression support (C++11) as of QScintilla 2.11.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6734
diff changeset
1018 @param endline line number to stop at (-1 to indicate end of document)
43af1e698c9d Editor: added extended regular expression support (C++11) as of QScintilla 2.11.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6734
diff changeset
1019 @type int
43af1e698c9d Editor: added extended regular expression support (C++11) as of QScintilla 2.11.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6734
diff changeset
1020 @param endindex index number to stop at (-1 to indicate end of
43af1e698c9d Editor: added extended regular expression support (C++11) as of QScintilla 2.11.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6734
diff changeset
1021 document)
43af1e698c9d Editor: added extended regular expression support (C++11) as of QScintilla 2.11.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6734
diff changeset
1022 @type int
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1023 @param ws_ flag indicating a word start search
6841
43af1e698c9d Editor: added extended regular expression support (C++11) as of QScintilla 2.11.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6734
diff changeset
1024 @type bool
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1025 @param posix flag indicating a POSIX regular expression
6841
43af1e698c9d Editor: added extended regular expression support (C++11) as of QScintilla 2.11.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6734
diff changeset
1026 @type bool
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1027 @param cxx11 flag indicating a CXX-11 regular expression
6841
43af1e698c9d Editor: added extended regular expression support (C++11) as of QScintilla 2.11.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6734
diff changeset
1028 @type bool
43af1e698c9d Editor: added extended regular expression support (C++11) as of QScintilla 2.11.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6734
diff changeset
1029 @return flag indicating a successful search
43af1e698c9d Editor: added extended regular expression support (C++11) as of QScintilla 2.11.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6734
diff changeset
1030 @rtype bool
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1031 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1032 self.__targetSearchFlags = 0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1033 if re_:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1034 self.__targetSearchFlags |= QsciScintilla.SCFIND_REGEXP
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1035 if cs_:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1036 self.__targetSearchFlags |= QsciScintilla.SCFIND_MATCHCASE
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1037 if wo_:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1038 self.__targetSearchFlags |= QsciScintilla.SCFIND_WHOLEWORD
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1039 if ws_:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1040 self.__targetSearchFlags |= QsciScintilla.SCFIND_WORDSTART
6841
43af1e698c9d Editor: added extended regular expression support (C++11) as of QScintilla 2.11.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6734
diff changeset
1041 if posix:
43af1e698c9d Editor: added extended regular expression support (C++11) as of QScintilla 2.11.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6734
diff changeset
1042 self.__targetSearchFlags |= QsciScintilla.SCFIND_POSIX
8243
cc717c2ae956 Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8218
diff changeset
1043 with contextlib.suppress(AttributeError):
6841
43af1e698c9d Editor: added extended regular expression support (C++11) as of QScintilla 2.11.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6734
diff changeset
1044 if cxx11:
43af1e698c9d Editor: added extended regular expression support (C++11) as of QScintilla 2.11.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6734
diff changeset
1045 self.__targetSearchFlags |= QsciScintilla.SCFIND_CXX11REGEX
7202
d2f2a1fe0129 Modified sources to be in line with the minimum QScintilla requirement (v 2.9.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6948
diff changeset
1046 # defined for QScintilla >= 2.11.0
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1047
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1048 if begline < 0 or begindex < 0:
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
1049 self.__targetSearchStart = self.SendScintilla(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1050 QsciScintilla.SCI_GETCURRENTPOS
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1051 )
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1052 else:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1053 self.__targetSearchStart = self.positionFromLineIndex(begline, begindex)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1054
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1055 if endline < 0 or endindex < 0:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1056 self.__targetSearchEnd = self.SendScintilla(QsciScintilla.SCI_GETTEXTLENGTH)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1057 else:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1058 self.__targetSearchEnd = self.positionFromLineIndex(endline, endindex)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1059
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1060 self.__targetSearchExpr = expr_
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1061
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1062 if self.__targetSearchExpr:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1063 self.__targetSearchActive = True
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1064
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1065 return self.__doSearchTarget()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1066
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1067 return False
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1068
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1069 def findNextTarget(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1070 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1071 Public method to find the next occurrence in the target range.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1072
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1073 @return flag indicating a successful search
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1074 @rtype bool
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1075 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1076 if not self.__targetSearchActive:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1077 return False
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1078
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1079 return self.__doSearchTarget()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1080
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1081 def replaceTarget(self, replaceStr):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1082 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1083 Public method to replace the string found by the last search in target.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1084
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1085 @param replaceStr replacement string or regexp
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1086 @type str
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1087 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1088 if not self.__targetSearchActive:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1089 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1090
8260
2161475d9639 Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8243
diff changeset
1091 cmd = (
2161475d9639 Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8243
diff changeset
1092 QsciScintilla.SCI_REPLACETARGETRE
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1093 if self.__targetSearchFlags & QsciScintilla.SCFIND_REGEXP
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1094 else QsciScintilla.SCI_REPLACETARGET
8260
2161475d9639 Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8243
diff changeset
1095 )
510
84257fe1c8b4 Fixed an issue in the editor related to unicode handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 502
diff changeset
1096 r = self._encodeString(replaceStr)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1097
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1098 start = self.SendScintilla(QsciScintilla.SCI_GETTARGETSTART)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1099 self.SendScintilla(cmd, len(r), r)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1100
502
7500b9d5b21d Fixed an issue in the editor related to unicode handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 448
diff changeset
1101 self.__targetSearchStart = start + len(r)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1102
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
1103 ###########################################################################
3169
7b1b754a60a6 Implemented a workaround for a non-working implementation of inputMethodEvent() in QScintilla 2.8.x. It simply overwrites these methods with empty ones in order to not loose selected text on focus out.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
1104 ## indicator handling methods
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
1105 ###########################################################################
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1106
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1107 def indicatorDefine(self, indicator, style, color):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1108 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1109 Public method to define the appearance of an indicator.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1110
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
1111 @param indicator number of the indicator (integer,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1112 QsciScintilla.INDIC_CONTAINER .. QsciScintilla.INDIC_MAX)
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1113 @type int
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
1114 @param style style to be used for the indicator
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
1115 (QsciScintilla.INDIC_PLAIN, QsciScintilla.INDIC_SQUIGGLE,
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
1116 QsciScintilla.INDIC_TT, QsciScintilla.INDIC_DIAGONAL,
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
1117 QsciScintilla.INDIC_STRIKE, QsciScintilla.INDIC_HIDDEN,
3069
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1118 QsciScintilla.INDIC_BOX, QsciScintilla.INDIC_ROUNDBOX,
6932
8a3df4c6ac9a Continued implementing the Python AST Viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6891
diff changeset
1119 QsciScintilla.INDIC_STRAIGHTBOX, QsciScintilla.INDIC_FULLBOX,
8a3df4c6ac9a Continued implementing the Python AST Viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6891
diff changeset
1120 QsciScintilla.INDIC_DASH, QsciScintilla.INDIC_DOTS,
8a3df4c6ac9a Continued implementing the Python AST Viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6891
diff changeset
1121 QsciScintilla.INDIC_SQUIGGLELOW, QsciScintilla.INDIC_DOTBOX,
8a3df4c6ac9a Continued implementing the Python AST Viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6891
diff changeset
1122 QsciScintilla.INDIC_GRADIENT, QsciScintilla.INDIC_GRADIENTCENTRE,
8a3df4c6ac9a Continued implementing the Python AST Viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6891
diff changeset
1123 QsciScintilla.INDIC_SQUIGGLEPIXMAP,
8a3df4c6ac9a Continued implementing the Python AST Viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6891
diff changeset
1124 QsciScintilla.INDIC_COMPOSITIONTHICK,
8a3df4c6ac9a Continued implementing the Python AST Viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6891
diff changeset
1125 QsciScintilla.INDIC_COMPOSITIONTHIN, QsciScintilla.INDIC_TEXTFORE,
8a3df4c6ac9a Continued implementing the Python AST Viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6891
diff changeset
1126 QsciScintilla.INDIC_POINT, QsciScintilla.INDIC_POINTCHARACTER
8a3df4c6ac9a Continued implementing the Python AST Viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6891
diff changeset
1127 depending upon QScintilla version)
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1128 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1129 @param color color to be used by the indicator
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1130 @type QColor
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1131 @exception ValueError the indicator or style are not valid
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1132 """
7267
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
1133 if (
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1134 indicator < QsciScintilla.INDIC_CONTAINER
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1135 or indicator > QsciScintilla.INDIC_MAX
7267
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
1136 ):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1137 raise ValueError("indicator number out of range")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1138
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1139 if style < QsciScintilla.INDIC_PLAIN or style > self.IndicatorStyleMax:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1140 raise ValueError("style out of range")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1141
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1142 self.SendScintilla(QsciScintilla.SCI_INDICSETSTYLE, indicator, style)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1143 self.SendScintilla(QsciScintilla.SCI_INDICSETFORE, indicator, color)
8243
cc717c2ae956 Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8218
diff changeset
1144 with contextlib.suppress(AttributeError):
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1145 self.SendScintilla(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1146 QsciScintilla.SCI_INDICSETALPHA, indicator, color.alpha()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1147 )
6932
8a3df4c6ac9a Continued implementing the Python AST Viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6891
diff changeset
1148 if style in (
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1149 QsciScintilla.INDIC_ROUNDBOX,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1150 QsciScintilla.INDIC_STRAIGHTBOX,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1151 QsciScintilla.INDIC_DOTBOX,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1152 QsciScintilla.INDIC_FULLBOX,
6932
8a3df4c6ac9a Continued implementing the Python AST Viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6891
diff changeset
1153 ):
8a3df4c6ac9a Continued implementing the Python AST Viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6891
diff changeset
1154 # set outline alpha less transparent
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1155 self.SendScintilla(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1156 QsciScintilla.SCI_INDICSETOUTLINEALPHA,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1157 indicator,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1158 color.alpha() + 20,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1159 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1160
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1161 def setCurrentIndicator(self, indicator):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1162 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1163 Public method to set the current indicator.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1164
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
1165 @param indicator number of the indicator (integer,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1166 QsciScintilla.INDIC_CONTAINER .. QsciScintilla.INDIC_MAX)
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1167 @type int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1168 @exception ValueError the indicator or style are not valid
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1169 """
7267
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
1170 if (
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1171 indicator < QsciScintilla.INDIC_CONTAINER
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1172 or indicator > QsciScintilla.INDIC_MAX
7267
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
1173 ):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1174 raise ValueError("indicator number out of range")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1175
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1176 self.SendScintilla(QsciScintilla.SCI_SETINDICATORCURRENT, indicator)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1177
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1178 def setIndicatorRange(self, indicator, spos, length):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1179 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1180 Public method to set an indicator for the given range.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1181
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
1182 @param indicator number of the indicator (integer,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1183 QsciScintilla.INDIC_CONTAINER .. QsciScintilla.INDIC_MAX)
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1184 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1185 @param spos position of the indicator start
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1186 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1187 @param length length of the indicator
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1188 @type int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1189 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1190 self.setCurrentIndicator(indicator)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1191 self.SendScintilla(QsciScintilla.SCI_INDICATORFILLRANGE, spos, length)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1192
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1193 def setIndicator(self, indicator, sline, sindex, eline, eindex):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1194 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1195 Public method to set an indicator for the given range.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1196
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
1197 @param indicator number of the indicator (integer,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1198 QsciScintilla.INDIC_CONTAINER .. QsciScintilla.INDIC_MAX)
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1199 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1200 @param sline line number of the indicator start
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1201 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1202 @param sindex index of the indicator start
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1203 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1204 @param eline line number of the indicator end
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1205 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1206 @param eindex index of the indicator end
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1207 @type int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1208 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1209 spos = self.positionFromLineIndex(sline, sindex)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1210 epos = self.positionFromLineIndex(eline, eindex)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1211 self.setIndicatorRange(indicator, spos, epos - spos)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1212
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1213 def clearIndicatorRange(self, indicator, spos, length):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1214 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1215 Public method to clear an indicator for the given range.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1216
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
1217 @param indicator number of the indicator (integer,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1218 QsciScintilla.INDIC_CONTAINER .. QsciScintilla.INDIC_MAX)
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1219 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1220 @param spos position of the indicator start
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1221 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1222 @param length length of the indicator
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1223 @type int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1224 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1225 self.setCurrentIndicator(indicator)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1226 self.SendScintilla(QsciScintilla.SCI_INDICATORCLEARRANGE, spos, length)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1227
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1228 def clearIndicator(self, indicator, sline, sindex, eline, eindex):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1229 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1230 Public method to clear an indicator for the given range.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1231
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
1232 @param indicator number of the indicator (integer,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1233 QsciScintilla.INDIC_CONTAINER .. QsciScintilla.INDIC_MAX)
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1234 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1235 @param sline line number of the indicator start
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1236 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1237 @param sindex index of the indicator start
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1238 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1239 @param eline line number of the indicator end
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1240 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1241 @param eindex index of the indicator end
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1242 @type int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1243 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1244 spos = self.positionFromLineIndex(sline, sindex)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1245 epos = self.positionFromLineIndex(eline, eindex)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1246 self.clearIndicatorRange(indicator, spos, epos - spos)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1247
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1248 def clearAllIndicators(self, indicator):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1249 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1250 Public method to clear all occurrences of an indicator.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1251
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
1252 @param indicator number of the indicator (integer,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1253 QsciScintilla.INDIC_CONTAINER .. QsciScintilla.INDIC_MAX)
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1254 @type int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1255 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1256 self.clearIndicatorRange(indicator, 0, self.length())
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1257
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1258 def hasIndicator(self, indicator, pos):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1259 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1260 Public method to test for the existence of an indicator.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1261
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
1262 @param indicator number of the indicator (integer,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1263 QsciScintilla.INDIC_CONTAINER .. QsciScintilla.INDIC_MAX)
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1264 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1265 @param pos position to test
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1266 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1267 @return flag indicating the existence of the indicator
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1268 @rtype bool
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1269 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1270 res = self.SendScintilla(QsciScintilla.SCI_INDICATORVALUEAT, indicator, pos)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1271 return res
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1272
3069
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1273 def showFindIndicator(self, sline, sindex, eline, eindex):
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1274 """
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1275 Public method to show the find indicator for the given range.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1276
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1277 @param sline line number of the indicator start
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1278 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1279 @param sindex index of the indicator start
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1280 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1281 @param eline line number of the indicator end
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1282 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1283 @param eindex index of the indicator end
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1284 @type int
3069
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1285 """
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1286 if hasattr(QsciScintilla, "SCI_FINDINDICATORSHOW"):
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1287 spos = self.positionFromLineIndex(sline, sindex)
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1288 epos = self.positionFromLineIndex(eline, eindex)
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1289 self.SendScintilla(QsciScintilla.SCI_FINDINDICATORSHOW, spos, epos)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1290
3069
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1291 def flashFindIndicator(self, sline, sindex, eline, eindex):
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1292 """
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1293 Public method to flash the find indicator for the given range.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1294
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1295 @param sline line number of the indicator start
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1296 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1297 @param sindex index of the indicator start
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1298 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1299 @param eline line number of the indicator end
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1300 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1301 @param eindex index of the indicator end
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1302 @type int
3069
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1303 """
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1304 if hasattr(QsciScintilla, "SCI_FINDINDICATORFLASH"):
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1305 spos = self.positionFromLineIndex(sline, sindex)
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1306 epos = self.positionFromLineIndex(eline, eindex)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1307 self.SendScintilla(QsciScintilla.SCI_FINDINDICATORFLASH, spos, epos)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1308
3069
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1309 def hideFindIndicator(self):
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1310 """
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1311 Public method to hide the find indicator.
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1312 """
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1313 if hasattr(QsciScintilla, "SCI_FINDINDICATORHIDE"):
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1314 self.SendScintilla(QsciScintilla.SCI_FINDINDICATORHIDE)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1315
4253
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1316 def getIndicatorStartPos(self, indicator, pos):
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1317 """
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1318 Public method to get the start position of an indicator at a position.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1319
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1320 @param indicator ID of the indicator
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1321 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1322 @param pos position within the indicator
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1323 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1324 @return start position of the indicator
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1325 @rtype int
4253
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1326 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1327 return self.SendScintilla(QsciScintilla.SCI_INDICATORSTART, indicator, pos)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1328
4253
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1329 def getIndicatorEndPos(self, indicator, pos):
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1330 """
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1331 Public method to get the end position of an indicator at a position.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1332
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1333 @param indicator ID of the indicator
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1334 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1335 @param pos position within the indicator
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1336 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1337 @return end position of the indicator
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1338 @rtype int
4253
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1339 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1340 return self.SendScintilla(QsciScintilla.SCI_INDICATOREND, indicator, pos)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1341
9977
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1342 def getIndicatorRange(self, indicator, pos=None):
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1343 """
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1344 Public method to get the range of the indicator at the given position.
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1345
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1346 If the position is given as 'None', the current cursor position is used.
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1347
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1348 @param indicator ID of the indicator
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1349 @type int
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1350 @param pos position within the indicator (defaults to None)
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1351 @type int (optional)
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1352 @return start position and length of the indicator
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1353 @rtype tuple of (int, int)
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1354 """
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1355 if pos is None:
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1356 pos = self.SendScintilla(QsciScintilla.SCI_GETCURRENTPOS)
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1357
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1358 isInIndicator = self.hasIndicator(indicator, pos)
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1359 if isInIndicator:
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1360 posStart = self.getIndicatorStartPos(indicator, pos)
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1361 posEnd = self.getIndicatorEndPos(indicator, pos)
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1362 return posStart, posEnd - posStart
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1363 else:
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1364 return 0, 0
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1365
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1366 def getIndicator(self, indicator, pos=None):
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1367 """
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1368 Public method to get the start and end of the indicator at the given position.
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1369
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1370 If the position is given as 'None', the current cursor position is used.
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1371
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1372 @param indicator ID of the indicator
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1373 @type int
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1374 @param pos position within the indicator (defaults to None)
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1375 @type int (optional)
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1376 @return tuple containing the start line and index and the end line and index
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1377 @rtype tuple of (int, int, int, int)
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1378 """
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1379 if pos is None:
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1380 pos = self.SendScintilla(QsciScintilla.SCI_GETCURRENTPOS)
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1381
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1382 isInIndicator = self.hasIndicator(indicator, pos)
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1383 if isInIndicator:
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1384 posStart = self.getIndicatorStartPos(indicator, pos)
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1385 sline, sindex = self.lineIndexFromPosition(posStart)
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1386 posEnd = self.getIndicatorEndPos(indicator, pos)
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1387 eline, eindex = self.lineIndexFromPosition(posEnd)
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1388 return sline, sindex, eline, eindex
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1389 else:
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1390 return 0, 0, 0, 0
a5acf678c367 Fixed an issue with search and replace in selection if the replacement text modifies the lines range of the selected text (see issue 496)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9845
diff changeset
1391
4253
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1392 def gotoPreviousIndicator(self, indicator, wrap):
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1393 """
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1394 Public method to move the cursor to the previous position of an
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1395 indicator.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1396
4253
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1397 This method ensures, that the position found is visible (i.e. unfolded
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1398 and inside the visible range). The text containing the indicator is
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1399 selected.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1400
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1401 @param indicator ID of the indicator to search
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1402 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1403 @param wrap flag indicating to wrap around at the beginning of the text
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1404 @type bool
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1405 @return flag indicating if the indicator was found
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1406 @rtype bool
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1407 """
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1408 pos = self.SendScintilla(QsciScintilla.SCI_GETCURRENTPOS)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1409 docLen = self.SendScintilla(QsciScintilla.SCI_GETTEXTLENGTH)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1410 isInIndicator = self.hasIndicator(indicator, pos)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1411 posStart = self.getIndicatorStartPos(indicator, pos)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1412 posEnd = self.getIndicatorEndPos(indicator, pos)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1413
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1414 if posStart == 0 and posEnd == docLen - 1:
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1415 # indicator does not exist
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1416 return False
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1417
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1418 if posStart <= 0:
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1419 if not wrap:
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1420 return False
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1421
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1422 isInIndicator = self.hasIndicator(indicator, docLen - 1)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1423 posStart = self.getIndicatorStartPos(indicator, docLen - 1)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1424
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1425 if isInIndicator:
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1426 # get out of it
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1427 posStart = self.getIndicatorStartPos(indicator, posStart - 1)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1428 if posStart <= 0:
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1429 if not wrap:
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1430 return False
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1431
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1432 posStart = self.getIndicatorStartPos(indicator, docLen - 1)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1433
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1434 newPos = posStart - 1
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1435 posStart = self.getIndicatorStartPos(indicator, newPos)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1436 posEnd = self.getIndicatorEndPos(indicator, newPos)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1437
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1438 if self.hasIndicator(indicator, posStart):
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1439 # found it
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1440 line, index = self.lineIndexFromPosition(posEnd)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1441 self.ensureLineVisible(line)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1442 self.SendScintilla(QsciScintilla.SCI_SETSEL, posEnd, posStart)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1443 self.SendScintilla(QsciScintilla.SCI_SCROLLCARET)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1444 return True
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1445
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1446 return False
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1447
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1448 def gotoNextIndicator(self, indicator, wrap):
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1449 """
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1450 Public method to move the cursor to the next position of an indicator.
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1451
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1452 This method ensures, that the position found is visible (i.e. unfolded
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1453 and inside the visible range). The text containing the indicator is
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1454 selected.
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1455
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1456 @param indicator ID of the indicator to search
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1457 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1458 @param wrap flag indicating to wrap around at the beginning of the text
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1459 @type bool
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1460 @return flag indicating if the indicator was found
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1461 @rtype bool
4253
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1462 """
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1463 pos = self.SendScintilla(QsciScintilla.SCI_GETCURRENTPOS)
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1464 docLen = self.SendScintilla(QsciScintilla.SCI_GETTEXTLENGTH)
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1465 isInIndicator = self.hasIndicator(indicator, pos)
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1466 posStart = self.getIndicatorStartPos(indicator, pos)
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1467 posEnd = self.getIndicatorEndPos(indicator, pos)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1468
4253
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1469 if posStart == 0 and posEnd == docLen - 1:
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1470 # indicator does not exist
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1471 return False
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1472
4253
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1473 if posEnd >= docLen:
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1474 if not wrap:
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1475 return False
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1476
4253
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1477 isInIndicator = self.hasIndicator(indicator, 0)
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1478 posEnd = self.getIndicatorEndPos(indicator, 0)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1479
4253
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1480 if isInIndicator:
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1481 # get out of it
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1482 posEnd = self.getIndicatorEndPos(indicator, posEnd)
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1483 if posEnd >= docLen:
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1484 if not wrap:
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1485 return False
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1486
4253
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1487 posEnd = self.getIndicatorEndPos(indicator, 0)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1488
4253
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1489 newPos = posEnd + 1
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1490 posStart = self.getIndicatorStartPos(indicator, newPos)
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1491 posEnd = self.getIndicatorEndPos(indicator, newPos)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1492
4253
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1493 if self.hasIndicator(indicator, posStart):
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1494 # found it
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1495 line, index = self.lineIndexFromPosition(posEnd)
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1496 self.ensureLineVisible(line)
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1497 self.SendScintilla(QsciScintilla.SCI_SETSEL, posStart, posEnd)
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1498 self.SendScintilla(QsciScintilla.SCI_SCROLLCARET)
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1499 return True
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1500
4253
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1501 return False
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1502
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
1503 ###########################################################################
3169
7b1b754a60a6 Implemented a workaround for a non-working implementation of inputMethodEvent() in QScintilla 2.8.x. It simply overwrites these methods with empty ones in order to not loose selected text on focus out.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
1504 ## methods to perform folding related stuff
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
1505 ###########################################################################
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1506
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
1507 def __setFoldMarker(self, marknr, mark=QsciScintilla.SC_MARK_EMPTY):
330
4b4f242bf3f6 Added additional fold styles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 325
diff changeset
1508 """
4b4f242bf3f6 Added additional fold styles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 325
diff changeset
1509 Private method to define a fold marker.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1510
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1511 @param marknr marker number to define
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1512 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1513 @param mark fold mark symbol to be used
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1514 @type int
330
4b4f242bf3f6 Added additional fold styles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 325
diff changeset
1515 """
4b4f242bf3f6 Added additional fold styles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 325
diff changeset
1516 self.SendScintilla(QsciScintilla.SCI_MARKERDEFINE, marknr, mark)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1517
330
4b4f242bf3f6 Added additional fold styles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 325
diff changeset
1518 if mark != QsciScintilla.SC_MARK_EMPTY:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1519 self.SendScintilla(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1520 QsciScintilla.SCI_MARKERSETFORE, marknr, QColor(Qt.GlobalColor.white)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1521 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1522 self.SendScintilla(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1523 QsciScintilla.SCI_MARKERSETBACK, marknr, QColor(Qt.GlobalColor.black)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1524 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1525
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
1526 def setFolding(self, style, margin=2):
330
4b4f242bf3f6 Added additional fold styles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 325
diff changeset
1527 """
4b4f242bf3f6 Added additional fold styles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 325
diff changeset
1528 Public method to set the folding style and margin.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1529
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1530 @param style folding style to set
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1531 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1532 @param margin margin number
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1533 @type int
330
4b4f242bf3f6 Added additional fold styles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 325
diff changeset
1534 """
8318
962bce857696 Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8312
diff changeset
1535 if isinstance(style, QsciScintilla.FoldStyle):
962bce857696 Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8312
diff changeset
1536 super().setFolding(QsciScintilla.FoldStyle(style), margin)
330
4b4f242bf3f6 Added additional fold styles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 325
diff changeset
1537 else:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1538 super().setFolding(QsciScintilla.FoldStyle.PlainFoldStyle, margin)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1539
330
4b4f242bf3f6 Added additional fold styles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 325
diff changeset
1540 if style == self.ArrowFoldStyle:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1541 self.__setFoldMarker(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1542 QsciScintilla.SC_MARKNUM_FOLDER, QsciScintilla.SC_MARK_ARROW
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1543 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1544 self.__setFoldMarker(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1545 QsciScintilla.SC_MARKNUM_FOLDEROPEN, QsciScintilla.SC_MARK_ARROWDOWN
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1546 )
826
2e3e2055e715 Fixed a few PEP 8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
1547 self.__setFoldMarker(QsciScintilla.SC_MARKNUM_FOLDERSUB)
2e3e2055e715 Fixed a few PEP 8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
1548 self.__setFoldMarker(QsciScintilla.SC_MARKNUM_FOLDERTAIL)
2e3e2055e715 Fixed a few PEP 8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
1549 self.__setFoldMarker(QsciScintilla.SC_MARKNUM_FOLDEREND)
2e3e2055e715 Fixed a few PEP 8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
1550 self.__setFoldMarker(QsciScintilla.SC_MARKNUM_FOLDEROPENMID)
2e3e2055e715 Fixed a few PEP 8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
1551 self.__setFoldMarker(QsciScintilla.SC_MARKNUM_FOLDERMIDTAIL)
330
4b4f242bf3f6 Added additional fold styles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 325
diff changeset
1552 elif style == self.ArrowTreeFoldStyle:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1553 self.__setFoldMarker(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1554 QsciScintilla.SC_MARKNUM_FOLDER, QsciScintilla.SC_MARK_ARROW
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1555 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1556 self.__setFoldMarker(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1557 QsciScintilla.SC_MARKNUM_FOLDEROPEN, QsciScintilla.SC_MARK_ARROWDOWN
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1558 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1559 self.__setFoldMarker(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1560 QsciScintilla.SC_MARKNUM_FOLDERSUB, QsciScintilla.SC_MARK_VLINE
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1561 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1562 self.__setFoldMarker(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1563 QsciScintilla.SC_MARKNUM_FOLDERTAIL, QsciScintilla.SC_MARK_LCORNER
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1564 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1565 self.__setFoldMarker(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1566 QsciScintilla.SC_MARKNUM_FOLDEREND, QsciScintilla.SC_MARK_ARROW
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1567 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1568 self.__setFoldMarker(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1569 QsciScintilla.SC_MARKNUM_FOLDEROPENMID,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1570 QsciScintilla.SC_MARK_ARROWDOWN,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1571 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1572 self.__setFoldMarker(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1573 QsciScintilla.SC_MARKNUM_FOLDERMIDTAIL,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1574 QsciScintilla.SC_MARK_TCORNER,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1575 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1576
342
360c4eb76d6c Added capability to configure the colors of the foldmarkers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 330
diff changeset
1577 def setFoldMarkersColors(self, foreColor, backColor):
360c4eb76d6c Added capability to configure the colors of the foldmarkers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 330
diff changeset
1578 """
360c4eb76d6c Added capability to configure the colors of the foldmarkers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 330
diff changeset
1579 Public method to set the foreground and background colors of the
360c4eb76d6c Added capability to configure the colors of the foldmarkers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 330
diff changeset
1580 fold markers.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1581
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1582 @param foreColor foreground color
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1583 @type QColor
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1584 @param backColor background color
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1585 @type QColor
342
360c4eb76d6c Added capability to configure the colors of the foldmarkers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 330
diff changeset
1586 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1587 self.SendScintilla(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1588 QsciScintilla.SCI_MARKERSETFORE, QsciScintilla.SC_MARKNUM_FOLDER, foreColor
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1589 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1590 self.SendScintilla(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1591 QsciScintilla.SCI_MARKERSETBACK, QsciScintilla.SC_MARKNUM_FOLDER, backColor
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1592 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1593
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1594 self.SendScintilla(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1595 QsciScintilla.SCI_MARKERSETFORE,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1596 QsciScintilla.SC_MARKNUM_FOLDEROPEN,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1597 foreColor,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1598 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1599 self.SendScintilla(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1600 QsciScintilla.SCI_MARKERSETBACK,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1601 QsciScintilla.SC_MARKNUM_FOLDEROPEN,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1602 backColor,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1603 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1604
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1605 self.SendScintilla(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1606 QsciScintilla.SCI_MARKERSETFORE,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1607 QsciScintilla.SC_MARKNUM_FOLDEROPENMID,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1608 foreColor,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1609 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1610 self.SendScintilla(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1611 QsciScintilla.SCI_MARKERSETBACK,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1612 QsciScintilla.SC_MARKNUM_FOLDEROPENMID,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1613 backColor,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1614 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1615
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1616 self.SendScintilla(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1617 QsciScintilla.SCI_MARKERSETFORE,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1618 QsciScintilla.SC_MARKNUM_FOLDERSUB,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1619 foreColor,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1620 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1621 self.SendScintilla(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1622 QsciScintilla.SCI_MARKERSETBACK,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1623 QsciScintilla.SC_MARKNUM_FOLDERSUB,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1624 backColor,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1625 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1626
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1627 self.SendScintilla(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1628 QsciScintilla.SCI_MARKERSETFORE,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1629 QsciScintilla.SC_MARKNUM_FOLDERTAIL,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1630 foreColor,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1631 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1632 self.SendScintilla(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1633 QsciScintilla.SCI_MARKERSETBACK,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1634 QsciScintilla.SC_MARKNUM_FOLDERTAIL,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1635 backColor,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1636 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1637
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1638 self.SendScintilla(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1639 QsciScintilla.SCI_MARKERSETFORE,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1640 QsciScintilla.SC_MARKNUM_FOLDERMIDTAIL,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1641 foreColor,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1642 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1643 self.SendScintilla(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1644 QsciScintilla.SCI_MARKERSETBACK,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1645 QsciScintilla.SC_MARKNUM_FOLDERMIDTAIL,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1646 backColor,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1647 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1648
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1649 self.SendScintilla(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1650 QsciScintilla.SCI_MARKERSETFORE,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1651 QsciScintilla.SC_MARKNUM_FOLDEREND,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1652 foreColor,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1653 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1654 self.SendScintilla(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1655 QsciScintilla.SCI_MARKERSETBACK,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1656 QsciScintilla.SC_MARKNUM_FOLDEREND,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1657 backColor,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1658 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1659
6031
ccab25598d90 Fixed an issue drawing the marker map of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
1660 def getVisibleLineFromDocLine(self, docLine):
ccab25598d90 Fixed an issue drawing the marker map of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
1661 """
ccab25598d90 Fixed an issue drawing the marker map of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
1662 Public method to convert a document line number to a visible line
ccab25598d90 Fixed an issue drawing the marker map of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
1663 number (i.e. respect folded lines and annotations).
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1664
6031
ccab25598d90 Fixed an issue drawing the marker map of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
1665 @param docLine document line number to be converted
ccab25598d90 Fixed an issue drawing the marker map of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
1666 @type int
ccab25598d90 Fixed an issue drawing the marker map of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
1667 @return visible line number
ccab25598d90 Fixed an issue drawing the marker map of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
1668 @rtype int
ccab25598d90 Fixed an issue drawing the marker map of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
1669 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1670 return self.SendScintilla(QsciScintilla.SCI_VISIBLEFROMDOCLINE, docLine)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1671
6031
ccab25598d90 Fixed an issue drawing the marker map of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
1672 def getDocLineFromVisibleLine(self, displayLine):
ccab25598d90 Fixed an issue drawing the marker map of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
1673 """
ccab25598d90 Fixed an issue drawing the marker map of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
1674 Public method to convert a visible line number to a document line
ccab25598d90 Fixed an issue drawing the marker map of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
1675 number (i.e. respect folded lines and annotations).
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1676
6031
ccab25598d90 Fixed an issue drawing the marker map of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
1677 @param displayLine display line number to be converted
ccab25598d90 Fixed an issue drawing the marker map of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
1678 @type int
ccab25598d90 Fixed an issue drawing the marker map of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
1679 @return document line number
ccab25598d90 Fixed an issue drawing the marker map of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
1680 @rtype int
ccab25598d90 Fixed an issue drawing the marker map of the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
1681 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1682 return self.SendScintilla(QsciScintilla.SCI_DOCLINEFROMVISIBLE, displayLine)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1683
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
1684 ###########################################################################
3169
7b1b754a60a6 Implemented a workaround for a non-working implementation of inputMethodEvent() in QScintilla 2.8.x. It simply overwrites these methods with empty ones in order to not loose selected text on focus out.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
1685 ## interface methods to the standard keyboard command set
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
1686 ###########################################################################
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1687
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1688 def clearKeys(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1689 """
3591
2f2a4a76dd22 Corrected a bunch of source docu issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
1690 Public method to clear the key commands.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1691 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1692 # call into the QsciCommandSet
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1693 self.standardCommands().clearKeys()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1694
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1695 def clearAlternateKeys(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1696 """
3591
2f2a4a76dd22 Corrected a bunch of source docu issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
1697 Public method to clear the alternate key commands.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1698 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1699 # call into the QsciCommandSet
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1700 self.standardCommands().clearAlternateKeys()
325
dd7377dbd057 Fixed the issue with autocompletion lists staying on screen after editor looses focus.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
1701
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
1702 ###########################################################################
3169
7b1b754a60a6 Implemented a workaround for a non-working implementation of inputMethodEvent() in QScintilla 2.8.x. It simply overwrites these methods with empty ones in order to not loose selected text on focus out.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
1703 ## specialized event handlers
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
1704 ###########################################################################
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1705
325
dd7377dbd057 Fixed the issue with autocompletion lists staying on screen after editor looses focus.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
1706 def focusOutEvent(self, event):
dd7377dbd057 Fixed the issue with autocompletion lists staying on screen after editor looses focus.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
1707 """
3591
2f2a4a76dd22 Corrected a bunch of source docu issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
1708 Protected method called when the editor loses focus.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1709
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1710 @param event event object
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1711 @type QFocusEvent
325
dd7377dbd057 Fixed the issue with autocompletion lists staying on screen after editor looses focus.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
1712 """
dd7377dbd057 Fixed the issue with autocompletion lists staying on screen after editor looses focus.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
1713 if self.isListActive():
7348
79ae0af9558a QsciScintillaCompat: fixed (hopefully) a focus related issue causing completion list to stay.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7267
diff changeset
1714 if event.reason() in [
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7998
diff changeset
1715 Qt.FocusReason.ActiveWindowFocusReason,
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1716 Qt.FocusReason.OtherFocusReason,
7348
79ae0af9558a QsciScintillaCompat: fixed (hopefully) a focus related issue causing completion list to stay.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7267
diff changeset
1717 ]:
3233
33b91e6c5ae4 Refined the focusOutEvent method of QsciScintillaCompat to not remove the auto-completion list if the user clicks inside the list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3215
diff changeset
1718 aw = QApplication.activeWindow()
33b91e6c5ae4 Refined the focusOutEvent method of QsciScintillaCompat to not remove the auto-completion list if the user clicks inside the list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3215
diff changeset
1719 if aw is None or aw.parent() is not self:
33b91e6c5ae4 Refined the focusOutEvent method of QsciScintillaCompat to not remove the auto-completion list if the user clicks inside the list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3215
diff changeset
1720 self.cancelList()
33b91e6c5ae4 Refined the focusOutEvent method of QsciScintillaCompat to not remove the auto-completion list if the user clicks inside the list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3215
diff changeset
1721 else:
33b91e6c5ae4 Refined the focusOutEvent method of QsciScintillaCompat to not remove the auto-completion list if the user clicks inside the list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3215
diff changeset
1722 self.cancelList()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1723
3257
a2b4a45e14de Extended the QScintilla focusOutEvent to remove calltip widgets as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3238
diff changeset
1724 if self.isCallTipActive():
7348
79ae0af9558a QsciScintillaCompat: fixed (hopefully) a focus related issue causing completion list to stay.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7267
diff changeset
1725 if event.reason() in [
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7998
diff changeset
1726 Qt.FocusReason.ActiveWindowFocusReason,
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1727 Qt.FocusReason.OtherFocusReason,
7348
79ae0af9558a QsciScintillaCompat: fixed (hopefully) a focus related issue causing completion list to stay.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7267
diff changeset
1728 ]:
3257
a2b4a45e14de Extended the QScintilla focusOutEvent to remove calltip widgets as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3238
diff changeset
1729 aw = QApplication.activeWindow()
a2b4a45e14de Extended the QScintilla focusOutEvent to remove calltip widgets as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3238
diff changeset
1730 if aw is None or aw.parent() is not self:
8581
a6c893c8b7af Editor: some fine tuning in handling of mouse hover help and goto lists.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8489
diff changeset
1731 self.cancelCallTips()
3257
a2b4a45e14de Extended the QScintilla focusOutEvent to remove calltip widgets as well.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3238
diff changeset
1732 else:
8581
a6c893c8b7af Editor: some fine tuning in handling of mouse hover help and goto lists.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8489
diff changeset
1733 self.cancelCallTips()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1734
8218
7c09585bd960 Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8143
diff changeset
1735 super().focusOutEvent(event)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1736
1443
9b9396fc54aa Fixed a compatibility issue with QScintilla 2.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
1737 def event(self, evt):
9b9396fc54aa Fixed a compatibility issue with QScintilla 2.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
1738 """
3591
2f2a4a76dd22 Corrected a bunch of source docu issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
1739 Public method to handle events.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1740
2965
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2763
diff changeset
1741 Note: We are not interested in the standard QsciScintilla event
6285
045dc4c38701 Corrected a typo in several files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6188
diff changeset
1742 handling because we do it ourselves.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1743
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1744 @param evt event object to handle
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1745 @type QEvent
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1746 @return result of the event handling
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1747 @rtype bool
1443
9b9396fc54aa Fixed a compatibility issue with QScintilla 2.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
1748 """
9b9396fc54aa Fixed a compatibility issue with QScintilla 2.6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
1749 return QsciScintillaBase.event(self, evt)
325
dd7377dbd057 Fixed the issue with autocompletion lists staying on screen after editor looses focus.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
1750
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
1751 ###########################################################################
3169
7b1b754a60a6 Implemented a workaround for a non-working implementation of inputMethodEvent() in QScintilla 2.8.x. It simply overwrites these methods with empty ones in order to not loose selected text on focus out.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
1752 ## interface methods to the mini editor
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
1753 ###########################################################################
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1754
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1755 def getFileName(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1756 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1757 Public method to return the name of the file being displayed.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1758
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1759 @return filename of the displayed file
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1760 @rtype str
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1761 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1762 p = self.parent()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1763 if p is None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1764 return ""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1765 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1766 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1767 return p.getFileName()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1768 except AttributeError:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1769 return ""
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1770
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
1771 ###########################################################################
3169
7b1b754a60a6 Implemented a workaround for a non-working implementation of inputMethodEvent() in QScintilla 2.8.x. It simply overwrites these methods with empty ones in order to not loose selected text on focus out.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
1772 ## replacements for buggy methods
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
1773 ###########################################################################
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1774
8489
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1775 def showUserList(self, listId, lst):
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1776 """
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1777 Public method to show a user supplied list.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1778
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1779 @param listId id of the list
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1780 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1781 @param lst list to be show
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1782 @type list of str
8489
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1783 """
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1784 if listId <= 0:
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1785 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1786
8489
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1787 # Setup seperator for user lists
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1788 self.SendScintilla(QsciScintilla.SCI_AUTOCSETSEPARATOR, ord(self.UserSeparator))
8489
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1789 self.SendScintilla(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1790 QsciScintilla.SCI_USERLISTSHOW,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1791 listId,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1792 self._encodeString(self.UserSeparator.join(lst)),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1793 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1794
8489
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1795 self.updateUserListSize()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1796
8489
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1797 def autoCompleteFromDocument(self):
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1798 """
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1799 Public method to resize list box after creation.
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1800 """
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1801 super().autoCompleteFromDocument()
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1802 self.updateUserListSize()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1803
8489
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1804 def autoCompleteFromAPIs(self):
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1805 """
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1806 Public method to resize list box after creation.
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1807 """
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1808 super().autoCompleteFromAPIs()
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1809 self.updateUserListSize()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1810
8489
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1811 def autoCompleteFromAll(self):
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1812 """
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1813 Public method to resize list box after creation.
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1814 """
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1815 super().autoCompleteFromAll()
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1816 self.updateUserListSize()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1817
8489
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1818 ###########################################################################
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1819 ## work-around for buggy behavior
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1820 ###########################################################################
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1821
8489
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1822 def updateUserListSize(self):
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1823 """
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1824 Public method to resize the completion list to fit with contents.
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1825 """
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1826 children = self.findChildren(QListWidget)
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1827 if children:
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1828 userListWidget = children[-1]
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1829 hScrollbar = userListWidget.horizontalScrollBar()
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1830 if hScrollbar.isVisible():
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1831 hScrollbarHeight = hScrollbar.sizeHint().height()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1832
8489
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1833 geom = userListWidget.geometry()
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1834 geom.setHeight(geom.height() + hScrollbarHeight)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1835
8489
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1836 charPos = self.SendScintilla(QsciScintilla.SCI_GETCURRENTPOS)
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1837 currentYPos = self.SendScintilla(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1838 QsciScintilla.SCI_POINTYFROMPOSITION, 0, charPos
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1839 )
8489
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1840 if geom.y() < currentYPos:
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1841 geom.setY(geom.y() - hScrollbarHeight)
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1842 moveY = True
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1843 else:
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1844 moveY = False
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1845
8489
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1846 userListWidget.setGeometry(geom)
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1847 if moveY:
45af30c5561d QsciScintillaCompat: reworked the recent changes again.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8481
diff changeset
1848 userListWidget.move(geom.x(), geom.y() - hScrollbarHeight)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1849
10069
435cc5875135 Corrected and checked some code style issues (unused function arguments).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9977
diff changeset
1850 @pyqtSlot(int, str)
10346
96b387d43981 Corrected a glitch in 'QsciScintillaCompat.py'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10257
diff changeset
1851 def __userListActivated(self, listId, txt):
448
a1f1b226ff4b Fixed a few unicode related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 404
diff changeset
1852 """
3238
fa28dab59a9e Implemented a work-around for a buggy behavior for Qt5, where application focus is given to a completion list but not returned after selecting an entry by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3233
diff changeset
1853 Private slot to handle the selection from the completion list.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1854
3238
fa28dab59a9e Implemented a work-around for a buggy behavior for Qt5, where application focus is given to a completion list but not returned after selecting an entry by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3233
diff changeset
1855 Note: This works around an issue of some window managers taking
fa28dab59a9e Implemented a work-around for a buggy behavior for Qt5, where application focus is given to a completion list but not returned after selecting an entry by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3233
diff changeset
1856 focus away from the application when clicked inside a completion
fa28dab59a9e Implemented a work-around for a buggy behavior for Qt5, where application focus is given to a completion list but not returned after selecting an entry by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3233
diff changeset
1857 list but not giving it back when an item is selected via a
fa28dab59a9e Implemented a work-around for a buggy behavior for Qt5, where application focus is given to a completion list but not returned after selecting an entry by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3233
diff changeset
1858 double-click.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1859
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1860 @param listId the ID of the user list
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1861 @type int
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1862 @param txt the selected text
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1863 @type str
3238
fa28dab59a9e Implemented a work-around for a buggy behavior for Qt5, where application focus is given to a completion list but not returned after selecting an entry by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3233
diff changeset
1864 """
fa28dab59a9e Implemented a work-around for a buggy behavior for Qt5, where application focus is given to a completion list but not returned after selecting an entry by double-clicking it.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3233
diff changeset
1865 self.activateWindow()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1866
4433
7ab862396a8a Workaround for missing lines at vertical scroll bar caused by annotations.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4331
diff changeset
1867 def updateVerticalScrollBar(self):
7ab862396a8a Workaround for missing lines at vertical scroll bar caused by annotations.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4331
diff changeset
1868 """
7ab862396a8a Workaround for missing lines at vertical scroll bar caused by annotations.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4331
diff changeset
1869 Public method to update the vertical scroll bar to reflect the
7ab862396a8a Workaround for missing lines at vertical scroll bar caused by annotations.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4331
diff changeset
1870 additional lines added by annotations.
7ab862396a8a Workaround for missing lines at vertical scroll bar caused by annotations.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4331
diff changeset
1871 """
7ab862396a8a Workaround for missing lines at vertical scroll bar caused by annotations.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4331
diff changeset
1872 # Workaround because Scintilla.Redraw isn't implemented
7ab862396a8a Workaround for missing lines at vertical scroll bar caused by annotations.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4331
diff changeset
1873 self.SendScintilla(QsciScintilla.SCI_SETVSCROLLBAR, 0)
7ab862396a8a Workaround for missing lines at vertical scroll bar caused by annotations.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4331
diff changeset
1874 self.SendScintilla(QsciScintilla.SCI_SETVSCROLLBAR, 1)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1875
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
1876 ###########################################################################
3169
7b1b754a60a6 Implemented a workaround for a non-working implementation of inputMethodEvent() in QScintilla 2.8.x. It simply overwrites these methods with empty ones in order to not loose selected text on focus out.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3164
diff changeset
1877 ## utility methods
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
1878 ###########################################################################
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1879
502
7500b9d5b21d Fixed an issue in the editor related to unicode handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 448
diff changeset
1880 def _encodeString(self, string):
7500b9d5b21d Fixed an issue in the editor related to unicode handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 448
diff changeset
1881 """
7500b9d5b21d Fixed an issue in the editor related to unicode handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 448
diff changeset
1882 Protected method to encode a string depending on the current mode.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1883
10431
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1884 @param string string to be encoded
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1885 @type str
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1886 @return encoded string
64157aeb0312 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10346
diff changeset
1887 @rtype bytes
502
7500b9d5b21d Fixed an issue in the editor related to unicode handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 448
diff changeset
1888 """
7500b9d5b21d Fixed an issue in the editor related to unicode handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 448
diff changeset
1889 if isinstance(string, bytes):
7500b9d5b21d Fixed an issue in the editor related to unicode handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 448
diff changeset
1890 return string
448
a1f1b226ff4b Fixed a few unicode related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 404
diff changeset
1891 else:
502
7500b9d5b21d Fixed an issue in the editor related to unicode handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 448
diff changeset
1892 if self.isUtf8():
7500b9d5b21d Fixed an issue in the editor related to unicode handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 448
diff changeset
1893 return string.encode("utf-8")
7500b9d5b21d Fixed an issue in the editor related to unicode handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 448
diff changeset
1894 else:
7500b9d5b21d Fixed an issue in the editor related to unicode handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 448
diff changeset
1895 return string.encode("latin-1")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1896
6841
43af1e698c9d Editor: added extended regular expression support (C++11) as of QScintilla 2.11.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6734
diff changeset
1897 #########################################################################
6843
5e1afd1577b9 Editor: added these capabilities
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6841
diff changeset
1898 ## Methods below are missing from QScintilla.
5e1afd1577b9 Editor: added these capabilities
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6841
diff changeset
1899 #########################################################################
5e1afd1577b9 Editor: added these capabilities
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6841
diff changeset
1900
5e1afd1577b9 Editor: added these capabilities
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6841
diff changeset
1901 if "setWrapStartIndent" not in QsciScintilla.__dict__:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1902
6843
5e1afd1577b9 Editor: added these capabilities
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6841
diff changeset
1903 def setWrapStartIndent(self, indent):
5e1afd1577b9 Editor: added these capabilities
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6841
diff changeset
1904 """
5e1afd1577b9 Editor: added these capabilities
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6841
diff changeset
1905 Public method to set a the amount of characters wrapped sublines
5e1afd1577b9 Editor: added these capabilities
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6841
diff changeset
1906 shall be indented.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1907
6843
5e1afd1577b9 Editor: added these capabilities
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6841
diff changeset
1908 @param indent amount of characters to indent
5e1afd1577b9 Editor: added these capabilities
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6841
diff changeset
1909 @type int
5e1afd1577b9 Editor: added these capabilities
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6841
diff changeset
1910 """
5e1afd1577b9 Editor: added these capabilities
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6841
diff changeset
1911 self.SendScintilla(QsciScintilla.SCI_SETWRAPSTARTINDENT, indent)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1912
7998
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7954
diff changeset
1913 if "getGlobalCursorPosition" not in QsciScintilla.__dict__:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1914
7998
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7954
diff changeset
1915 def getGlobalCursorPosition(self):
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7954
diff changeset
1916 """
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7954
diff changeset
1917 Public method to determine the point of the cursor.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1918
7998
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7954
diff changeset
1919 @return point of the cursor
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7954
diff changeset
1920 @rtype QPoint
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7954
diff changeset
1921 """
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7954
diff changeset
1922 pos = self.currentPosition()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1923 x = self.SendScintilla(QsciScintilla.SCI_POINTXFROMPOSITION, 0, pos)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1924 y = self.SendScintilla(QsciScintilla.SCI_POINTYFROMPOSITION, 0, pos)
7998
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7954
diff changeset
1925 return QPoint(x, y)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1926
8581
a6c893c8b7af Editor: some fine tuning in handling of mouse hover help and goto lists.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8489
diff changeset
1927 if "cancelCallTips" not in QsciScintilla.__dict__:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1928
8581
a6c893c8b7af Editor: some fine tuning in handling of mouse hover help and goto lists.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8489
diff changeset
1929 def cancelCallTips(self):
a6c893c8b7af Editor: some fine tuning in handling of mouse hover help and goto lists.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8489
diff changeset
1930 """
a6c893c8b7af Editor: some fine tuning in handling of mouse hover help and goto lists.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8489
diff changeset
1931 Public method to cancel displayed call tips.
a6c893c8b7af Editor: some fine tuning in handling of mouse hover help and goto lists.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8489
diff changeset
1932 """
a6c893c8b7af Editor: some fine tuning in handling of mouse hover help and goto lists.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8489
diff changeset
1933 self.SendScintilla(QsciScintilla.SCI_CALLTIPCANCEL)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1934
8713
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8581
diff changeset
1935 if "lineIndexFromPoint" not in QsciScintilla.__dict__:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1936
8713
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8581
diff changeset
1937 def lineIndexFromPoint(self, point):
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8581
diff changeset
1938 """
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8581
diff changeset
1939 Public method to convert a point to line and index.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1940
8713
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8581
diff changeset
1941 @param point point to be converted
10497
0d7f1c8cd219 Corrected a typo.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
1942 @type QPoint
8713
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8581
diff changeset
1943 @return tuple containing the line number and index number
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8581
diff changeset
1944 @rtype tuple of (int, int)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8581
diff changeset
1945 """
8716
7bd161e50995 QsciScintillaCompat: harmonized some code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8713
diff changeset
1946 pos = self.positionFromPoint(point)
8713
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8581
diff changeset
1947 return self.lineIndexFromPosition(pos)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1948
10244
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
1949 if "setPrintColorMode" not in QsciScintilla.__dict__:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
1950
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
1951 def setPrintColorMode(self, colorMode):
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
1952 """
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
1953 Public method to set the print color mode (i.e. background handling).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
1954
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
1955 @param colorMode color mode to be set
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
1956 @type QsciScintillaPrintColorMode
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
1957 """
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
1958 self.SendScintilla(QsciScintilla.SCI_SETPRINTCOLOURMODE, colorMode)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
1959
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1960
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
1961 ## #########################################################################
6843
5e1afd1577b9 Editor: added these capabilities
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6841
diff changeset
1962 ## ## Methods below have been added to QScintilla starting with version 2.x.
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
1963 ## #########################################################################
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
1964 ##
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1965 ## if "newMethod" not in QsciScintilla.__dict__:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1966 ## def newMethod(self, param):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1967 ## """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1968 ## Public method to do something.
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
1969 ##
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1970 ## @param param parameter for method
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1971 ## """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1972 ## pass
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1973 ##

eric ide

mercurial