moveOrCloneToTop should be something like:
def moveOrCloneToTop(p, ftlist):
"""
If p or a clone of p is already a direct child of ftlist, then move
the node
to the first child of ftlist. Otherwise, create a clone of p and
move the clone
"""
if ftlist.v not in p.v.parents:
# neither p nor clone of p is a direct child of ftlist
ftlist.v.children.insert(0, p.v)
p.v.parents.append(ftlist.v)
else:
# ftlist contains clone of p as a direct child
i = ftlist.v.children.index(p.v)
if i > 0:
# clone is not at the top
# moving it to the top
del ftlist.v.children[i]
ftlist.v.children.insert(0, p.v)
return ftlist, ftlist.firstChild()
HTH Vitalije
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/leo-editor/893f8164-7768-4004-a35d-e818369074f3%40googlegroups.com.