Changeset 8586:e6d62b780a37 in orange
 Timestamp:
 08/03/11 11:36:44 (3 years ago)
 Branch:
 default
 Convert:
 0a1ec39c74a57bc268c4f7ca10cf62844616a8fb
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

orange/OrangeWidgets/Prototypes/OWNxCanvasQt.py
r8581 r8586 673 673 self.networkCurve.remove_nodes(list(remove_nodes)) 674 674 675 nodes = dict((v, NodeItem(v, parent=self.networkCurve)) for v in new_nodes) 675 nodes = dict((v, NodeItem(v, parent=self.networkCurve)) for v in add_nodes) 676 self.networkCurve.add_nodes(nodes) 677 nodes = self.networkCurve.nodes() 676 678 677 679 #build edge index … … 692 694 if self.links is not None and len(self.links) > 0: 693 695 links = self.links 694 links_indices = (row_ind[i + 1][j + 1] for (i, j) in self.graph.edges(new_nodes)) 695 labels = ([str(row[r].value) for r in range(2, len(row))] for row in (links[links_index] for links_index in links_indices)) 696 links_indices = (row_ind[i + 1][j + 1] for (i, j) in self.graph.edges(add_nodes)) 697 labels = ([str(row[r].value) for r in range(2, len(row))] for row \ 698 in (links[links_index] for links_index in links_indices)) 696 699 697 700 if self.graph.is_directed(): 698 701 edges = [EdgeItem(nodes[i], nodes[j], 699 self.graph[i][j].get('weight', 1), 0, 1, links_index, label, parent=self.networkCurve) for\700 ((i, j), links_index, label) in zip(self.graph.edges(new_nodes),\701 702 self.graph[i][j].get('weight', 1), 0, 1, links_index, label, \ 703 parent=self.networkCurve) for ((i, j), links_index, label) in \ 704 zip(self.graph.edges(add_nodes), links_indices, labels)] 702 705 else: 703 706 edges = [EdgeItem(nodes[i], nodes[j], 704 707 self.graph[i][j].get('weight', 1), links_index, label) for \ 705 ((i, j), links_index, label) in zip(self.graph.edges( new_nodes), \706 708 ((i, j), links_index, label) in zip(self.graph.edges(add_nodes), \ 709 links_indices, labels, parent=self.networkCurve)] 707 710 elif self.graph.is_directed(): 708 edges = [EdgeItem(nodes[i], nodes[j], 709 self.graph[i][j].get('weight', 1), 0, 1, parent=self.networkCurve) for (i, j) in self.graph.edges(new_nodes)]711 edges = [EdgeItem(nodes[i], nodes[j], self.graph[i][j].get('weight', 1), \ 712 0, 1, parent=self.networkCurve) for (i, j) in self.graph.edges(add_nodes)] 710 713 else: 711 edges = [EdgeItem(nodes[i], nodes[j], 712 self.graph[i][j].get('weight', 1), parent=self.networkCurve) for (i, j) in self.graph.edges(new_nodes)] 713 714 715 self.networkCurve.add_nodes(nodes, edges) 716 717 #self.replot() 718 pass 714 edges = [EdgeItem(nodes[i], nodes[j], self.graph[i][j].get('weight', 1), \ 715 parent=self.networkCurve) for (i, j) in self.graph.edges(add_nodes)] 716 717 self.networkCurve.add_edges(edges) 719 718 720 719 def set_graph(self, graph, curve=None, items=None, links=None):
Note: See TracChangeset
for help on using the changeset viewer.