After consulting Edward and Terry, the finished (I think) 
'unmark-first-parents' command now works as intended.

@language python

def unmark_first_parents():
    
    """unmark the first parent of each node, moving up the tree
        to the top level. print the list of unmarked parents."""
    
    parent_lst = []
    old_p = p = c.p 

    if p.isMarked():
        c.clearMarked(p)
    
    for nd in p.self_and_siblings():
        if nd.v != old_p.v:
            if nd.v.isMarked():
                break
    
    else:
        for parent in p.parents():
            if parent.isMarked():
                c.clearMarked(parent)
                parent_lst.append(parent.h)

    c.redraw()
    
    if parent_lst:
        g.es("unmarked: " + str(parent_lst))
        
unmark_first_parents()



-- 
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 leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to