#NEWLINE# @ arg_node_actions . action ( 'join with selection' ) #NEWLINE# def arg_join2( node ) : #NEWLINE# #INDENT# '\n    Binary join\n    ' #NEWLINE# sels = _analysis_session_widget . arg . selected #NEWLINE# if ( len ( user_selection ) == 0 ) : #NEWLINE# #INDENT# raise InteractionError ( 'You must select at least one node to join with.' ) #NEWLINE# #UNINDENT# if any ( ( ( len ( x ) != 1 ) for x in sels ) ) : #NEWLINE# #INDENT# raise InteractionError ( ( 'You must select one node to with. ' + "Seem's you've selected an edge." ) ) #NEWLINE# #UNINDENT# sels = [ x [ 0 ] for x in sels if ( len ( x ) == 1 ) ] #NEWLINE# user_selection = ( yield UserSelect ( options = dict ( ( ( str ( x . id ) , x ) for x in sels ) ) , title = 'Binary join' , prompt = 'Choose a node to join with' ) ) #NEWLINE# code = dedent ( '\n    join2(arg_node({!r}), arg_node({!r}))\n    ' ) . strip ( ) . format ( node . id , user_selection . id ) #NEWLINE# ( yield ExecuteNewCell ( code ) )