def edit_links(scheme, source_node, sink_node, initial_links=None, parent=None):
 log.info('Constructing a Link Editor dialog.')
 dlg = EditLinksDialog(parent, windowTitle='Edit Links')
 links = scheme.find_links(source_node=source_node, sink_node=sink_node)
 existing_links = [(link.source_channel, link.sink_channel) for link in links]
 if (initial_links is None):
  initial_links = list(existing_links)
 dlg.setNodes(source_node, sink_node)
 dlg.setLinks(initial_links)
 log.info('Executing a Link Editor Dialog.')
 rval = dlg.exec_()
 if (rval == EditLinksDialog.Accepted):
  edited_links = dlg.links()
  links_to_add = (set(edited_links) - set(existing_links))
  links_to_remove = (set(existing_links) - set(edited_links))
  return (rval, list(links_to_add), list(links_to_remove))
 else:
  return (rval, [], [])

def edit_links ( scheme , source_node , sink_node , initial_links = None , parent = None ) : log . info ( 'Constructing a Link Editor dialog.' ) dlg = EditLinksDialog ( parent , windowTitle = 'Edit Links' ) links = scheme . find_links ( source_node = source_node , sink_node = sink_node ) existing_links = [ ( link . source_channel , link . sink_channel ) for link in links ] if ( initial_links is None ) : initial_links = list ( existing_links ) dlg . setNodes ( source_node , sink_node ) dlg . setLinks ( initial_links ) log . info ( 'Executing a Link Editor Dialog.' ) rval = dlg . exec_ ( ) if ( rval == EditLinksDialog . Accepted ) : edited_links = dlg . links ( ) links_to_add = ( set ( edited_links ) - set ( existing_links ) ) links_to_remove = ( set ( existing_links ) - set ( edited_links ) ) return ( rval , list ( links_to_add ) , list ( links_to_remove ) ) else : return ( rval , [ ] , [ ] )
show and execute the editlinksdialog .