etetoolkit / ete

Python package for building, comparing, annotating, manipulating and visualising trees. It provides a comprehensive API and a collection of command line tools, including utilities to work with the NCBI taxonomy tree.
http://etetoolkit.org
GNU General Public License v3.0
792 stars 214 forks source link

aligned SequenceFace wrong positioning #199

Open marco-mariotti opened 8 years ago

marco-mariotti commented 8 years ago

It appears that, on the first visualization only, something fails in the positioning of this SequenceFace. The faces in the columns after the column of the SequenceFace are drawn with the same x as the SequenceFace, as if the initial width computed for the SequenceFace is 0. At any second draw (for example pushing the "<-> x " button), this is fixed.

Code to test this: from ete3 import *; tree=Tree(); tree.populate(5); [ [n.add_face( faces.TextFace('first'), 1, 'aligned' ), n.add_face( faces.TextFace('second'), 2, 'aligned' ), n.add_face( faces.SequenceFace( upper('AMIN-S'), seqtype='aa' ) , 3, 'aligned'), n.add_face( faces.TextFace('third'), 4, 'aligned' ), n.add_face( faces.TextFace('fourth'), 5, 'aligned' )] for n in tree ]; tree.show()

marco-mariotti commented 8 years ago

Hi, I just discovered one more symptom about this. On the first drawing, if you request the sequence face boundingRect(), you will see that it has, for some reason, width=0.0

main_item is a n2i[node]

for index, item in enumerate(main_item.mapped_items): --- if not hasattr(item, 'column2faces'): print item.boundingRect() # --> this is zero for sequence face only, and only at first drawing