#NEWLINE# def nocache_widget_render( cls ) : #NEWLINE# #INDENT# '\n    Return a function that wraps the cls.render() method\n    and finalizes the canvas that it returns.\n    ' #NEWLINE# fn = cls . render #NEWLINE# if hasattr ( fn , 'original_fn' ) : #NEWLINE# #INDENT# fn = fn . original_fn #NEWLINE# #UNINDENT# def finalize_render( self , size , focus = False ) : #NEWLINE# #INDENT# canv = fn ( self , size , focus = focus ) #NEWLINE# if canv . widget_info : #NEWLINE# #INDENT# canv = CompositeCanvas ( canv ) #NEWLINE# #UNINDENT# validate_size ( self , size , canv ) #NEWLINE# canv . finalize ( self , size , focus ) #NEWLINE# return canv #NEWLINE# #UNINDENT# finalize_render . original_fn = fn #NEWLINE# update_wrapper ( finalize_render , fn ) #NEWLINE# return finalize_render