diff --git a/workbench/cvitems.py b/workbench/cvitems.py index 3066008..474cf5f 100644 --- a/workbench/cvitems.py +++ b/workbench/cvitems.py @@ -47,7 +47,6 @@ class CVConnection(QtGui.QGraphicsItem): self.nodeFrom = nodeFrom self.nodeTo = nodeTo self.beziercurve = None - self.paintRect = None self.setZValue(1) self.determinePath() diff --git a/workbench/decompositionView.py b/workbench/decompositionView.py index 825c7d4..164b526 100755 --- a/workbench/decompositionView.py +++ b/workbench/decompositionView.py @@ -95,7 +95,29 @@ class DecompositionView(QtGui.QDialog): n = len(c.variables) layers[n].append(c) # sort clusters in layers - # ?? + # start from layer N (largest clusters) + # clusters are initially ordered according to the order in which sub-clusters appear in the previous (n+1) layer + for n in reversed(range(1,N)): + print "ordering layers",n + # find subiable pseudo-ordering in previous layers + subordervalue = {} + clusterindex = 0 + for cluster in layers[n+1]: + clusterindex = clusterindex+1 + for sub in cluster.subs: + # order by first appearence in cluster from left to right + if sub not in subordervalue: + subordervalue[sub] = clusterindex + # determine pseudo-order clusters in this layers: sum subordervalues per cluster + clusterordervalue = {} + for cluster in layers[n]: + clusterordervalue[cluster] = 0 + for sub in cluster.subs: + if sub in subordervalue: + clusterordervalue[cluster] += subordervalue[sub] + # sort clusters in layers + layers[n].sort(lambda x,y:clusterordervalue[x] + + + + + + + + + + + + +