<s> """<STR_LIT>""" <EOL> import inspect <EOL> from pyface . action . api import ActionEvent <EOL> from traits . api import Instance , List , Property <EOL> from . node_manager import NodeManager <EOL> from . node_type import NodeType <EOL> from . node_tree_model import NodeTreeModel <EOL> from . tree import Tree <EOL> class NodeTree ( Tree ) : <EOL> """<STR_LIT>""" <EOL> model = Instance ( NodeTreeModel , ( ) ) <EOL> node_manager = Property ( Instance ( NodeManager ) ) <EOL> node_types = Property ( List ( NodeType ) ) <EOL> def _get_node_manager ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . model . node_manager <EOL> def _set_node_manager ( self , node_manager ) : <EOL> """<STR_LIT>""" <EOL> self . model . node_manager = node_manager <EOL> return <EOL> def _get_node_types ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . model . node_manager . node_types <EOL> def _set_node_types ( self , node_types ) : <EOL> """<STR_LIT>""" <EOL> self . model . node_manager . node_types = node_types <EOL> return <EOL> def _node_activated_changed ( self , obj ) : <EOL> """<STR_LIT>""" <EOL> default_action = self . model . get_default_action ( obj ) <EOL> if default_action is not None : <EOL> self . _perform_default_action ( default_action , obj ) <EOL> return <EOL> def _node_right_clicked_changed ( self , ( obj , point ) ) : <EOL> """<STR_LIT>""" <EOL> self . select ( obj ) <EOL> self . _context = obj <EOL> menu_manager = self . model . get_context_menu ( obj ) <EOL> if menu_manager is not None : <EOL> self . _popup_menu ( menu_manager , obj , point ) <EOL> return <EOL> def add_to_menu ( self , menu_item ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> def add_to_toolbar ( self , toolvar_item ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> def can_add_to_menu ( self , action ) : <EOL> """<STR_LIT>""" <EOL> return True <EOL> def perform ( self , action , event ) : <EOL> """<STR_LIT>""" <EOL> event . widget = self <EOL> event . context = self . _context <EOL> args , varargs , varkw , defaults = inspect . getargspec ( action . perform ) <EOL> if len ( args ) == <NUM_LIT:1> : <EOL> action . perform ( ) <EOL> else : <EOL> action . perform ( event ) <EOL> return <EOL> def _create_action_event ( self , obj ) : <EOL> """<STR_LIT>""" <EOL> return ActionEvent ( widget = self , context = obj ) <EOL> def _perform_default_action ( self , action , obj ) : <EOL> """<STR_LIT>""" <EOL> action . perform ( self . _create_action_event ( obj ) ) <EOL> return <EOL> def _popup_menu ( self , menu_manager , obj , point ) : <EOL> """<STR_LIT>""" <EOL> menu = menu_manager . create_menu ( self . control , self ) <EOL> if not menu . is_empty ( ) : <EOL> menu . show ( * point ) <EOL> menu_manager . destroy ( ) <EOL> return </s>
