[REF] Clean up of tools.graph

bzr revid: cto@openerp.com-20120222114009-nyalbc7uyelf54f0
This commit is contained in:
Cécile Tonglet
2012-02-22 12:40:09 +01:00
parent b5db852b3a
commit 3490275dc0
+6 -13
View File
@@ -438,26 +438,19 @@ class graph(object):
l.reverse()
no = len(l)
if no%2==0:
first_half = l[no/2:]
factor = 1
else:
first_half = l[no/2+1:]
factor = 0
rest = no%2
first_half = l[no/2+rest:]
last_half = l[:no/2]
i=1
for child in first_half:
self.result[child]['y'] = mid_pos - (i - (factor * 0.5))
i += 1
for i, child in enumerate(first_half):
self.result[child]['y'] = mid_pos - (i+1 - (0 if rest else 0.5))
if self.transitions.get(child, False):
if last:
self.result[child]['y'] = last + len(self.transitions[child])/2 + 1
last = self.tree_order(child, last)
if no%2:
if rest:
mid_node = l[no/2]
self.result[mid_node]['y'] = mid_pos
@@ -474,7 +467,7 @@ class graph(object):
i=1
last_child = None
for child in last_half:
self.result[child]['y'] = mid_pos + (i - (factor * 0.5))
self.result[child]['y'] = mid_pos + (i - (0 if rest else 0.5))
last_child = child
i += 1
if self.transitions.get(child, False):