#NEWLINE# def _on_post_key_pressed( self , event ) : #NEWLINE# #INDENT# if ( ( not event . isAccepted ( ) ) and ( not self . _ignore_post ) ) : #NEWLINE# #INDENT# txt = event . text ( ) #NEWLINE# trav = self . editor . textCursor ( ) #NEWLINE# assert isinstance ( trav , QtGui . QTextCursor ) #NEWLINE# trav . movePosition ( trav . Left , trav . MoveAnchor , 2 ) #NEWLINE# literal = TextHelper ( self . editor ) . is_comment_or_string ( trav ) #NEWLINE# if ( not literal ) : #NEWLINE# #INDENT# next_char = TextHelper ( self . editor ) . get_right_character ( ) #NEWLINE# if ( txt in self . MAPPING ) : #NEWLINE# #INDENT# to_insert = self . MAPPING [ txt ] #NEWLINE# if ( ( not next_char ) or ( next_char in self . MAPPING . keys ( ) ) or ( next_char in self . MAPPING . values ( ) ) or next_char . isspace ( ) ) : #NEWLINE# #INDENT# TextHelper ( self . editor ) . insert_text ( ( self . QUOTES_FORMATS [ txt ] % to_insert ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# self . _ignore_post = False