示例#1
0
 def _on_mouse_released(self, event):
     """ mouse pressed callback """
     if event.button() == 1 and self._deco:
         cursor = TextHelper(self.editor).word_under_mouse_cursor()
         if cursor and cursor.selectedText():
             self._timer.request_job(
                 self.word_clicked.emit, cursor)
示例#2
0
 def _on_mouse_pressed(self, event):
     """ mouse pressed callback """
     if event.button() == 1 and self._deco:
         cursor = TextHelper(self.editor).word_under_mouse_cursor()
         if cursor and cursor.selectedText():
             self._timer.request_job(
                 self.word_clicked.emit, cursor)
 def _is_last_chard_end_of_word(self):
     try:
         tc = TextHelper(self.editor).word_under_cursor()
         tc.setPosition(tc.position())
         tc.movePosition(tc.StartOfLine, tc.KeepAnchor)
         l = tc.selectedText()
         last_char = l[len(l) - 1]
         seps = self.editor.word_separators
         symbols = [",", " ", "("]
         return last_char in seps and last_char not in symbols
     except IndexError:
         return False
 def _is_last_chard_end_of_word(self):
     try:
         tc = TextHelper(self.editor).word_under_cursor()
         tc.setPosition(tc.position())
         tc.movePosition(tc.StartOfLine, tc.KeepAnchor)
         l = tc.selectedText()
         last_char = l[len(l) - 1]
         seps = self.editor.word_separators
         symbols = [",", " ", "("]
         return last_char in seps and last_char not in symbols
     except IndexError:
         return False
示例#5
0
    def requestGoTo(self, tc=None):
        """
        Request a go to assignment.

        :param tc: Text cursor which contains the text that we must look for
                   its assignment. Can be None to go to the text that is under
                   the text cursor.
        :type tc: QtGui.QTextCursor
        """
        if not tc:
            tc = TextHelper(self.editor).word_under_cursor(
                select_whole_word=True)
        symbol = tc.selectedText()
        analyser = getattr(self.editor, "analyserMode")
        if analyser:
            node = analyser.root_node.find(symbol)
            if node:
                self._definition = node
                QTimer.singleShot(100, self._goToDefinition)