Changeset 8592:86c1914427c2 in orange


Ignore:
Timestamp:
08/03/11 17:41:12 (3 years ago)
Author:
miha <miha.stajdohar@…>
Branch:
default
Convert:
bc83088243701ca6cc24d95ee36582133810fd7b
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/Prototypes/OWNxCanvasQt.py

    r8591 r8592  
    1111import Orange 
    1212import random  
    13  
    14 from numpy import * 
     13import numpy 
     14 
    1515from plot.owplot import * 
    1616from plot.owpoint import * 
     
    618618        inter_nodes = old_nodes.intersection(new_nodes) 
    619619        remove_nodes = list(old_nodes.difference(inter_nodes)) 
    620         add_nodes = new_nodes.difference(inter_nodes) 
     620        add_nodes = list(new_nodes.difference(inter_nodes)) 
    621621         
    622622        self.graph = newgraph 
    623623         
     624        current_nodes = self.networkCurve.nodes() 
     625         
     626        pos = dict((n, [numpy.average(c) for c in zip(*[(current_nodes[u].x(), current_nodes[u].y()) for u in old_nodes.intersection(self.graph.neighbors(n))])]) for n in add_nodes) 
     627         
    624628        self.networkCurve.remove_nodes(list(remove_nodes)) 
    625629         
    626         nodes = dict((v, NodeItem(v, parent=self.networkCurve)) for v in add_nodes) 
     630        nodes = dict((v, NodeItem(v, x=pos[v][0], y=pos[v][1], parent=self.networkCurve)) for v in add_nodes) 
    627631        self.networkCurve.add_nodes(nodes) 
    628632        nodes = self.networkCurve.nodes() 
Note: See TracChangeset for help on using the changeset viewer.