#NEWLINE# def loadDialog( self ) : #NEWLINE# #INDENT# filename = QtGui . QFileDialog . getOpenFileName ( self , 'Load query' , '' , 'SQL Files (*.sql *.sql.gz *.sql.bz2 *.sql.zip)' ) #NEWLINE# if filename : #NEWLINE# #INDENT# self . filename = filename #NEWLINE# if self . filename . endswith ( '.gz' ) : #NEWLINE# #INDENT# opener = GzipFile #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if self . filename . endswith ( '.bz2' ) : #NEWLINE# #INDENT# opener = BZ2File #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if self . filename . endswith ( '.zip' ) : #NEWLINE# #INDENT# opener = ZipFile #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# opener = open #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# with codecs . EncodedFile ( opener ( self . filename , 'r' ) , 'utf-8' ) as f : #NEWLINE# #INDENT# sql = f . read ( ) #NEWLINE# #UNINDENT# self . setText ( sql )