Vitalije, Thanks a lot for all the code. It gives me a huge head start seeing a vnode version of the same position code I wrote. I can already tell from looking at your code that I don't understand positions and vnodes at all. Maybe while trying to adapt your code, I will be enlightened. Hopefully :-).
But at least for now I have the rule which will allow me to use positions while also avoiding the minefields: Discard all positions other than the one used to modify the outline for any outline modification other than insertAsLastChild and deleting the last child And now I also have this advice: When making multiple outline modifications, it might be best to learn and use vnodes instead of positions BTW, I won't be using c.find_h in my code as I think that is a global outline search. I plan to support (as my original code does) multple @ftlist subtrees in the outline. Each @ftlist will have their own set of @day node children. In order to operate on a given ftlist, the selection will have to already be in an @ftlist subtree. Brian On Fri, Aug 16, 2019 at 9:16 AM vitalije <[email protected]> wrote: > moveToTopAndCloneToAtDay should be like: > > def moveToTopAndCloneToAtDay(c, p): > """ > Move the node identified by position p to the first child of > an ancestor @ftlist node and also clone it to a sibling @day > node with date matching today's date > """ > ftlist = findFtlistAncestor(p) > if not ftlist: > g.es("Not in ftlist tree") > return > ftlist, p = moveOrCloneToTop(p, ftlist) > p2 = cloneToSiblingTodayNode(p) > c.redraw(p2) > > > Sorry, I have permuted the return of moveOrCloneToTop (you had: return p, > ftlist, and I wrote return ftlist, p) > > I haven't tested this script thoroughly but it should work. Let me know if > it doesn't work as you expected. > 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/a7749d44-abb7-4e62-9bb0-746c27f91fdc%40googlegroups.com > <https://groups.google.com/d/msgid/leo-editor/a7749d44-abb7-4e62-9bb0-746c27f91fdc%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CAO5X8CxDn5j%2BnK%3DozNO1tJ6oa4%3DTSHXFhEkHz5zgCPHyFqfBqA%40mail.gmail.com.
