10 |
10 |
11 from __future__ import unicode_literals |
11 from __future__ import unicode_literals |
12 |
12 |
13 from PyQt5.QtGui import QKeySequence |
13 from PyQt5.QtGui import QKeySequence |
14 from PyQt5.Qsci import QsciScintilla |
14 from PyQt5.Qsci import QsciScintilla |
15 |
|
16 from Globals import qVersionTuple |
|
17 |
15 |
18 __all__ = ["s2qTranslate"] |
16 __all__ = ["s2qTranslate"] |
19 |
17 |
20 Scintilla2QKeySequence = { |
18 Scintilla2QKeySequence = { |
21 QsciScintilla.SCI_CHARLEFT: QKeySequence.MoveToPreviousChar, |
19 QsciScintilla.SCI_CHARLEFT: QKeySequence.MoveToPreviousChar, |
106 QsciScintilla.SCI_DELWORDRIGHTEND: QKeySequence.UnknownKey, |
104 QsciScintilla.SCI_DELWORDRIGHTEND: QKeySequence.UnknownKey, |
107 QsciScintilla.SCI_MOVESELECTEDLINESUP: QKeySequence.UnknownKey, |
105 QsciScintilla.SCI_MOVESELECTEDLINESUP: QKeySequence.UnknownKey, |
108 QsciScintilla.SCI_MOVESELECTEDLINESDOWN: QKeySequence.UnknownKey, |
106 QsciScintilla.SCI_MOVESELECTEDLINESDOWN: QKeySequence.UnknownKey, |
109 QsciScintilla.SCI_LOWERCASE: QKeySequence.UnknownKey, |
107 QsciScintilla.SCI_LOWERCASE: QKeySequence.UnknownKey, |
110 QsciScintilla.SCI_UPPERCASE: QKeySequence.UnknownKey, |
108 QsciScintilla.SCI_UPPERCASE: QKeySequence.UnknownKey, |
|
109 QsciScintilla.SCI_LINEDELETE: QKeySequence.DeleteCompleteLine, |
|
110 QsciScintilla.SCI_DELETEBACK: QKeySequence.Backspace, |
111 } |
111 } |
112 if qVersionTuple() >= (5, 2, 0): |
|
113 Scintilla2QKeySequence[QsciScintilla.SCI_LINEDELETE] = \ |
|
114 QKeySequence.DeleteCompleteLine, |
|
115 if qVersionTuple() >= (5, 5, 0): |
|
116 Scintilla2QKeySequence[QsciScintilla.SCI_DELETEBACK] = \ |
|
117 QKeySequence.Backspace |
|
118 |
112 |
119 |
113 |
120 def s2qTranslate(scintillaCommand): |
114 def s2qTranslate(scintillaCommand): |
121 """ |
115 """ |
122 Function to translate a QScintilla command to a QKeySequence. |
116 Function to translate a QScintilla command to a QKeySequence. |