Edward, we recently had a conversation about selecting nodes in an outline,
and I mentioned I had a script to de-select nodes, but didn't find it. Just
did.
If you have a node with 3 children named [a,a,b], and select that node,
copy/paste this script inside it, and run with control+b, the selected
nodes will be the children named "a":
prevselpos = c.getSelectedPositions()[0].copy()
for item in c.getSelectedPositions()[0].children():
if item.h=="a":
c.frame.tree.select(item.copy())
c.frame.tree.select(prevselpos)
g.es(len(c.getSelectedPositions()))
But if you remove the line "c.frame.tree.select(prevselpos)" you will end
up also with the parent node selected:
prevselpos = c.getSelectedPositions()[0].copy()
for item in c.getSelectedPositions()[0].children():
if item.h=="a":
c.frame.tree.select(item.copy())
c.frame.tree.select(prevselpos)
g.es(len(c.getSelectedPositions()))
All those changes are reflected in "c.getSelectedPositions()", which always
correctly matches the resulting selection.
--
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/d/optout.