#NEWLINE# @ bothmethod #NEWLINE# def get_widget( self_or_cls , plot , widget_type , **kwargs ) : #NEWLINE# #INDENT# if ( not isinstance ( plot , Plot ) ) : #NEWLINE# #INDENT# plot = self_or_cls . get_plot ( plot ) #NEWLINE# #UNINDENT# dynamic = plot . dynamic #NEWLINE# if ( widget_type == 'auto' ) : #NEWLINE# #INDENT# isuniform = plot . uniform #NEWLINE# if ( not isuniform ) : #NEWLINE# #INDENT# widget_type = 'scrubber' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# widget_type = 'widgets' #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( dynamic == 'open' ) : #NEWLINE# #INDENT# widget_type = 'scrubber' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( dynamic == 'bounded' ) : #NEWLINE# #INDENT# widget_type = 'widgets' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( widget_type == 'widgets' ) and ( dynamic == 'open' ) ) : #NEWLINE# #INDENT# raise ValueError ( 'Selection widgets not supported in dynamic open mode' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( widget_type == 'scrubber' ) and ( dynamic == 'bounded' ) ) : #NEWLINE# #INDENT# raise ValueError ( 'Scrubber widget not supported in dynamic bounded mode' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if ( widget_type in [ None , 'auto' ] ) : #NEWLINE# #INDENT# holomap_formats = self_or_cls . mode_formats [ 'holomap' ] [ self_or_cls . mode ] #NEWLINE# widget_type = ( holomap_formats [ 0 ] if ( self_or_cls . holomap == 'auto' ) else self_or_cls . holomap ) #NEWLINE# #UNINDENT# widget_cls = self_or_cls . widgets [ widget_type ] #NEWLINE# return widget_cls ( plot , renderer = self_or_cls , embed = ( self_or_cls . widget_mode == 'embed' ) , ** kwargs )