On Wed, 07 Aug 2013 15:02:14 -0400
Jacob Peck <[email protected]> wrote:
> The following code (in a button or a command) accomplishes what I'm
> setting out to do:
>
>
> ----
> @language python
>
> mypos = p.copy()
>
> alist = [pos.copy() for pos in c.all_positions() if pos.v == mypos.v]
>
> c.deletePositionsInList(alist)
> c.redraw()
> ----
So... oh, ok, I get it, at first I couldn't see how that was different
from c.deletePositionsInList([p]), but now I see that deletes all
clones :-)
v.parents is a list of all parents of a vnode, which can be converted
to a list of all parent positions via p.parents(). At least I assume
that's how p.parents() works. So this might do the same thing while
iterating a minimal amount of the tree (just the nodes known to be
parents of one of the clones):
alist = []
for parent in set(p.parents()):
alist.extend([i.copy() for i in parent.children() if i.v == p.v])
c.deletePositionsInList(alist)
c.redraw()
untested
Cheers -Terry
--
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/groups/opt_out.