#NEWLINE# def can_add_to_menu( self , action ) : #NEWLINE# #INDENT# ' Returns whether the action should be defined in the user interface.\n        ' #NEWLINE# if ( action . defined_when != '' ) : #NEWLINE# #INDENT# if ( not eval ( self . defined_when , globals ( ) , self . _menu_context ) ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# #UNINDENT# if ( action . visible_when != '' ) : #NEWLINE# #INDENT# if ( not eval ( action . visible_when , globals ( ) , self . _menu_context ) ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# #UNINDENT# return True