Пример #1
0
 def _on_post_key_pressed(self, event):
     if not event.isAccepted() and not self._ignore_post:
         txt = event.text()
         next_char = TextHelper(self.editor).get_right_character()
         if txt in self.MAPPING:
             to_insert = self.MAPPING[txt]
             if (not next_char or next_char in self.MAPPING.keys() or
                     next_char in self.MAPPING.values() or
                     next_char.isspace()):
                 TextHelper(self.editor).insert_text(
                     self.QUOTES_FORMATS[txt] % to_insert)
     self._ignore_post = False
Пример #2
0
 def _on_post_key_pressed(self, event):
     if not event.isAccepted() and not self._ignore_post:
         txt = event.text()
         next_char = TextHelper(self.editor).get_right_character()
         if txt in self.MAPPING:
             to_insert = self.MAPPING[txt]
             if (not next_char or next_char in self.MAPPING.keys()
                     or next_char in self.MAPPING.values()
                     or next_char.isspace()):
                 TextHelper(self.editor).insert_text(
                     self.QUOTES_FORMATS[txt] % to_insert)
     self._ignore_post = False
Пример #3
0
 def _on_post_key_pressed(self, event):
     if not event.isAccepted() and not self._ignore_post:
         txt = event.text()
         trav = self.editor.textCursor()
         assert isinstance(trav, QtGui.QTextCursor)
         trav.movePosition(trav.Left, trav.MoveAnchor, 2)
         literal = TextHelper(self.editor).is_comment_or_string(trav)
         if not literal:
             next_char = TextHelper(self.editor).get_right_character()
             if txt in self.MAPPING:
                 to_insert = self.MAPPING[txt]
                 if (not next_char or next_char in list(self.MAPPING.keys())
                         or next_char in list(self.MAPPING.values())
                         or next_char.isspace()):
                     TextHelper(self.editor).insert_text(
                         self.QUOTES_FORMATS[txt] % to_insert)
     self._ignore_post = False
Пример #4
0
 def _on_post_key_pressed(self, event):
     if not event.isAccepted() and not self._ignore_post:
         txt = event.text()
         trav = self.editor.textCursor()
         assert isinstance(trav, QtGui.QTextCursor)
         trav.movePosition(trav.Left, trav.MoveAnchor, 2)
         literal = TextHelper(self.editor).is_comment_or_string(trav)
         if not literal:
             next_char = TextHelper(self.editor).get_right_character()
             if txt in self.MAPPING:
                 to_insert = self.MAPPING[txt]
                 if (not next_char or next_char in self.MAPPING.keys() or
                         next_char in self.MAPPING.values() or
                         next_char.isspace()):
                     TextHelper(self.editor).insert_text(
                         self.QUOTES_FORMATS[txt] % to_insert)
     self._ignore_post = False