#NEWLINE# def setup_images( self ) : #NEWLINE# #INDENT# for ( key , name ) in self . icons . items ( ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# path = os . path . join ( self . theme_path , name ) #NEWLINE# img = cairocffi . ImageSurface . create_from_png ( path ) #NEWLINE# #UNINDENT# except cairocffi . Error : #NEWLINE# #INDENT# self . theme_path = None #NEWLINE# logger . warning ( 'Battery Icon switching to text mode' ) #NEWLINE# return #NEWLINE# #UNINDENT# input_width = img . get_width ( ) #NEWLINE# input_height = img . get_height ( ) #NEWLINE# sp = ( input_height / ( self . bar . height - 1 ) ) #NEWLINE# width = ( input_width / sp ) #NEWLINE# if ( width > self . length ) : #NEWLINE# #INDENT# self . length = ( int ( width ) + ( self . actual_padding * 2 ) ) #NEWLINE# #UNINDENT# imgpat = cairocffi . SurfacePattern ( img ) #NEWLINE# scaler = cairocffi . Matrix ( ) #NEWLINE# scaler . scale ( sp , sp ) #NEWLINE# scaler . translate ( ( self . actual_padding * ( - 1 ) ) , 0 ) #NEWLINE# imgpat . set_matrix ( scaler ) #NEWLINE# imgpat . set_filter ( cairocffi . FILTER_BEST ) #NEWLINE# self . surfaces [ key ] = imgpat