Ejemplo n.º 1
0
 def mouseMoveEvent(self, event):
     position = event.pos()
     cursor = self.cursorForPosition(position)
     block = cursor.block()
     checkers = self._neditable.sorted_checkers
     for items in checkers:
         checker, color, _ = items
         if block.blockNumber() in checker.checks:
             message = checker.checks[block.blockNumber()][0]
             QToolTip.showText(self.mapToGlobal(position), message, self)
     if event.modifiers() == Qt.ControlModifier:
         cursor.select(QTextCursor.WordUnderCursor)
         selection_start = cursor.selectionStart()
         selection_end = cursor.selectionEnd()
         cursor.setPosition(selection_start - 1)
         cursor.setPosition(selection_end + 1, QTextCursor.KeepAnchor)
         if cursor.selectedText()[-1:] in ('(', '.') or \
         cursor.selectedText()[:1] in ('.', '@'):
             self.extraSelections = []
             selection = QTextEdit.ExtraSelection()
             lineColor = QColor(
                 resources.CUSTOM_SCHEME.get(
                     'linkNavigate',
                     resources.COLOR_SCHEME['linkNavigate']))
             selection.format.setForeground(lineColor)
             selection.format.setFontUnderline(True)
             selection.cursor = cursor
             self.extraSelections.append(selection)
             self.setExtraSelections(self.extraSelections)
         else:
             self.extraSelections = []
             self.setExtraSelections(self.extraSelections)
     QPlainTextEdit.mouseMoveEvent(self, event)
Ejemplo n.º 2
0
 def mouseMoveEvent(self, event):
     position = event.pos()
     cursor = self.cursorForPosition(position)
     block = cursor.block()
     checkers = sorted(self._neditable.registered_checkers,
         key=lambda x: x[2], reverse=True)
     for items in checkers:
         checker, color, _ = items
         if block.blockNumber() in checker.checks:
             message = '\n'.join(checker.checks[block.blockNumber()])
             QToolTip.showText(self.mapToGlobal(position), message, self)
     if event.modifiers() == Qt.ControlModifier:
         cursor.select(QTextCursor.WordUnderCursor)
         selection_start = cursor.selectionStart()
         selection_end = cursor.selectionEnd()
         cursor.setPosition(selection_start - 1)
         cursor.setPosition(selection_end + 1, QTextCursor.KeepAnchor)
         if cursor.selectedText()[-1:] in ('(', '.') or \
         cursor.selectedText()[:1] in ('.', '@'):
             self.extraSelections = []
             selection = QTextEdit.ExtraSelection()
             lineColor = QColor(resources.CUSTOM_SCHEME.get('linkNavigate',
                         resources.COLOR_SCHEME['linkNavigate']))
             selection.format.setForeground(lineColor)
             selection.format.setFontUnderline(True)
             selection.cursor = cursor
             self.extraSelections.append(selection)
             self.setExtraSelections(self.extraSelections)
         else:
             self.extraSelections = []
             self.setExtraSelections(self.extraSelections)
     QPlainTextEdit.mouseMoveEvent(self, event)
Ejemplo n.º 3
0
 def mouseMoveEvent(self, event):
     position = event.pos()
     cursor = self.cursorForPosition(position)
     block = cursor.block()
     if settings.ERRORS_HIGHLIGHT_LINE and \
     (block.blockNumber()) in self.errors.errorsSummary:
         message = '\n'.join(
             self.errors.errorsSummary[block.blockNumber()])
         QToolTip.showText(self.mapToGlobal(position),
             message, self)
     elif settings.CHECK_HIGHLIGHT_LINE and \
     (block.blockNumber()) in self.pep8.pep8checks:
         message = '\n'.join(
             self.pep8.pep8checks[block.blockNumber()])
         QToolTip.showText(self.mapToGlobal(position), message, self)
     if event.modifiers() == Qt.ControlModifier:
         cursor.select(QTextCursor.WordUnderCursor)
         cursor.movePosition(QTextCursor.Right, QTextCursor.KeepAnchor)
         if cursor.selectedText().endsWith('(') or \
         cursor.selectedText().endsWith('.'):
             cursor.movePosition(QTextCursor.Left, QTextCursor.KeepAnchor)
             self.extraSelections = []
             selection = QTextEdit.ExtraSelection()
             lineColor = QColor(resources.CUSTOM_SCHEME.get('linkNavigate',
                         resources.COLOR_SCHEME['linkNavigate']))
             selection.format.setForeground(lineColor)
             selection.format.setFontUnderline(True)
             selection.cursor = cursor
             self.extraSelections.append(selection)
             self.setExtraSelections(self.extraSelections)
         else:
             self.extraSelections = []
             self.setExtraSelections(self.extraSelections)
     QPlainTextEdit.mouseMoveEvent(self, event)
Ejemplo n.º 4
0
 def mouseMoveEvent(self, event):
     position = event.pos()
     cursor = self.cursorForPosition(position)
     block = cursor.block()
     if settings.ERRORS_HIGHLIGHT_LINE and \
     (block.blockNumber()) in self.errors.errorsSummary:
         message = '\n'.join(self.errors.errorsSummary[block.blockNumber()])
         QToolTip.showText(self.mapToGlobal(position), message, self)
     elif settings.CHECK_HIGHLIGHT_LINE and \
     (block.blockNumber()) in self.pep8.pep8checks:
         message = '\n'.join(self.pep8.pep8checks[block.blockNumber()])
         QToolTip.showText(self.mapToGlobal(position), message, self)
     if event.modifiers() == Qt.ControlModifier:
         cursor.select(QTextCursor.WordUnderCursor)
         cursor.movePosition(QTextCursor.Right, QTextCursor.KeepAnchor)
         if cursor.selectedText().endsWith('(') or \
         cursor.selectedText().endsWith('.'):
             cursor.movePosition(QTextCursor.Left, QTextCursor.KeepAnchor)
             self.extraSelections = []
             selection = QTextEdit.ExtraSelection()
             lineColor = QColor(
                 resources.CUSTOM_SCHEME.get(
                     'linkNavigate',
                     resources.COLOR_SCHEME['linkNavigate']))
             selection.format.setForeground(lineColor)
             selection.format.setFontUnderline(True)
             selection.cursor = cursor
             self.extraSelections.append(selection)
             self.setExtraSelections(self.extraSelections)
         else:
             self.extraSelections = []
             self.setExtraSelections(self.extraSelections)
     QPlainTextEdit.mouseMoveEvent(self, event)