eric6/QScintilla/QsciScintillaCompat.py

Sat, 27 Jun 2020 12:08:12 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 27 Jun 2020 12:08:12 +0200
changeset 7639
422fd05e9c91
parent 7360
9190402e4505
child 7746
12d5e1e6abd1
permissions
-rw-r--r--

Removed some more Python2 related code.

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
7360
9190402e4505 Updated copyright for 2020.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7348
diff changeset
3 # Copyright (c) 2004 - 2020 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
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2472
diff changeset
10
6305
7652b925c25e Resize auto complete list box to fit with contents.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6285
diff changeset
11 from PyQt5.QtCore import pyqtSignal, Qt, QPoint
7652b925c25e Resize auto complete list box to fit with contents.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6285
diff changeset
12 from PyQt5.QtGui import QPalette, QColor, QFontMetrics
7652b925c25e Resize auto complete list box to fit with contents.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6285
diff changeset
13 from PyQt5.QtWidgets import QApplication, QListWidget
7267
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
14 from PyQt5.Qsci import (
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
15 QsciScintillaBase, QsciScintilla,
3070
04e342ebf697 Fixed an issue in QsciScintillaCompat related to an old QScintilla change (snapshots report their correct to be version).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3069
diff changeset
16 QSCINTILLA_VERSION as QSCIQSCINTILLA_VERSION
7267
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
17 )
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
19 ###############################################################################
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20
2077
68a34718a0ce Made the first set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1518
diff changeset
21
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 def QSCINTILLA_VERSION():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 Module function to return the QScintilla version.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 @return QScintilla version (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 """
3070
04e342ebf697 Fixed an issue in QsciScintillaCompat related to an old QScintilla change (snapshots report their correct to be version).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3069
diff changeset
28 return QSCIQSCINTILLA_VERSION
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
30 ###############################################################################
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
32
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 class QsciScintillaCompat(QsciScintilla):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 Class implementing a compatability interface to QsciScintilla.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 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
38 QsciScintilla incrementally. This class ensures compatibility
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 to older versions of QsciScintilla.
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
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
41 @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
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)
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
44
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
45 ArrowFoldStyle = QsciScintilla.BoxedTreeFoldStyle + 1
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
330
4b4f242bf3f6 Added additional fold styles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 325
diff changeset
47
448
a1f1b226ff4b Fixed a few unicode related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 404
diff changeset
48 UserSeparator = '\x04'
a1f1b226ff4b Fixed a few unicode related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 404
diff changeset
49
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
50 if QSCINTILLA_VERSION() < 0x020A00:
6932
8a3df4c6ac9a Continued implementing the Python AST Viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6891
diff changeset
51 IndicatorStyleMax = QsciScintilla.INDIC_TEXTFORE
6948
c6e580fd9bb1 QsciScintillaCompat: fixed a bug causing issues with older PyQt5 versions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
52 elif QSCINTILLA_VERSION() < 0x020B00:
6932
8a3df4c6ac9a Continued implementing the Python AST Viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6891
diff changeset
53 IndicatorStyleMax = QsciScintilla.INDIC_POINTCHARACTER
3069
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
54 else:
6932
8a3df4c6ac9a Continued implementing the Python AST Viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6891
diff changeset
55 IndicatorStyleMax = QsciScintilla.INDIC_GRADIENTCENTRE
3069
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
56
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
57 def __init__(self, parent=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 @param parent parent widget (QWidget)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2472
diff changeset
63 super(QsciScintillaCompat, self).__init__(parent)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 self.zoom = 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 self.__targetSearchFlags = 0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 self.__targetSearchExpr = ""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 self.__targetSearchStart = 0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 self.__targetSearchEnd = -1
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 self.__targetSearchActive = False
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
72
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
73 self.__modified = False
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
74
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
75 self.userListActivated.connect(self.__completionListSelected)
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
76 self.modificationChanged.connect(self.__modificationChanged)
6305
7652b925c25e Resize auto complete list box to fit with contents.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6285
diff changeset
77
7652b925c25e Resize auto complete list box to fit with contents.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6285
diff changeset
78 self.maxLines = 5
7652b925c25e Resize auto complete list box to fit with contents.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6285
diff changeset
79 self.maxChars = 40
7652b925c25e Resize auto complete list box to fit with contents.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6285
diff changeset
80 # Adjust the min. size of the autocomplete list box for short strings.
7652b925c25e Resize auto complete list box to fit with contents.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6285
diff changeset
81 # Otherwise the width of the list box is at least the standard width.
7652b925c25e Resize auto complete list box to fit with contents.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6285
diff changeset
82 self.SendScintilla(QsciScintilla.SCI_AUTOCSETMAXWIDTH, 5)
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
83
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
84 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
85 """
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
86 Private slot to handle the modificationChanged signal.
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
87
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
88 @param m modification status (boolean)
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 """
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 self.__modified = 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
91
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
92 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
93 """
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
94 Public method to return the modification status.
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 @return flag indicating the modification status (boolean)
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
97 """
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 return self.__modified
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 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
101 """
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
102 Public slot to set the modification status.
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
103
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 @param m new modification status (boolean)
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 """
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
106 self.__modified = m
3484
645c12de6b0c Merge with default branch.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3178 3393
diff changeset
107 super(QsciScintillaCompat, self).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
108 self.modificationChanged.emit(m)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
110 def setLexer(self, lex=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112 Public method to set the lexer.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114 @param lex the lexer to be set or None to reset it.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2472
diff changeset
116 super(QsciScintillaCompat, self).setLexer(lex)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117 if lex is None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 self.clearStyles()
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 def clearStyles(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122 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
123 """
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
124 palette = QApplication.palette()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 self.SendScintilla(QsciScintilla.SCI_STYLESETFORE,
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3011
diff changeset
126 QsciScintilla.STYLE_DEFAULT,
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3011
diff changeset
127 palette.color(QPalette.Text))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128 self.SendScintilla(QsciScintilla.SCI_STYLESETBACK,
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3011
diff changeset
129 QsciScintilla.STYLE_DEFAULT,
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3011
diff changeset
130 palette.color(QPalette.Base))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
131 self.SendScintilla(QsciScintilla.SCI_STYLECLEARALL)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132 self.SendScintilla(QsciScintilla.SCI_CLEARDOCUMENTSTYLE)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134 def monospacedStyles(self, font):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136 Public method to set the current style to be monospaced.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138 @param font font to be used (QFont)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
139 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
140 try:
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
141 rangeLow = list(range(self.STYLE_DEFAULT))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
142 except AttributeError:
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
143 rangeLow = list(range(32))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144 try:
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
145 rangeHigh = list(range(self.STYLE_LASTPREDEFINED + 1,
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3011
diff changeset
146 self.STYLE_MAX + 1))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147 except AttributeError:
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
148 rangeHigh = list(range(40, 128))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149
4331
711e7c35a49b Changed code to make eric compatible to PyQt 5.5 (QByteArry issue).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4253
diff changeset
150 f = font.family().encode("utf-8")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
151 ps = font.pointSize()
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
152 weight = -font.weight()
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
153 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
154 underline = font.underline()
2564
3eb07bb2afd4 Fixed an issue in QsciScintillaCompat setting monospaced styles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2537
diff changeset
155 bold = font.bold()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
156 for style in rangeLow + rangeHigh:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 self.SendScintilla(QsciScintilla.SCI_STYLESETFONT, style, f)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 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
159 try:
3011
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
160 self.SendScintilla(
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
161 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
162 except AttributeError:
3eb07bb2afd4 Fixed an issue in QsciScintillaCompat setting monospaced styles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2537
diff changeset
163 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
164 self.SendScintilla(QsciScintilla.SCI_STYLESETITALIC, style, italic)
3011
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
165 self.SendScintilla(
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
166 QsciScintilla.SCI_STYLESETUNDERLINE, style, underline)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
168 def linesOnScreen(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
170 Public method to get the amount of visible lines.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
171
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
172 @return amount of visible lines (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
173 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
174 return self.SendScintilla(QsciScintilla.SCI_LINESONSCREEN)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
175
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
176 def lineAt(self, pos):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
177 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
178 Public method to calculate the line at a position.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
179
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
180 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
181 margins and for empty lines.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
182
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
183 @param pos position to calculate the line for (integer or QPoint)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
184 @return linenumber at position or -1, if there is no line at pos
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
185 (integer, zero based)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
186 """
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
187 if isinstance(pos, int):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
188 scipos = pos
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189 else:
7267
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
190 scipos = self.SendScintilla(
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
191 QsciScintilla.SCI_POSITIONFROMPOINT,
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
192 pos.x(), pos.y()
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
193 )
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
194 line = self.SendScintilla(QsciScintilla.SCI_LINEFROMPOSITION, scipos)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
195 if line >= self.lines():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
196 line = -1
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
197 return line
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
198
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
199 def currentPosition(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
201 Public method to get the current position.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
202
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203 @return absolute position of the cursor (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
204 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
205 return self.SendScintilla(QsciScintilla.SCI_GETCURRENTPOS)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
206
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
207 def styleAt(self, pos):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
209 Public method to get the style at a position in the text.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
210
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
211 @param pos position in the text (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
212 @return style at the requested position or 0, if the position
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
213 is negative or past the end of the document (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
214 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
215 return self.SendScintilla(QsciScintilla.SCI_GETSTYLEAT, pos)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
216
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
217 def currentStyle(self):
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 Public method to get the style at the current position.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
220
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
221 @return style at the current position (integer)
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 return self.styleAt(self.currentPosition())
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
224
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
225 def getEndStyled(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
226 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
227 Public method to get the last styled position.
2965
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2763
diff changeset
228
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2763
diff changeset
229 @return end position of the last styling run (integer)
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_GETENDSTYLED)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
232
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
233 def startStyling(self, pos, mask):
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 prepare styling.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
236
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
237 @param pos styling positition to start at (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
238 @param mask mask of bits to use for styling (integer)
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 self.SendScintilla(QsciScintilla.SCI_STARTSTYLING, pos, mask)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
241
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
242 def setStyling(self, length, style):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
243 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
244 Public method to style some text.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
245
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
246 @param length length of text to style (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
247 @param style style to set for text (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
248 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
249 self.SendScintilla(QsciScintilla.SCI_SETSTYLING, length, style)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
250
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
251 def charAt(self, pos):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
252 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
253 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
254 multibyte characters.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
255
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
256 @param pos position in the text (integer)
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
257 @return character at the requested position or empty string, if the
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
258 position is negative or past the end of the document (string)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
259 """
25
5163e6f94ba5 Ported the exporters to Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
260 ch = self.byteAt(pos)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
261 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
262 if (ch[0] & 0xF0) == 0xF0:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
263 utf8Len = 4
25
5163e6f94ba5 Ported the exporters to Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
264 elif (ch[0] & 0xE0) == 0xE0:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
265 utf8Len = 3
25
5163e6f94ba5 Ported the exporters to Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
266 elif (ch[0] & 0xC0) == 0xC0:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
267 utf8Len = 2
3493
71f15675e89f Fixed an issue in QsciScintillaCompat.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3393
diff changeset
268 else:
71f15675e89f Fixed an issue in QsciScintillaCompat.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3393
diff changeset
269 utf8Len = 1
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
270 while len(ch) < utf8Len:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
271 pos += 1
25
5163e6f94ba5 Ported the exporters to Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
272 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
273 try:
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
274 return ch.decode('utf8')
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
275 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
276 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
277 # 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
278 # 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
279 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
280 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
281 return ""
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
282 else:
25
5163e6f94ba5 Ported the exporters to Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
283 return ch.decode()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
284
25
5163e6f94ba5 Ported the exporters to Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
285 def byteAt(self, pos):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
286 """
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
287 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
288 text.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
290 @param pos position in the text (integer)
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
291 @return raw character at the requested position or empty bytes, if the
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
292 position is negative or past the end of the document (bytes)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
293 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
294 char = self.SendScintilla(QsciScintilla.SCI_GETCHARAT, pos)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 if char == 0:
2684
b1d8db9a31bc Fix for the PDF exporter.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2677
diff changeset
296 return bytearray()
25
5163e6f94ba5 Ported the exporters to Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
297 if char < 0:
5163e6f94ba5 Ported the exporters to Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
298 char += 256
2684
b1d8db9a31bc Fix for the PDF exporter.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2677
diff changeset
299 return bytearray((char,))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
300
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
301 def foldLevelAt(self, line):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
302 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
303 Public method to get the fold level of a line of the document.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
304
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
305 @param line line number (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
306 @return fold level of the given line (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
307 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
308 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
309 return (
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
310 (lvl & QsciScintilla.SC_FOLDLEVELNUMBERMASK) -
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
311 QsciScintilla.SC_FOLDLEVELBASE
7267
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
312 )
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
313
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
314 def foldFlagsAt(self, line):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
315 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
316 Public method to get the fold flags of a line of the document.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
317
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
318 @param line line number (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
319 @return fold flags of the given line (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
320 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
321 lvl = self.SendScintilla(QsciScintilla.SCI_GETFOLDLEVEL, line)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
322 return lvl & ~QsciScintilla.SC_FOLDLEVELNUMBERMASK
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
323
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
324 def foldHeaderAt(self, line):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
325 """
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
326 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
327 line.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
328
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
329 @param line line number (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
330 @return flag indicating a fold header line (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
331 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
332 lvl = self.SendScintilla(QsciScintilla.SCI_GETFOLDLEVEL, line)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
333 return lvl & QsciScintilla.SC_FOLDLEVELHEADERFLAG
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
334
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
335 def foldExpandedAt(self, line):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
336 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
337 Public method to determine, if a fold is expanded.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
338
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
339 @param line line number (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
340 @return flag indicating the fold expansion state of the line (boolean)
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 return self.SendScintilla(QsciScintilla.SCI_GETFOLDEXPANDED, line)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
343
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
344 def setIndentationGuideView(self, view):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
345 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
346 Public method to set the view of the indentation guides.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
347
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
348 @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
349 SC_IV_LOOKFORWARD or SC_IV_LOOKBOTH)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
350 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
351 self.SendScintilla(QsciScintilla.SCI_SETINDENTATIONGUIDES, view)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
352
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
353 def indentationGuideView(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
354 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
355 Public method to get the indentation guide view.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
356
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
357 @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
358 SC_IV_LOOKFORWARD or SC_IV_LOOKBOTH)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
359 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
360 return self.SendScintilla(QsciScintilla.SCI_GETINDENTATIONGUIDES)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
361
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
362 ###########################################################################
2659
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2658
diff changeset
363 ## methods below are missing from QScintilla
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
364 ###########################################################################
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
365
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
366 def zoomIn(self, zoom=1):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
367 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
368 Public method used to increase the zoom factor.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
369
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
370 @param zoom zoom factor increment (integer)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
371 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2472
diff changeset
372 super(QsciScintillaCompat, self).zoomIn(zoom)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
373
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
374 def zoomOut(self, zoom=1):
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 Public method used to decrease the zoom factor.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
377
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
378 @param zoom zoom factor decrement (integer)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
379 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2472
diff changeset
380 super(QsciScintillaCompat, self).zoomOut(zoom)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
381
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
382 def zoomTo(self, zoom):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
383 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
384 Public method used to zoom to a specific zoom factor.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
385
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
386 @param zoom zoom factor (integer)
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 self.zoom = zoom
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2472
diff changeset
389 super(QsciScintillaCompat, self).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
390 self.zoomValueChanged.emit(self.zoom)
0
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 def getZoom(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
393 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
394 Public method used to retrieve the current zoom factor.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
395
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
396 @return zoom factor (integer)
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 return self.zoom
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
399
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
400 def editorCommand(self, cmd):
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 perform a simple editor command.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
403
502
7500b9d5b21d Fixed an issue in the editor related to unicode handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 448
diff changeset
404 @param cmd the scintilla command to be performed (integer)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
405 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
406 self.SendScintilla(cmd)
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 def scrollVertical(self, lines):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
409 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
410 Public method to scroll the text area.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
411
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
412 @param lines number of lines to scroll (negative scrolls up,
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
413 positive scrolls down) (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
414 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
415 self.SendScintilla(QsciScintilla.SCI_LINESCROLL, 0, lines)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
416
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
417 def moveCursorToEOL(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
418 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
419 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
420 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
421 self.SendScintilla(QsciScintilla.SCI_LINEEND)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
422
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
423 def moveCursorLeft(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
424 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
425 Public method to move the cursor left.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
426 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
427 self.SendScintilla(QsciScintilla.SCI_CHARLEFT)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
428
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
429 def moveCursorRight(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
430 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
431 Public method to move the cursor right.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
432 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
433 self.SendScintilla(QsciScintilla.SCI_CHARRIGHT)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
434
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
435 def moveCursorWordLeft(self):
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 to move the cursor left one word.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
438 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
439 self.SendScintilla(QsciScintilla.SCI_WORDLEFT)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
440
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
441 def moveCursorWordRight(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
442 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
443 Public method to move the cursor right one word.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
444 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
445 self.SendScintilla(QsciScintilla.SCI_WORDRIGHT)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
446
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
447 def newLineBelow(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
448 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
449 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
450 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
451 self.SendScintilla(QsciScintilla.SCI_LINEEND)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
452 self.SendScintilla(QsciScintilla.SCI_NEWLINE)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
453
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
454 def deleteBack(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
455 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
456 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
457 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
458 self.SendScintilla(QsciScintilla.SCI_DELETEBACK)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
459
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
460 def delete(self):
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 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
463 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
464 self.SendScintilla(QsciScintilla.SCI_CLEAR)
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 def deleteWordLeft(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
467 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
468 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
469 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
470 self.SendScintilla(QsciScintilla.SCI_DELWORDLEFT)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
471
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
472 def deleteWordRight(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
473 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
474 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
475 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
476 self.SendScintilla(QsciScintilla.SCI_DELWORDRIGHT)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
477
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
478 def deleteLineLeft(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
479 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
480 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
481 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
482 self.SendScintilla(QsciScintilla.SCI_DELLINELEFT)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
483
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
484 def deleteLineRight(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
485 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
486 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
487 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
488 self.SendScintilla(QsciScintilla.SCI_DELLINERIGHT)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
489
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
490 def extendSelectionLeft(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
491 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
492 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
493 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
494 self.SendScintilla(QsciScintilla.SCI_CHARLEFTEXTEND)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
495
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
496 def extendSelectionRight(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
497 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
498 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
499 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
500 self.SendScintilla(QsciScintilla.SCI_CHARRIGHTEXTEND)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
501
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
502 def extendSelectionWordLeft(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
503 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
504 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
505 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
506 self.SendScintilla(QsciScintilla.SCI_WORDLEFTEXTEND)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
507
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
508 def extendSelectionWordRight(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
509 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
510 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
511 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
512 self.SendScintilla(QsciScintilla.SCI_WORDRIGHTEXTEND)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
513
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
514 def extendSelectionToBOL(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
515 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
516 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
517 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
518 self.SendScintilla(QsciScintilla.SCI_VCHOMEEXTEND)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
519
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
520 def extendSelectionToEOL(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 extend the selection to the end of the line.
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_LINEENDEXTEND)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
525
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
526 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
527 """
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
528 Public method to check for a selection.
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
529
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
530 @return flag indicating the presence of a selection (boolean)
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
531 """
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
532 return self.getSelection()[0] != -1
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
533
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
534 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
535 """
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
536 Public method to indicate the presence of selected text.
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
537
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
538 This is an overriding method to cope with a bug in QsciScintilla.
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
539
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
540 @return flag indicating the presence of selected text (boolean)
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
541 """
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
542 return bool(self.selectedText())
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
543
2587
68cc83a68883 Added a function to QsciScintillaCompat to check for a rectangular selection.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2564
diff changeset
544 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
545 """
68cc83a68883 Added a function to QsciScintillaCompat to check for a rectangular selection.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2564
diff changeset
546 Public method to check, if the current selection is rectangular.
68cc83a68883 Added a function to QsciScintillaCompat to check for a rectangular selection.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2564
diff changeset
547
2653
94ff2db166f5 Fixed a typo in some source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2650
diff changeset
548 @return flag indicating a rectangular selection (boolean)
2587
68cc83a68883 Added a function to QsciScintillaCompat to check for a rectangular selection.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2564
diff changeset
549 """
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
550 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
551 return (
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
552 startLine != -1 and
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
553 startLine != endLine and
3039
8dd0165d805d Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
554 self.SendScintilla(QsciScintilla.SCI_SELECTIONISRECTANGLE)
7267
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
555 )
2587
68cc83a68883 Added a function to QsciScintillaCompat to check for a rectangular selection.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2564
diff changeset
556
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
557 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
558 """
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
559 Public method to retrieve the start and end of a rectangular selection.
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
560
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
561 @return tuple with start line and index and end line and index
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
562 (tuple of four int)
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
563 """
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
564 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
565 return (-1, -1, -1, -1)
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
566
3011
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
567 startPos = self.SendScintilla(
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
568 QsciScintilla.SCI_GETRECTANGULARSELECTIONANCHOR)
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
569 endPos = self.SendScintilla(
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
570 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
571 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
572 endLine, endIndex = self.lineIndexFromPosition(endPos)
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
573
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
574 return (startLine, startIndex, endLine, endIndex)
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
575
3011
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
576 def setRectangularSelection(self, startLine, startIndex, endLine,
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
577 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
578 """
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
579 Public method to set a rectangular selection.
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
580
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
581 @param startLine line number of the start of the selection (int)
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
582 @param startIndex index number of the start of the selection (int)
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
583 @param endLine line number of the end of the selection (int)
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
584 @param endIndex index number of the end of the selection (int)
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
585 """
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
586 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
587 endPos = self.positionFromLineIndex(endLine, endIndex)
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
588
3011
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
589 self.SendScintilla(
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
590 QsciScintilla.SCI_SETRECTANGULARSELECTIONANCHOR, startPos)
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
591 self.SendScintilla(
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
592 QsciScintilla.SCI_SETRECTANGULARSELECTIONCARET, endPos)
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
593
2658
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
594 def getSelectionCount(self):
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
595 """
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
596 Public method to get the number of active selections.
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
597
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
598 @return number of active selection (integer)
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
599 """
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
600 return self.SendScintilla(QsciScintilla.SCI_GETSELECTIONS)
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
601
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
602 def getSelectionN(self, index):
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
603 """
2965
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2763
diff changeset
604 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
605 index.
2658
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
606
2965
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2763
diff changeset
607 @param index index of the selection (integer)
2658
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
608 @return tuple with start line and index and end line and index
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
609 (tuple of four int) for the given selection
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
610 """
3011
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
611 startPos = self.SendScintilla(
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
612 QsciScintilla.SCI_GETSELECTIONNSTART, index)
2658
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
613 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
614 startLine, startIndex = self.lineIndexFromPosition(startPos)
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
615 endLine, endIndex = self.lineIndexFromPosition(endPos)
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
616
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
617 return (startLine, startIndex, endLine, endIndex)
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
618
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
619 def getSelections(self):
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
620 """
3011
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
621 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
622 selections.
2658
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
623
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
624 @return list of tuples with start line and index and end line and index
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
625 of each active selection (list of tuples of four int)
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
626 """
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
627 selections = []
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
628 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
629 selections.append(self.getSelectionN(index))
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
630 return selections
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
631
2659
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2658
diff changeset
632 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
633 """
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2658
diff changeset
634 Public method to set the virtual space usage options.
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2658
diff changeset
635
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2658
diff changeset
636 @param options usage options to set (integer, 0 to 3)
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2658
diff changeset
637 """
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2658
diff changeset
638 self.SendScintilla(QsciScintilla.SCI_SETVIRTUALSPACEOPTIONS, options)
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2658
diff changeset
639
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
640 def getLineSeparator(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
641 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
642 Public method to get the line separator for the current eol mode.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
643
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
644 @return eol string (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
645 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
646 m = self.eolMode()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
647 if m == QsciScintilla.EolWindows:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
648 eol = '\r\n'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
649 elif m == QsciScintilla.EolUnix:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
650 eol = '\n'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
651 elif m == QsciScintilla.EolMac:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
652 eol = '\r'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
653 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
654 eol = ''
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
655 return eol
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
656
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
657 def getEolIndicator(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
658 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
659 Public method to get the eol indicator for the current eol mode.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
660
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
661 @return eol indicator (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
662 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
663 m = self.eolMode()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
664 if m == QsciScintilla.EolWindows:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
665 eol = 'CRLF'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
666 elif m == QsciScintilla.EolUnix:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
667 eol = 'LF'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
668 elif m == QsciScintilla.EolMac:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
669 eol = 'CR'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
670 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
671 eol = ''
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
672 return eol
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
673
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
674 def setEolModeByEolString(self, eolStr):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
675 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
676 Public method to set the eol mode given the eol string.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
677
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
678 @param eolStr eol string (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
679 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
680 if eolStr == '\r\n':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
681 self.setEolMode(QsciScintilla.EolMode(QsciScintilla.EolWindows))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
682 elif eolStr == '\n':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
683 self.setEolMode(QsciScintilla.EolMode(QsciScintilla.EolUnix))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
684 elif eolStr == '\r':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
685 self.setEolMode(QsciScintilla.EolMode(QsciScintilla.EolMac))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
686
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
687 def detectEolString(self, txt):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
688 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
689 Public method to determine the eol string used.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
690
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
691 @param txt text from which to determine the eol string (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
692 @return eol string (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
693 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
694 if len(txt.split("\r\n", 1)) == 2:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
695 return '\r\n'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
696 elif len(txt.split("\n", 1)) == 2:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
697 return '\n'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
698 elif len(txt.split("\r", 1)) == 2:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
699 return '\r'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
700 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
701 return None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
702
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
703 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
704 """
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
705 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
706 milliseconds.
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
707
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
708 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
709 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
710 flash time, then hidden for the same amount of 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
711
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
712 @return flash time of the cursor in milliseconds (integer)
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
713 """
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
714 return 2 * self.SendScintilla(QsciScintilla.SCI_GETCARETPERIOD)
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
715
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
716 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
717 """
4020
ea66934c7d74 Corrected a source docu typo.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3933
diff changeset
718 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
719 milliseconds.
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
720
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
721 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
722 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
723 flash time, then hidden for the same amount of 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
724
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
725 @param time flash time of the cursor in milliseconds (integer)
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
726 """
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
727 self.SendScintilla(QsciScintilla.SCI_SETCARETPERIOD, time // 2)
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
728
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
729 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
730 """
8fd7ae10de2b Implemented support for the new QScintilla feature to always highlight the caret line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3039
diff changeset
731 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
732 the editor doesn't have the focus.
3078
b9422535d0fe Corrected an incomplete source docu string.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3071
diff changeset
733
b9422535d0fe Corrected an incomplete source docu string.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3071
diff changeset
734 @return flag indicating an always visible caret line (boolean)
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
735 """
8fd7ae10de2b Implemented support for the new QScintilla feature to always highlight the caret line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3039
diff changeset
736 try:
8fd7ae10de2b Implemented support for the new QScintilla feature to always highlight the caret line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3039
diff changeset
737 return self.SendScintilla(
8fd7ae10de2b Implemented support for the new QScintilla feature to always highlight the caret line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3039
diff changeset
738 QsciScintilla.SCI_GETCARETLINEVISIBLEALWAYS)
8fd7ae10de2b Implemented support for the new QScintilla feature to always highlight the caret line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3039
diff changeset
739 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
740 return False
8fd7ae10de2b Implemented support for the new QScintilla feature to always highlight the caret line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3039
diff changeset
741
8fd7ae10de2b Implemented support for the new QScintilla feature to always highlight the caret line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3039
diff changeset
742 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
743 """
8fd7ae10de2b Implemented support for the new QScintilla feature to always highlight the caret line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3039
diff changeset
744 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
745 have the focus.
8fd7ae10de2b Implemented support for the new QScintilla feature to always highlight the caret line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3039
diff changeset
746
8fd7ae10de2b Implemented support for the new QScintilla feature to always highlight the caret line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3039
diff changeset
747 @param alwaysVisible flag indicating that the caret line shall be
8fd7ae10de2b Implemented support for the new QScintilla feature to always highlight the caret line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3039
diff changeset
748 visible even if the editor doesn't have the focus (boolean)
8fd7ae10de2b Implemented support for the new QScintilla feature to always highlight the caret line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3039
diff changeset
749 """
8fd7ae10de2b Implemented support for the new QScintilla feature to always highlight the caret line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3039
diff changeset
750 try:
8fd7ae10de2b Implemented support for the new QScintilla feature to always highlight the caret line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3039
diff changeset
751 self.SendScintilla(
8fd7ae10de2b Implemented support for the new QScintilla feature to always highlight the caret line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3039
diff changeset
752 QsciScintilla.SCI_SETCARETLINEVISIBLEALWAYS, 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
753 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
754 pass
8fd7ae10de2b Implemented support for the new QScintilla feature to always highlight the caret line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3039
diff changeset
755
6059
8f7c66c53c27 Added a context menu entry to "Execute Selection In Console".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
756 def canPaste(self):
8f7c66c53c27 Added a context menu entry to "Execute Selection In Console".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
757 """
8f7c66c53c27 Added a context menu entry to "Execute Selection In Console".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
758 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
759 clipboard contains some text).
8f7c66c53c27 Added a context menu entry to "Execute Selection In Console".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
760
8f7c66c53c27 Added a context menu entry to "Execute Selection In Console".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
761 @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
762 @rtype bool
8f7c66c53c27 Added a context menu entry to "Execute Selection In Console".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
763 """
8f7c66c53c27 Added a context menu entry to "Execute Selection In Console".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
764 return self.SendScintilla(QsciScintilla.SCI_CANPASTE)
8f7c66c53c27 Added a context menu entry to "Execute Selection In Console".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
765
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
766 ###########################################################################
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
767 ## 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
768 ###########################################################################
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
769
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
770 def positionFromPoint(self, point):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
771 """
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
772 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
773 window.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
774
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
775 @param point point in the window (QPoint)
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
776 @return scintilla position (integer) or -1 to indicate, that the point
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
777 is not near any character
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
778 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
779 return self.SendScintilla(QsciScintilla.SCI_POSITIONFROMPOINTCLOSE,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
780 point.x(), point.y())
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
781
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
782 def positionBefore(self, pos):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
783 """
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
784 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
785 account multibyte characters.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
786
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
787 @param pos position (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
788 @return position before the given one (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
789 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
790 return self.SendScintilla(QsciScintilla.SCI_POSITIONBEFORE, pos)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
791
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
792 def positionAfter(self, pos):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
793 """
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
794 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
795 account multibyte characters.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
796
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
797 @param pos position (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
798 @return position after the given one (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
799 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
800 return self.SendScintilla(QsciScintilla.SCI_POSITIONAFTER, pos)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
801
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
802 def lineEndPosition(self, line):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
803 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
804 Public method to determine the line end position of the given line.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
805
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
806 @param line line number (integer)
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
807 @return position of the line end disregarding line end characters
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
808 (integer)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
809 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
810 return self.SendScintilla(QsciScintilla.SCI_GETLINEENDPOSITION, line)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
811
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
812 def __doSearchTarget(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
813 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
814 Private method to perform the search in target.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
815
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
816 @return flag indicating a successful search (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
817 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
818 if self.__targetSearchStart == self.__targetSearchEnd:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
819 self.__targetSearchActive = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
820 return False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
821
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
822 self.SendScintilla(QsciScintilla.SCI_SETTARGETSTART,
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
823 self.__targetSearchStart)
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
824 self.SendScintilla(QsciScintilla.SCI_SETTARGETEND,
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
825 self.__targetSearchEnd)
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
826 self.SendScintilla(QsciScintilla.SCI_SETSEARCHFLAGS,
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
827 self.__targetSearchFlags)
502
7500b9d5b21d Fixed an issue in the editor related to unicode handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 448
diff changeset
828 targetSearchExpr = self._encodeString(self.__targetSearchExpr)
7500b9d5b21d Fixed an issue in the editor related to unicode handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 448
diff changeset
829 pos = self.SendScintilla(QsciScintilla.SCI_SEARCHINTARGET,
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
830 len(targetSearchExpr),
502
7500b9d5b21d Fixed an issue in the editor related to unicode handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 448
diff changeset
831 targetSearchExpr)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
832
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
833 if pos == -1:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
834 self.__targetSearchActive = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
835 return False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
836
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
837 targend = self.SendScintilla(QsciScintilla.SCI_GETTARGETEND)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
838 self.__targetSearchStart = targend
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
839
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
840 return True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
841
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
842 def getFoundTarget(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
843 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
844 Public method to get the recently found target.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
845
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
846 @return found target as a tuple of starting position and target length
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
847 (integer, integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
848 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
849 if self.__targetSearchActive:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
850 spos = self.SendScintilla(QsciScintilla.SCI_GETTARGETSTART)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
851 epos = self.SendScintilla(QsciScintilla.SCI_GETTARGETEND)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
852 return (spos, epos - spos)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
853 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
854 return (0, 0)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
855
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
856 def findFirstTarget(self, expr_, re_, cs_, wo_,
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3011
diff changeset
857 begline=-1, begindex=-1, endline=-1, endindex=-1,
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
858 ws_=False, posix=False, cxx11=False):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
859 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
860 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
861 setting the selection.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
862
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
863 @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
864 @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
865 @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
866 @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
867 @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
868 @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
869 @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
870 @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
871 @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
872 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
873 @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
874 @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
875 @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
876 @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
877 @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
878 @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
879 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
880 @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
881 @param ws_ flag indicating a word start search (boolean)
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
882 @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
883 @param 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
884 @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
885 @param 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
886 @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
887 @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
888 @rtype bool
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
889 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
890 self.__targetSearchFlags = 0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
891 if re_:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
892 self.__targetSearchFlags |= QsciScintilla.SCFIND_REGEXP
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
893 if cs_:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
894 self.__targetSearchFlags |= QsciScintilla.SCFIND_MATCHCASE
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
895 if wo_:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
896 self.__targetSearchFlags |= QsciScintilla.SCFIND_WHOLEWORD
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
897 if ws_:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
898 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
899 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
900 self.__targetSearchFlags |= QsciScintilla.SCFIND_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
901 try:
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
902 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
903 self.__targetSearchFlags |= QsciScintilla.SCFIND_CXX11REGEX
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
904 except AttributeError:
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
905 # defined for QScintilla >= 2.11.0
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
906 pass
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
907
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
908 if begline < 0 or begindex < 0:
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
909 self.__targetSearchStart = self.SendScintilla(
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
910 QsciScintilla.SCI_GETCURRENTPOS)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
911 else:
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
912 self.__targetSearchStart = self.positionFromLineIndex(
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
913 begline, begindex)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
914
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
915 if endline < 0 or endindex < 0:
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
916 self.__targetSearchEnd = self.SendScintilla(
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
917 QsciScintilla.SCI_GETTEXTLENGTH)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
918 else:
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
919 self.__targetSearchEnd = self.positionFromLineIndex(
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
920 endline, endindex)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
921
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
922 self.__targetSearchExpr = expr_
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
923
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
924 if self.__targetSearchExpr:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
925 self.__targetSearchActive = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
926
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
927 return self.__doSearchTarget()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
928
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
929 return False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
930
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
931 def findNextTarget(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
932 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
933 Public method to find the next occurrence in the target range.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
934
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
935 @return flag indicating a successful search (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
936 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
937 if not self.__targetSearchActive:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
938 return False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
939
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
940 return self.__doSearchTarget()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
941
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
942 def replaceTarget(self, replaceStr):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
943 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
944 Public method to replace the string found by the last search in target.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
945
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
946 @param replaceStr replacement string or regexp (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
947 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
948 if not self.__targetSearchActive:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
949 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
950
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
951 if self.__targetSearchFlags & QsciScintilla.SCFIND_REGEXP:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
952 cmd = QsciScintilla.SCI_REPLACETARGETRE
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
953 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
954 cmd = QsciScintilla.SCI_REPLACETARGET
510
84257fe1c8b4 Fixed an issue in the editor related to unicode handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 502
diff changeset
955 r = self._encodeString(replaceStr)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
956
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
957 start = self.SendScintilla(QsciScintilla.SCI_GETTARGETSTART)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
958 self.SendScintilla(cmd, len(r), r)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
959
502
7500b9d5b21d Fixed an issue in the editor related to unicode handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 448
diff changeset
960 self.__targetSearchStart = start + len(r)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
961
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
962 ###########################################################################
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
963 ## indicator handling methods
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
964 ###########################################################################
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
965
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
966 def indicatorDefine(self, indicator, style, color):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
967 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
968 Public method to define the appearance of an indicator.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
969
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
970 @param indicator number of the indicator (integer,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
971 QsciScintilla.INDIC_CONTAINER .. QsciScintilla.INDIC_MAX)
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
972 @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
973 (QsciScintilla.INDIC_PLAIN, QsciScintilla.INDIC_SQUIGGLE,
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
974 QsciScintilla.INDIC_TT, QsciScintilla.INDIC_DIAGONAL,
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
975 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
976 QsciScintilla.INDIC_BOX, QsciScintilla.INDIC_ROUNDBOX,
6932
8a3df4c6ac9a Continued implementing the Python AST Viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6891
diff changeset
977 QsciScintilla.INDIC_STRAIGHTBOX, QsciScintilla.INDIC_FULLBOX,
8a3df4c6ac9a Continued implementing the Python AST Viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6891
diff changeset
978 QsciScintilla.INDIC_DASH, QsciScintilla.INDIC_DOTS,
8a3df4c6ac9a Continued implementing the Python AST Viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6891
diff changeset
979 QsciScintilla.INDIC_SQUIGGLELOW, QsciScintilla.INDIC_DOTBOX,
8a3df4c6ac9a Continued implementing the Python AST Viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6891
diff changeset
980 QsciScintilla.INDIC_GRADIENT, QsciScintilla.INDIC_GRADIENTCENTRE,
8a3df4c6ac9a Continued implementing the Python AST Viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6891
diff changeset
981 QsciScintilla.INDIC_SQUIGGLEPIXMAP,
8a3df4c6ac9a Continued implementing the Python AST Viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6891
diff changeset
982 QsciScintilla.INDIC_COMPOSITIONTHICK,
8a3df4c6ac9a Continued implementing the Python AST Viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6891
diff changeset
983 QsciScintilla.INDIC_COMPOSITIONTHIN, QsciScintilla.INDIC_TEXTFORE,
8a3df4c6ac9a Continued implementing the Python AST Viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6891
diff changeset
984 QsciScintilla.INDIC_POINT, QsciScintilla.INDIC_POINTCHARACTER
8a3df4c6ac9a Continued implementing the Python AST Viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6891
diff changeset
985 depending upon QScintilla version)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
986 @param color color to be used by the indicator (QColor)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
987 @exception ValueError the indicator or style are not valid
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
988 """
7267
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
989 if (
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
990 indicator < QsciScintilla.INDIC_CONTAINER or
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
991 indicator > QsciScintilla.INDIC_MAX
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
992 ):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
993 raise ValueError("indicator number out of range")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
994
7267
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
995 if (
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
996 style < QsciScintilla.INDIC_PLAIN or
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
997 style > self.IndicatorStyleMax
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
998 ):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
999 raise ValueError("style out of range")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1000
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1001 self.SendScintilla(QsciScintilla.SCI_INDICSETSTYLE, indicator, style)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1002 self.SendScintilla(QsciScintilla.SCI_INDICSETFORE, indicator, color)
942
1d2a6b8509c6 Added capability to configure the alpha channel for some colors (as of QScintilla 2.5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 938
diff changeset
1003 try:
1d2a6b8509c6 Added capability to configure the alpha channel for some colors (as of QScintilla 2.5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 938
diff changeset
1004 self.SendScintilla(QsciScintilla.SCI_INDICSETALPHA, indicator,
1d2a6b8509c6 Added capability to configure the alpha channel for some colors (as of QScintilla 2.5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 938
diff changeset
1005 color.alpha())
6932
8a3df4c6ac9a Continued implementing the Python AST Viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6891
diff changeset
1006 if style in (
8a3df4c6ac9a Continued implementing the Python AST Viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6891
diff changeset
1007 QsciScintilla.INDIC_ROUNDBOX, QsciScintilla.INDIC_STRAIGHTBOX,
8a3df4c6ac9a Continued implementing the Python AST Viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6891
diff changeset
1008 QsciScintilla.INDIC_DOTBOX, QsciScintilla.INDIC_FULLBOX,
8a3df4c6ac9a Continued implementing the Python AST Viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6891
diff changeset
1009 ):
8a3df4c6ac9a Continued implementing the Python AST Viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6891
diff changeset
1010 # set outline alpha less transparent
8a3df4c6ac9a Continued implementing the Python AST Viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6891
diff changeset
1011 self.SendScintilla(QsciScintilla.SCI_INDICSETOUTLINEALPHA,
8a3df4c6ac9a Continued implementing the Python AST Viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6891
diff changeset
1012 indicator, color.alpha() + 20)
942
1d2a6b8509c6 Added capability to configure the alpha channel for some colors (as of QScintilla 2.5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 938
diff changeset
1013 except AttributeError:
1d2a6b8509c6 Added capability to configure the alpha channel for some colors (as of QScintilla 2.5).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 938
diff changeset
1014 pass
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1015
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1016 def setCurrentIndicator(self, indicator):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1017 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1018 Public method to set the current indicator.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1019
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
1020 @param indicator number of the indicator (integer,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1021 QsciScintilla.INDIC_CONTAINER .. QsciScintilla.INDIC_MAX)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1022 @exception ValueError the indicator or style are not valid
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1023 """
7267
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
1024 if (
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
1025 indicator < QsciScintilla.INDIC_CONTAINER or
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
1026 indicator > QsciScintilla.INDIC_MAX
aedc309827c7 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
1027 ):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1028 raise ValueError("indicator number out of range")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1029
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1030 self.SendScintilla(QsciScintilla.SCI_SETINDICATORCURRENT, indicator)
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 def setIndicatorRange(self, indicator, spos, length):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1033 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1034 Public method to set an indicator for the given range.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1035
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
1036 @param indicator number of the indicator (integer,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1037 QsciScintilla.INDIC_CONTAINER .. QsciScintilla.INDIC_MAX)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1038 @param spos position of the indicator start (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1039 @param length length of the indicator (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1040 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1041 self.setCurrentIndicator(indicator)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1042 self.SendScintilla(QsciScintilla.SCI_INDICATORFILLRANGE, spos, length)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1043
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1044 def setIndicator(self, indicator, sline, sindex, eline, eindex):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1045 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1046 Public method to set an indicator for the given range.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1047
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
1048 @param indicator number of the indicator (integer,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1049 QsciScintilla.INDIC_CONTAINER .. QsciScintilla.INDIC_MAX)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1050 @param sline line number of the indicator start (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1051 @param sindex index of the indicator start (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1052 @param eline line number of the indicator end (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1053 @param eindex index of the indicator end (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1054 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1055 spos = self.positionFromLineIndex(sline, sindex)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1056 epos = self.positionFromLineIndex(eline, eindex)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1057 self.setIndicatorRange(indicator, spos, epos - spos)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1058
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1059 def clearIndicatorRange(self, indicator, spos, length):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1060 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1061 Public method to clear an indicator for the given range.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1062
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
1063 @param indicator number of the indicator (integer,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1064 QsciScintilla.INDIC_CONTAINER .. QsciScintilla.INDIC_MAX)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1065 @param spos position of the indicator start (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1066 @param length length of the indicator (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1067 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1068 self.setCurrentIndicator(indicator)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1069 self.SendScintilla(QsciScintilla.SCI_INDICATORCLEARRANGE, spos, length)
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 def clearIndicator(self, indicator, sline, sindex, eline, eindex):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1072 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1073 Public method to clear an indicator for the given range.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1074
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
1075 @param indicator number of the indicator (integer,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1076 QsciScintilla.INDIC_CONTAINER .. QsciScintilla.INDIC_MAX)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1077 @param sline line number of the indicator start (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1078 @param sindex index of the indicator start (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1079 @param eline line number of the indicator end (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1080 @param eindex index of the indicator end (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1081 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1082 spos = self.positionFromLineIndex(sline, sindex)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1083 epos = self.positionFromLineIndex(eline, eindex)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1084 self.clearIndicatorRange(indicator, spos, epos - spos)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1085
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1086 def clearAllIndicators(self, indicator):
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 Public method to clear all occurrences of an indicator.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1089
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
1090 @param indicator number of the indicator (integer,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1091 QsciScintilla.INDIC_CONTAINER .. QsciScintilla.INDIC_MAX)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1092 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1093 self.clearIndicatorRange(indicator, 0, self.length())
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1094
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1095 def hasIndicator(self, indicator, pos):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1096 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1097 Public method to test for the existence of an indicator.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1098
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
1099 @param indicator number of the indicator (integer,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1100 QsciScintilla.INDIC_CONTAINER .. QsciScintilla.INDIC_MAX)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1101 @param pos position to test (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1102 @return flag indicating the existence of the indicator (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1103 """
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
1104 res = self.SendScintilla(QsciScintilla.SCI_INDICATORVALUEAT,
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
1105 indicator, pos)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1106 return res
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1107
3069
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1108 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
1109 """
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1110 Public method to show the find indicator for the given range.
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1111
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1112 @param sline line number of the indicator start (integer)
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1113 @param sindex index of the indicator start (integer)
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1114 @param eline line number of the indicator end (integer)
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1115 @param eindex index of the indicator end (integer)
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1116 """
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1117 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
1118 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
1119 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
1120 self.SendScintilla(QsciScintilla.SCI_FINDINDICATORSHOW, spos, epos)
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1121
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1122 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
1123 """
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1124 Public method to flash the find indicator for the given range.
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1125
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1126 @param sline line number of the indicator start (integer)
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1127 @param sindex index of the indicator start (integer)
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1128 @param eline line number of the indicator end (integer)
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1129 @param eindex index of the indicator end (integer)
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <de&