QScintilla/QsciScintillaCompat.py

Tue, 05 Mar 2019 19:00:06 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 05 Mar 2019 19:00:06 +0100
changeset 6841
43af1e698c9d
parent 6734
1eaf6955acf5
child 6843
5e1afd1577b9
permissions
-rw-r--r--

Editor: added extended regular expression support (C++11) as of QScintilla 2.11.0.

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
6645
ad476851d7e0 Updated copyright for 2019.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6313
diff changeset
3 # Copyright (c) 2004 - 2019 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
3145
a9de05d4a22f # __IGNORE_WARNING__ added/ removed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3080
diff changeset
10 from __future__ import unicode_literals
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
11
6305
7652b925c25e Resize auto complete list box to fit with contents.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6285
diff changeset
12 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
13 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
14 from PyQt5.QtWidgets import QApplication, QListWidget
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
15 from PyQt5.Qsci import 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
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
18 ###############################################################################
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19
2077
68a34718a0ce Made the first set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1518
diff changeset
20
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 def QSCINTILLA_VERSION():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 Module function to return the QScintilla version.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 @return QScintilla version (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 """
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
27 return QSCIQSCINTILLA_VERSION
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
29 ###############################################################################
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
31
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 class QsciScintillaCompat(QsciScintilla):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 Class implementing a compatability interface to QsciScintilla.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 This class implements all the functions, that were added to
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 QsciScintilla incrementally. This class ensures compatibility
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 to older versions of QsciScintilla.
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
39
a4a4d710ebe8 Fixed the feedback of a changed zoom value from the editors, shell or terminal to the view manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
40 @signal zoomValueChanged(int) emitted to signal a change of the zoom value
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 """
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
42 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
43
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
44 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
45 ArrowTreeFoldStyle = ArrowFoldStyle + 1
330
4b4f242bf3f6 Added additional fold styles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 325
diff changeset
46
448
a1f1b226ff4b Fixed a few unicode related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 404
diff changeset
47 UserSeparator = '\x04'
a1f1b226ff4b Fixed a few unicode related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 404
diff changeset
48
3069
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
49 if QSCINTILLA_VERSION() < 0x020600:
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
50 IndicatorStyleMax = QsciScintilla.INDIC_ROUNDBOX
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
51 elif QSCINTILLA_VERSION() < 0x020700:
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
52 IndicatorStyleMax = QsciScintilla.INDIC_DOTBOX
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
53 elif QSCINTILLA_VERSION() < 0x020800:
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
54 IndicatorStyleMax = QsciScintilla.INDIC_SQUIGGLEPIXMAP
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
55 else:
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
56 IndicatorStyleMax = QsciScintilla.INDIC_COMPOSITIONTHICK
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
57
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
58 def __init__(self, parent=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 @param parent parent widget (QWidget)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 """
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
64 super(QsciScintillaCompat, self).__init__(parent)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 self.zoom = 0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 self.__targetSearchFlags = 0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 self.__targetSearchExpr = ""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 self.__targetSearchStart = 0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 self.__targetSearchEnd = -1
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 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
73
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
74 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
75
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
76 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
77 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
78
7652b925c25e Resize auto complete list box to fit with contents.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6285
diff changeset
79 self.maxLines = 5
7652b925c25e Resize auto complete list box to fit with contents.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6285
diff changeset
80 self.maxChars = 40
7652b925c25e Resize auto complete list box to fit with contents.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6285
diff changeset
81 # 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
82 # 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
83 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
84
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 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
86 """
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 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
88
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 @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
90 """
080ace4829b4 Extended QsciScintillaCompat to allow to set the modified status and made the selection of an encoding in the editor change the modified state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3390
diff changeset
91 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
92
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 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
94 """
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 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
96
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 @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
98 """
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 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
100
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 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
102 """
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 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
104
080ace4829b4 Extended QsciScintillaCompat to allow to set the modified status and made the selection of an encoding in the editor change the modified state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3390
diff changeset
105 @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
106 """
080ace4829b4 Extended QsciScintillaCompat to allow to set the modified status and made the selection of an encoding in the editor change the modified state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3390
diff changeset
107 self.__modified = m
3484
645c12de6b0c Merge with default branch.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3178 3393
diff changeset
108 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
109 self.modificationChanged.emit(m)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
111 def setLexer(self, lex=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113 Public method to set the lexer.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 @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
116 """
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
117 super(QsciScintillaCompat, self).setLexer(lex)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 if lex is None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119 self.clearStyles()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 def clearStyles(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 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
124 """
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
125 palette = QApplication.palette()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 self.SendScintilla(QsciScintilla.SCI_STYLESETFORE,
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3011
diff changeset
127 QsciScintilla.STYLE_DEFAULT,
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3011
diff changeset
128 palette.color(QPalette.Text))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 self.SendScintilla(QsciScintilla.SCI_STYLESETBACK,
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3011
diff changeset
130 QsciScintilla.STYLE_DEFAULT,
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3011
diff changeset
131 palette.color(QPalette.Base))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132 self.SendScintilla(QsciScintilla.SCI_STYLECLEARALL)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133 self.SendScintilla(QsciScintilla.SCI_CLEARDOCUMENTSTYLE)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135 def monospacedStyles(self, font):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137 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
138
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
139 @param font font to be used (QFont)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
140 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 try:
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
142 rangeLow = list(range(self.STYLE_DEFAULT))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
143 except AttributeError:
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
144 rangeLow = list(range(32))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145 try:
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
146 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
147 self.STYLE_MAX + 1))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148 except AttributeError:
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
149 rangeHigh = list(range(40, 128))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
150
4331
711e7c35a49b Changed code to make eric compatible to PyQt 5.5 (QByteArry issue).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4253
diff changeset
151 f = font.family().encode("utf-8")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
152 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
153 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
154 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
155 underline = font.underline()
2564
3eb07bb2afd4 Fixed an issue in QsciScintillaCompat setting monospaced styles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2537
diff changeset
156 bold = font.bold()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 for style in rangeLow + rangeHigh:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 self.SendScintilla(QsciScintilla.SCI_STYLESETFONT, style, f)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159 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
160 try:
3011
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
161 self.SendScintilla(
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
162 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
163 except AttributeError:
3eb07bb2afd4 Fixed an issue in QsciScintillaCompat setting monospaced styles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2537
diff changeset
164 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
165 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
166 self.SendScintilla(
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
167 QsciScintilla.SCI_STYLESETUNDERLINE, style, underline)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
168
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169 def linesOnScreen(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
170 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
171 Public method to get the amount of visible lines.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
172
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
173 @return amount of visible lines (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
174 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
175 return self.SendScintilla(QsciScintilla.SCI_LINESONSCREEN)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
176
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
177 def lineAt(self, pos):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
178 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
179 Public method to calculate the line at a position.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
180
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
181 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
182 margins and for empty lines.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
183
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
184 @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
185 @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
186 (integer, zero based)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
187 """
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
188 if isinstance(pos, int):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189 scipos = pos
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
190 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
191 scipos = \
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
192 self.SendScintilla(QsciScintilla.SCI_POSITIONFROMPOINT,
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
193 pos.x(), pos.y())
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)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
309 return \
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
310 (lvl & QsciScintilla.SC_FOLDLEVELNUMBERMASK) - \
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
311 QsciScintilla.SC_FOLDLEVELBASE
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
312
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
313 def foldFlagsAt(self, line):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
314 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
315 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
316
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
317 @param line line number (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
318 @return fold flags of the given line (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
319 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
320 lvl = self.SendScintilla(QsciScintilla.SCI_GETFOLDLEVEL, line)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
321 return lvl & ~QsciScintilla.SC_FOLDLEVELNUMBERMASK
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
322
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
323 def foldHeaderAt(self, line):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
324 """
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
325 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
326 line.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
327
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
328 @param line line number (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
329 @return flag indicating a fold header line (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
330 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
331 lvl = self.SendScintilla(QsciScintilla.SCI_GETFOLDLEVEL, line)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
332 return lvl & QsciScintilla.SC_FOLDLEVELHEADERFLAG
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
333
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
334 def foldExpandedAt(self, line):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
335 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
336 Public method to determine, if a fold is expanded.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
337
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
338 @param line line number (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
339 @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
340 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
341 return self.SendScintilla(QsciScintilla.SCI_GETFOLDEXPANDED, line)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
342
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
343 def setIndentationGuideView(self, view):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
344 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
345 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
346
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
347 @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
348 SC_IV_LOOKFORWARD or SC_IV_LOOKBOTH)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
349 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
350 self.SendScintilla(QsciScintilla.SCI_SETINDENTATIONGUIDES, view)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
351
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
352 def indentationGuideView(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
353 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
354 Public method to get the indentation guide view.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
355
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
356 @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
357 SC_IV_LOOKFORWARD or SC_IV_LOOKBOTH)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
358 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
359 return self.SendScintilla(QsciScintilla.SCI_GETINDENTATIONGUIDES)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
360
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
361 ###########################################################################
2659
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2658
diff changeset
362 ## methods below are missing from QScintilla
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
363 ###########################################################################
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
364
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
365 def zoomIn(self, zoom=1):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
366 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
367 Public method used to increase the zoom factor.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
368
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
369 @param zoom zoom factor increment (integer)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
370 """
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
371 super(QsciScintillaCompat, self).zoomIn(zoom)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
372
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
373 def zoomOut(self, zoom=1):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
374 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
375 Public method used to decrease the zoom factor.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
376
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
377 @param zoom zoom factor decrement (integer)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
378 """
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
379 super(QsciScintillaCompat, self).zoomOut(zoom)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
380
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
381 def zoomTo(self, zoom):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
382 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
383 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
384
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
385 @param zoom zoom factor (integer)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
386 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
387 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
388 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
389 self.zoomValueChanged.emit(self.zoom)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
390
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
391 def getZoom(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
392 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
393 Public method used to retrieve the current zoom factor.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
394
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
395 @return zoom factor (integer)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
396 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
397 return self.zoom
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
398
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
399 def editorCommand(self, cmd):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
400 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
401 Public method to perform a simple editor command.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
402
502
7500b9d5b21d Fixed an issue in the editor related to unicode handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 448
diff changeset
403 @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
404 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
405 self.SendScintilla(cmd)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
406
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
407 def scrollVertical(self, lines):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
408 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
409 Public method to scroll the text area.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
410
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
411 @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
412 positive scrolls down) (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
413 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
414 self.SendScintilla(QsciScintilla.SCI_LINESCROLL, 0, lines)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
415
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
416 def moveCursorToEOL(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
417 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
418 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
419 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
420 self.SendScintilla(QsciScintilla.SCI_LINEEND)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
421
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
422 def moveCursorLeft(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
423 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
424 Public method to move the cursor left.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
425 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
426 self.SendScintilla(QsciScintilla.SCI_CHARLEFT)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
427
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
428 def moveCursorRight(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
429 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
430 Public method to move the cursor right.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
431 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
432 self.SendScintilla(QsciScintilla.SCI_CHARRIGHT)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
433
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
434 def moveCursorWordLeft(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
435 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
436 Public method to move the cursor left one word.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
437 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
438 self.SendScintilla(QsciScintilla.SCI_WORDLEFT)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
439
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
440 def moveCursorWordRight(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
441 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
442 Public method to move the cursor right one word.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
443 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
444 self.SendScintilla(QsciScintilla.SCI_WORDRIGHT)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
445
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
446 def newLineBelow(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
447 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
448 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
449 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
450 self.SendScintilla(QsciScintilla.SCI_LINEEND)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
451 self.SendScintilla(QsciScintilla.SCI_NEWLINE)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
452
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
453 def deleteBack(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
454 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
455 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
456 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
457 self.SendScintilla(QsciScintilla.SCI_DELETEBACK)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
458
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
459 def delete(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
460 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
461 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
462 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
463 self.SendScintilla(QsciScintilla.SCI_CLEAR)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
464
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
465 def deleteWordLeft(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
466 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
467 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
468 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
469 self.SendScintilla(QsciScintilla.SCI_DELWORDLEFT)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
470
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
471 def deleteWordRight(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
472 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
473 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
474 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
475 self.SendScintilla(QsciScintilla.SCI_DELWORDRIGHT)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
476
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
477 def deleteLineLeft(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
478 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
479 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
480 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
481 self.SendScintilla(QsciScintilla.SCI_DELLINELEFT)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
482
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
483 def deleteLineRight(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
484 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
485 Public method to delete the line to the right of the cursor.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
486 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
487 self.SendScintilla(QsciScintilla.SCI_DELLINERIGHT)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
488
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
489 def extendSelectionLeft(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
490 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
491 Public method to extend the selection one character to the left.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
492 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
493 self.SendScintilla(QsciScintilla.SCI_CHARLEFTEXTEND)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
494
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
495 def extendSelectionRight(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
496 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
497 Public method to extend the selection one character to the right.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
498 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
499 self.SendScintilla(QsciScintilla.SCI_CHARRIGHTEXTEND)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
500
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
501 def extendSelectionWordLeft(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
502 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
503 Public method to extend the selection one word to the left.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
504 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
505 self.SendScintilla(QsciScintilla.SCI_WORDLEFTEXTEND)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
506
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
507 def extendSelectionWordRight(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
508 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
509 Public method to extend the selection one word to the right.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
510 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
511 self.SendScintilla(QsciScintilla.SCI_WORDRIGHTEXTEND)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
512
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
513 def extendSelectionToBOL(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
514 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
515 Public method to extend the selection to the beginning of the line.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
516 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
517 self.SendScintilla(QsciScintilla.SCI_VCHOMEEXTEND)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
518
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
519 def extendSelectionToEOL(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
520 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
521 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
522 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
523 self.SendScintilla(QsciScintilla.SCI_LINEENDEXTEND)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
524
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
525 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
526 """
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 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
528
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 @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
530 """
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 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
532
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
533 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
534 """
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 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
536
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 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
538
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 @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
540 """
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 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
542
2587
68cc83a68883 Added a function to QsciScintillaCompat to check for a rectangular selection.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2564
diff changeset
543 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
544 """
68cc83a68883 Added a function to QsciScintillaCompat to check for a rectangular selection.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2564
diff changeset
545 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
546
2653
94ff2db166f5 Fixed a typo in some source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2650
diff changeset
547 @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
548 """
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
549 startLine, startIndex, endLine, endIndex = self.getSelection()
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 return startLine != -1 and \
3039
8dd0165d805d Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
551 startLine != endLine and \
8dd0165d805d Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
552 self.SendScintilla(QsciScintilla.SCI_SELECTIONISRECTANGLE)
2587
68cc83a68883 Added a function to QsciScintillaCompat to check for a rectangular selection.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2564
diff changeset
553
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
554 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
555 """
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
556 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
557
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 @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
559 (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
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 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
562 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
563
3011
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
564 startPos = self.SendScintilla(
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
565 QsciScintilla.SCI_GETRECTANGULARSELECTIONANCHOR)
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
566 endPos = self.SendScintilla(
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
567 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
568 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
569 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
570
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 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
572
3011
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
573 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
574 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
575 """
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
576 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
577
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 @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
579 @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
580 @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
581 @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
582 """
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 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
584 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
585
3011
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
586 self.SendScintilla(
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
587 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
588 self.SendScintilla(
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
589 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
590
2658
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
591 def getSelectionCount(self):
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
592 """
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
593 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
594
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
595 @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
596 """
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
597 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
598
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
599 def getSelectionN(self, index):
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
600 """
2965
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2763
diff changeset
601 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
602 index.
2658
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 @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
605 @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
606 (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
607 """
3011
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
608 startPos = self.SendScintilla(
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
609 QsciScintilla.SCI_GETSELECTIONNSTART, index)
2658
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
610 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
611 startLine, startIndex = self.lineIndexFromPosition(startPos)
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
612 endLine, endIndex = self.lineIndexFromPosition(endPos)
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
613
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
614 return (startLine, startIndex, endLine, endIndex)
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
615
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
616 def getSelections(self):
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
617 """
3011
18292228c724 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
618 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
619 selections.
2658
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
620
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
621 @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
622 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
623 """
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
624 selections = []
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
625 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
626 selections.append(self.getSelectionN(index))
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
627 return selections
ec17f5d559e9 Added methods to QsciScintillaCompat to handle multiple selections.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2653
diff changeset
628
2659
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2658
diff changeset
629 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
630 """
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2658
diff changeset
631 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
632
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2658
diff changeset
633 @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
634 """
7f46c5a7ed73 Added support for virtual space to the Editor and Mini Editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2658
diff changeset
635 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
636
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
637 def getLineSeparator(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
638 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
639 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
640
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
641 @return eol string (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
642 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
643 m = self.eolMode()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
644 if m == QsciScintilla.EolWindows:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
645 eol = '\r\n'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
646 elif m == QsciScintilla.EolUnix:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
647 eol = '\n'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
648 elif m == QsciScintilla.EolMac:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
649 eol = '\r'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
650 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
651 eol = ''
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
652 return eol
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
653
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
654 def getEolIndicator(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
655 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
656 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
657
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
658 @return eol indicator (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
659 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
660 m = self.eolMode()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
661 if m == QsciScintilla.EolWindows:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
662 eol = 'CRLF'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
663 elif m == QsciScintilla.EolUnix:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
664 eol = 'LF'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
665 elif m == QsciScintilla.EolMac:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
666 eol = 'CR'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
667 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
668 eol = ''
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
669 return eol
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
670
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
671 def setEolModeByEolString(self, eolStr):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
672 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
673 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
674
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
675 @param eolStr eol string (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
676 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
677 if eolStr == '\r\n':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
678 self.setEolMode(QsciScintilla.EolMode(QsciScintilla.EolWindows))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
679 elif eolStr == '\n':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
680 self.setEolMode(QsciScintilla.EolMode(QsciScintilla.EolUnix))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
681 elif eolStr == '\r':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
682 self.setEolMode(QsciScintilla.EolMode(QsciScintilla.EolMac))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
683
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
684 def detectEolString(self, txt):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
685 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
686 Public method to determine the eol string used.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
687
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
688 @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
689 @return eol string (string)
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 if len(txt.split("\r\n", 1)) == 2:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
692 return '\r\n'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
693 elif len(txt.split("\n", 1)) == 2:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
694 return '\n'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
695 elif len(txt.split("\r", 1)) == 2:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
696 return '\r'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
697 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
698 return None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
699
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
700 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
701 """
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
702 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
703 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
704
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
705 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
706 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
707 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
708
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
709 @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
710 """
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 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
712
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 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
714 """
4020
ea66934c7d74 Corrected a source docu typo.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3933
diff changeset
715 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
716 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
717
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
718 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
719 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
720 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
721
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
722 @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
723 """
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 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
725
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
726 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
727 """
8fd7ae10de2b Implemented support for the new QScintilla feature to always highlight the caret line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3039
diff changeset
728 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
729 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
730
b9422535d0fe Corrected an incomplete source docu string.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3071
diff changeset
731 @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
732 """
8fd7ae10de2b Implemented support for the new QScintilla feature to always highlight the caret line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3039
diff changeset
733 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
734 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
735 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
736 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
737 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
738
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 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
740 """
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 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
742 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
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 @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
745 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
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 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
748 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
749 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
750 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
751 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
752
6059
8f7c66c53c27 Added a context menu entry to "Execute Selection In Console".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
753 def canPaste(self):
8f7c66c53c27 Added a context menu entry to "Execute Selection In Console".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
754 """
8f7c66c53c27 Added a context menu entry to "Execute Selection In Console".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
755 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
756 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
757
8f7c66c53c27 Added a context menu entry to "Execute Selection In Console".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
758 @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
759 @rtype bool
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 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
762
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
763 ###########################################################################
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
764 ## 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
765 ###########################################################################
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
766
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
767 def positionFromPoint(self, point):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
768 """
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
769 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
770 window.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
771
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
772 @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
773 @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
774 is not near any character
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
775 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
776 return self.SendScintilla(QsciScintilla.SCI_POSITIONFROMPOINTCLOSE,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
777 point.x(), point.y())
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
778
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
779 def positionBefore(self, pos):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
780 """
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
781 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
782 account multibyte characters.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
783
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
784 @param pos position (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
785 @return position before the given one (integer)
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 return self.SendScintilla(QsciScintilla.SCI_POSITIONBEFORE, pos)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
788
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
789 def positionAfter(self, pos):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
790 """
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
791 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
792 account multibyte characters.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
793
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
794 @param pos position (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
795 @return position after the given one (integer)
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 return self.SendScintilla(QsciScintilla.SCI_POSITIONAFTER, pos)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
798
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
799 def lineEndPosition(self, line):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
800 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
801 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
802
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
803 @param line line number (integer)
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
804 @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
805 (integer)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
806 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
807 return self.SendScintilla(QsciScintilla.SCI_GETLINEENDPOSITION, line)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
808
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
809 def __doSearchTarget(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
810 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
811 Private method to perform the search in target.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
812
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
813 @return flag indicating a successful search (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
814 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
815 if self.__targetSearchStart == self.__targetSearchEnd:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
816 self.__targetSearchActive = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
817 return False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
818
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
819 self.SendScintilla(QsciScintilla.SCI_SETTARGETSTART,
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
820 self.__targetSearchStart)
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
821 self.SendScintilla(QsciScintilla.SCI_SETTARGETEND,
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
822 self.__targetSearchEnd)
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
823 self.SendScintilla(QsciScintilla.SCI_SETSEARCHFLAGS,
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
824 self.__targetSearchFlags)
502
7500b9d5b21d Fixed an issue in the editor related to unicode handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 448
diff changeset
825 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
826 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
827 len(targetSearchExpr),
502
7500b9d5b21d Fixed an issue in the editor related to unicode handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 448
diff changeset
828 targetSearchExpr)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
829
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
830 if pos == -1:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
831 self.__targetSearchActive = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
832 return False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
833
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
834 targend = self.SendScintilla(QsciScintilla.SCI_GETTARGETEND)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
835 self.__targetSearchStart = targend
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 return True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
838
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
839 def getFoundTarget(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
840 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
841 Public method to get the recently found target.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
842
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
843 @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
844 (integer, integer)
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 if self.__targetSearchActive:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
847 spos = self.SendScintilla(QsciScintilla.SCI_GETTARGETSTART)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
848 epos = self.SendScintilla(QsciScintilla.SCI_GETTARGETEND)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
849 return (spos, epos - spos)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
850 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
851 return (0, 0)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
852
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
853 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
854 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
855 ws_=False, posix=False, cxx11=False):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
856 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
857 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
858 setting the selection.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
859
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
860 @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
861 @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
862 @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
863 @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
864 @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
865 @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
866 @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
867 @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
868 @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
869 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
870 @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
871 @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
872 @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
873 @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
874 @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
875 @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
876 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 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
879 @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
880 @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
881 @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
882 @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
883 @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
884 @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
885 @rtype bool
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
886 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
887 self.__targetSearchFlags = 0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
888 if re_:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
889 self.__targetSearchFlags |= QsciScintilla.SCFIND_REGEXP
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
890 if cs_:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
891 self.__targetSearchFlags |= QsciScintilla.SCFIND_MATCHCASE
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
892 if wo_:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
893 self.__targetSearchFlags |= QsciScintilla.SCFIND_WHOLEWORD
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
894 if ws_:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
895 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
896 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
897 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
898 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
899 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
900 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
901 except AttributeError:
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 # defined for PyQt >= 2.11.0
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 pass
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
904
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
905 if begline < 0 or begindex < 0:
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
906 self.__targetSearchStart = self.SendScintilla(
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
907 QsciScintilla.SCI_GETCURRENTPOS)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
908 else:
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
909 self.__targetSearchStart = self.positionFromLineIndex(
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
910 begline, begindex)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
911
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
912 if endline < 0 or endindex < 0:
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
913 self.__targetSearchEnd = self.SendScintilla(
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
914 QsciScintilla.SCI_GETTEXTLENGTH)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
915 else:
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
916 self.__targetSearchEnd = self.positionFromLineIndex(
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
917 endline, endindex)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
918
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
919 self.__targetSearchExpr = expr_
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
920
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
921 if self.__targetSearchExpr:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
922 self.__targetSearchActive = True
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 return self.__doSearchTarget()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
925
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
926 return False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
927
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
928 def findNextTarget(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
929 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
930 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
931
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
932 @return flag indicating a successful search (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
933 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
934 if not self.__targetSearchActive:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
935 return False
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 return self.__doSearchTarget()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
938
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
939 def replaceTarget(self, replaceStr):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
940 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
941 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
942
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
943 @param replaceStr replacement string or regexp (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
944 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
945 if not self.__targetSearchActive:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
946 return
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 self.__targetSearchFlags & QsciScintilla.SCFIND_REGEXP:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
949 cmd = QsciScintilla.SCI_REPLACETARGETRE
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
950 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
951 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
952 r = self._encodeString(replaceStr)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
953
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
954 start = self.SendScintilla(QsciScintilla.SCI_GETTARGETSTART)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
955 self.SendScintilla(cmd, len(r), r)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
956
502
7500b9d5b21d Fixed an issue in the editor related to unicode handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 448
diff changeset
957 self.__targetSearchStart = start + len(r)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
958
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
959 ###########################################################################
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
960 ## indicator handling methods
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
961 ###########################################################################
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
962
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
963 def indicatorDefine(self, indicator, style, color):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
964 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
965 Public method to define the appearance of an indicator.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
966
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
967 @param indicator number of the indicator (integer,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
968 QsciScintilla.INDIC_CONTAINER .. QsciScintilla.INDIC_MAX)
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
969 @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
970 (QsciScintilla.INDIC_PLAIN, QsciScintilla.INDIC_SQUIGGLE,
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
971 QsciScintilla.INDIC_TT, QsciScintilla.INDIC_DIAGONAL,
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
972 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
973 QsciScintilla.INDIC_BOX, QsciScintilla.INDIC_ROUNDBOX,
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
974 QsciScintilla.INDIC_STRAIGHTBOX, QsciScintilla.INDIC_DASH,
3071
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3070
diff changeset
975 QsciScintilla.INDIC_DOTS, QsciScintilla.INDIC_SQUIGGLELOW,
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_DOTBOX, QsciScintilla.INDIC_SQUIGGLEPIXMAP,
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
977 QsciScintilla.INDIC_COMPOSITIONTHICK depending upon QScintilla
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
978 version)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
979 @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
980 @exception ValueError the indicator or style are not valid
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
981 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
982 if indicator < QsciScintilla.INDIC_CONTAINER or \
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
983 indicator > QsciScintilla.INDIC_MAX:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
984 raise ValueError("indicator number out of range")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
985
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
986 if style < QsciScintilla.INDIC_PLAIN or \
3069
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
987 style > self.IndicatorStyleMax:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
988 raise ValueError("style out of range")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
989
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
990 self.SendScintilla(QsciScintilla.SCI_INDICSETSTYLE, indicator, style)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
991 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
992 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
993 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
994 color.alpha())
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
995 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
996 pass
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
997
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
998 def setCurrentIndicator(self, indicator):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
999 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1000 Public method to set the current indicator.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1001
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
1002 @param indicator number of the indicator (integer,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1003 QsciScintilla.INDIC_CONTAINER .. QsciScintilla.INDIC_MAX)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1004 @exception ValueError the indicator or style are not valid
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1005 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1006 if indicator < QsciScintilla.INDIC_CONTAINER or \
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1007 indicator > QsciScintilla.INDIC_MAX:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1008 raise ValueError("indicator number out of range")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1009
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1010 self.SendScintilla(QsciScintilla.SCI_SETINDICATORCURRENT, indicator)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1011
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1012 def setIndicatorRange(self, indicator, spos, length):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1013 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1014 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
1015
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
1016 @param indicator number of the indicator (integer,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1017 QsciScintilla.INDIC_CONTAINER .. QsciScintilla.INDIC_MAX)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1018 @param spos position of the indicator start (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1019 @param length length of the indicator (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1020 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1021 self.setCurrentIndicator(indicator)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1022 self.SendScintilla(QsciScintilla.SCI_INDICATORFILLRANGE, spos, length)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1023
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1024 def setIndicator(self, indicator, sline, sindex, eline, eindex):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1025 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1026 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
1027
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
1028 @param indicator number of the indicator (integer,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1029 QsciScintilla.INDIC_CONTAINER .. QsciScintilla.INDIC_MAX)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1030 @param sline line number of the indicator start (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1031 @param sindex index of the indicator start (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1032 @param eline line number of the indicator end (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1033 @param eindex index of the indicator end (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1034 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1035 spos = self.positionFromLineIndex(sline, sindex)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1036 epos = self.positionFromLineIndex(eline, eindex)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1037 self.setIndicatorRange(indicator, spos, epos - spos)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1038
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1039 def clearIndicatorRange(self, indicator, spos, length):
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 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
1042
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
1043 @param indicator number of the indicator (integer,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1044 QsciScintilla.INDIC_CONTAINER .. QsciScintilla.INDIC_MAX)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1045 @param spos position of the indicator start (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1046 @param length length of the indicator (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1047 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1048 self.setCurrentIndicator(indicator)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1049 self.SendScintilla(QsciScintilla.SCI_INDICATORCLEARRANGE, spos, length)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1050
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1051 def clearIndicator(self, indicator, sline, sindex, eline, eindex):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1052 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1053 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
1054
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
1055 @param indicator number of the indicator (integer,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1056 QsciScintilla.INDIC_CONTAINER .. QsciScintilla.INDIC_MAX)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1057 @param sline line number of the indicator start (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1058 @param sindex index of the indicator start (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1059 @param eline line number of the indicator end (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1060 @param eindex index of the indicator end (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1061 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1062 spos = self.positionFromLineIndex(sline, sindex)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1063 epos = self.positionFromLineIndex(eline, eindex)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1064 self.clearIndicatorRange(indicator, spos, epos - spos)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1065
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1066 def clearAllIndicators(self, indicator):
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 Public method to clear all occurrences of an indicator.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1069
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
1070 @param indicator number of the indicator (integer,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1071 QsciScintilla.INDIC_CONTAINER .. QsciScintilla.INDIC_MAX)
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 self.clearIndicatorRange(indicator, 0, self.length())
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1074
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1075 def hasIndicator(self, indicator, pos):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1076 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1077 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
1078
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 944
diff changeset
1079 @param indicator number of the indicator (integer,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1080 QsciScintilla.INDIC_CONTAINER .. QsciScintilla.INDIC_MAX)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1081 @param pos position to test (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1082 @return flag indicating the existence of the indicator (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1083 """
937
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
1084 res = self.SendScintilla(QsciScintilla.SCI_INDICATORVALUEAT,
336c8f1ee7bb Adjusted QsciScintillaCompat to QScintilla 2.5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 826
diff changeset
1085 indicator, pos)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1086 return res
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1087
3069
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1088 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
1089 """
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1090 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
1091
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1092 @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
1093 @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
1094 @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
1095 @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
1096 """
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1097 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
1098 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
1099 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
1100 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
1101
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1102 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
1103 """
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1104 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
1105
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1106 @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
1107 @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
1108 @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
1109 @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
1110 """
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1111 if hasattr(QsciScintilla, "SCI_FINDINDICATORFLASH"):
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1112 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
1113 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
1114 self.SendScintilla(QsciScintilla.SCI_FINDINDICATORFLASH,
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1115 spos, epos)
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 def hideFindIndicator(self):
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1118 """
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1119 Public method to hide the find indicator.
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1120 """
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1121 if hasattr(QsciScintilla, "SCI_FINDINDICATORHIDE"):
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1122 self.SendScintilla(QsciScintilla.SCI_FINDINDICATORHIDE)
8a9579bbf583 Added support for find indicators to the editor (QScintilla >= 2.8).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3067
diff changeset
1123
4253
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1124 def getIndicatorStartPos(self, indicator, pos):
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1125 """
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1126 Public method to get the start position of an indicator at a position.
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1127
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1128 @param indicator ID of the indicator (integer)
508b025f5d8e Added methods to QsciScintillaCompat to find the start and end of an indicator and to go to the previous or next occurrence of an indicator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1129 @param pos position within the indicator (integer)