#NEWLINE# def handle_file( self , file_name , file_type , code ) : #NEWLINE# #INDENT# 'handling of file' #NEWLINE# if ( file_name is None ) : #NEWLINE# #INDENT# if ( code is None ) : #NEWLINE# #INDENT# file_name = __file__ #NEWLINE# file_type = 'code' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . handle_code ( code ) #NEWLINE# return #NEWLINE# #UNINDENT# #UNINDENT# text = self . load ( file_name ) #NEWLINE# if ( file_type == 'text' ) : #NEWLINE# #INDENT# self . editor . setPlainText ( text ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( file_type == 'code' ) : #NEWLINE# #INDENT# self . set_editor_default ( ) #NEWLINE# if ( file_name . endswith ( 'py' ) or file_name . endswith ( 'pyw' ) ) : #NEWLINE# #INDENT# self . highlighter = Highlighter ( self . editor . document ( ) ) #NEWLINE# self . editor . setPlainText ( text ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( file_type == 'html' ) : #NEWLINE# #INDENT# self . editor . setHtml ( text ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# title = 'Problem found' #NEWLINE# message = 'Unknown file_type: {}' . format ( file_type ) #NEWLINE# reply = QtGui . QMessageBox . critical ( None , title , message , ( QtGui . QMessageBox . Abort | QtGui . QMessageBox . Ignore ) ) #NEWLINE# if ( reply == QtGui . QMessageBox . Abort ) : #NEWLINE# #INDENT# sys . exit ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# pass