Sun, 05 Sep 2021 16:30:19 +0200
Editor: some fine tuning in handling of mouse hover help and goto lists.
eric7/QScintilla/Editor.py | file | annotate | diff | comparison | revisions | |
eric7/QScintilla/QsciScintillaCompat.py | file | annotate | diff | comparison | revisions |
--- a/eric7/QScintilla/Editor.py Sat Sep 04 20:26:21 2021 +0200 +++ b/eric7/QScintilla/Editor.py Sun Sep 05 16:30:19 2021 +0200 @@ -438,6 +438,7 @@ self.SCN_DWELLSTART.connect(self.__showMouseHoverHelp) self.SCN_DWELLEND.connect(self.__cancelMouseHoverHelp) self.__mouseHoverHelp = None + self.__showingMouseHoverHelp = False # set the text display again self.__setTextDisplay() @@ -5384,7 +5385,7 @@ ch, pos = self.__getCharacter(pos) - self.SendScintilla(QsciScintilla.SCI_CALLTIPCANCEL) + self.cancelCallTips() if not found: return @@ -7148,7 +7149,7 @@ self.vm.editorActGrp.setEnabled(False) self.setCaretWidth(0) - self.SendScintilla(QsciScintilla.SCI_CALLTIPCANCEL) + self.cancelCallTips() super().focusOutEvent(event) @@ -8595,6 +8596,8 @@ (reference.modulePath, reference.line, reference.column)) if references: + if self.isCallTipActive(): + self.cancelCallTips() self.__referencesList = references self.__referencesPositionsList = referencePositions self.showUserList(ReferencesListID, references) @@ -8866,20 +8869,23 @@ @param y y-value of mouse screen position @type int """ - if self.__mouseHoverHelp is not None and pos > 0 and y > 0: - line, index = self.lineIndexFromPosition(pos) - if index > 0: - self.__mouseHoverHelp(self, line, index) + if not self.isCallTipActive() and not self.isListActive(): + if self.__mouseHoverHelp is not None and pos > 0 and y > 0: + line, index = self.lineIndexFromPosition(pos) + if index > 0: + self.__mouseHoverHelp(self, line, index) + else: + self.__cancelMouseHoverHelp() else: self.__cancelMouseHoverHelp() - else: - self.__cancelMouseHoverHelp() def __cancelMouseHoverHelp(self): """ Private slot cancelling the display of mouse hover help. """ - self.SendScintilla(QsciScintilla.SCI_CALLTIPCANCEL) + if self.__showingMouseHoverHelp: + self.cancelCallTips() + self.__showingMouseHoverHelp = False def registerMouseHoverHelpFunction(self, func): """ @@ -8920,5 +8926,6 @@ pos = self.positionFromLineIndex(line, index) self.SendScintilla(QsciScintilla.SCI_CALLTIPSHOW, pos, self._encodeString(data)) + self.__showingMouseHoverHelp = True else: self.__cancelMouseHoverHelp()
--- a/eric7/QScintilla/QsciScintillaCompat.py Sat Sep 04 20:26:21 2021 +0200 +++ b/eric7/QScintilla/QsciScintillaCompat.py Sun Sep 05 16:30:19 2021 +0200 @@ -1469,9 +1469,9 @@ ]: aw = QApplication.activeWindow() if aw is None or aw.parent() is not self: - self.SendScintilla(QsciScintilla.SCI_CALLTIPCANCEL) + self.cancelCallTips() else: - self.SendScintilla(QsciScintilla.SCI_CALLTIPCANCEL) + self.cancelCallTips() super().focusOutEvent(event) @@ -1650,36 +1650,6 @@ QsciScintilla.SCI_POSITIONFROMLINE, lin) return lin, pos - linpos - ########################################################################### - ## methods below have been added to QScintilla starting with version 2.5 - ########################################################################### - - if "contractedFolds" not in QsciScintilla.__dict__: - def contractedFolds(self): - """ - Public method to get a list of line numbers of collapsed folds. - - @return list of line numbers of folded lines (list of integer) - """ - line = 0 - folds = [] - maxline = self.lines() - while line < maxline: - if self.foldHeaderAt(line) and not self.foldExpandedAt(line): - folds.append(line) - line += 1 - return folds - - if "setContractedFolds" not in QsciScintilla.__dict__: - def setContractedFolds(self, folds): - """ - Public method to set a list of line numbers of collapsed folds. - - @param folds list of line numbers of folded lines (list of integer) - """ - for line in folds: - self.foldLine(line) - ######################################################################### ## Methods below are missing from QScintilla. ######################################################################### @@ -1710,6 +1680,13 @@ 0, pos) return QPoint(x, y) + if "cancelCallTips" not in QsciScintilla.__dict__: + def cancelCallTips(self): + """ + Public method to cancel displayed call tips. + """ + self.SendScintilla(QsciScintilla.SCI_CALLTIPCANCEL) + ## ######################################################################### ## ## Methods below have been added to QScintilla starting with version 2.x. ## #########################################################################