#NEWLINE# def Draw( self , grid , attr , dc , rect , row , col , isSelected ) : #NEWLINE# #INDENT# '\n        Takes care of drawing everything in the cell; aligns the text\n        ' #NEWLINE# text = grid . GetCellValue ( row , col ) #NEWLINE# ( align , text ) = self . _getvalue ( row , col ) #NEWLINE# if isSelected : #NEWLINE# #INDENT# bg = grid . GetSelectionBackground ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# bg = [ 'white' , ( 240 , 240 , 240 ) ] [ ( row % 2 ) ] #NEWLINE# #UNINDENT# dc . SetTextBackground ( bg ) #NEWLINE# dc . SetBrush ( wx . Brush ( bg , wx . SOLID ) ) #NEWLINE# dc . SetPen ( wx . TRANSPARENT_PEN ) #NEWLINE# dc . SetFont ( attr . GetFont ( ) ) #NEWLINE# dc . DrawRectangleRect ( rect ) #NEWLINE# dc . SetClippingRect ( rect ) #NEWLINE# if ( align == ( - 1 ) ) : #NEWLINE# #INDENT# ( width , height ) = dc . GetTextExtent ( str ( text ) ) #NEWLINE# x = ( rect [ 0 ] + 1 ) #NEWLINE# y = ( rect [ 1 ] + ( 0.5 * ( rect [ 3 ] - height ) ) ) #NEWLINE# for ( style , part ) in text : #NEWLINE# #INDENT# if isSelected : #NEWLINE# #INDENT# fg = grid . GetSelectionForeground ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# fg = self . colormap [ style . fg ] #NEWLINE# #UNINDENT# dc . SetTextForeground ( fg ) #NEWLINE# ( w , h ) = dc . GetTextExtent ( part ) #NEWLINE# dc . DrawText ( part , x , y ) #NEWLINE# x += w #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( align == 0 ) : #NEWLINE# #INDENT# ( width , height ) = dc . GetTextExtent ( str ( text ) ) #NEWLINE# x = ( rect [ 0 ] + ( 0.5 * ( rect [ 2 ] - width ) ) ) #NEWLINE# y = ( rect [ 1 ] + ( 0.5 * ( rect [ 3 ] - height ) ) ) #NEWLINE# for ( style , part ) in text : #NEWLINE# #INDENT# if isSelected : #NEWLINE# #INDENT# fg = grid . GetSelectionForeground ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# fg = self . colormap [ style . fg ] #NEWLINE# #UNINDENT# dc . SetTextForeground ( fg ) #NEWLINE# ( w , h ) = dc . GetTextExtent ( part ) #NEWLINE# dc . DrawText ( part , x , y ) #NEWLINE# x += align #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# ( width , height ) = dc . GetTextExtent ( str ( text ) ) #NEWLINE# x = ( ( rect [ 0 ] + rect [ 2 ] ) - 1 ) #NEWLINE# y = ( rect [ 1 ] + ( 0.5 * ( rect [ 3 ] - height ) ) ) #NEWLINE# for ( style , part ) in reversed ( text ) : #NEWLINE# #INDENT# ( w , h ) = dc . GetTextExtent ( part ) #NEWLINE# x -= w #NEWLINE# if isSelected : #NEWLINE# #INDENT# fg = grid . GetSelectionForeground ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# fg = self . colormap [ style . fg ] #NEWLINE# #UNINDENT# dc . SetTextForeground ( fg ) #NEWLINE# dc . DrawText ( part , x , y ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# dc . DestroyClippingRegion ( )