On Sun, 12 May 2013 12:45:50 -0700 (PDT)
Fidel Pérez <[email protected]> wrote:

> I just realized I will also need to go on with loops through the tree 
> before and after some of the nodes deletion (I am preparing the script to 
> transform an imported html mindmap into Leo).
> Could someone please point me towards any script/code which already loops 
> through items on a tree even after deleting some of them or adding new ones?

Typically you try to avoid iterating over changing trees.  For example
you sometimes collect a list of all the things that need deleting, and
then just iterate through that list, deleting things, after you've
iterated the tree.  The exact form of the solution depends a bit on
what you're trying to do.

I imported stuff from FreeMind, but so long ago I can't find any of the
pieces.  I did just find
.../contrib/Projects/jyleo/plugins/freemind
.../contrib/Projects/jyleo/plugins/FreeLeoMind.java

but those are in the old experimental jython Leo, it seems.  Possibly
not importers but interface hacks or something.

Cheers -Terry

> On Sunday, May 12, 2013 7:52:39 PM UTC+2, Fidel Pérez wrote:
> >
> > Hi:
> > I have been reading on the documentation (both Leo and group) about 
> > deleting childs in a node, and actually testing it myself and I cant manage 
> > it to work since when a node is deleted the reference to it changes, so the 
> > loop will go crazy (on one of the tests it acutally deleted all the nodes 
> > in my leo file lol)
> > Did someone solve this problem already? Which would be the code to delete 
> > the following nodes?
> >
> > *Code I tried:*
> > *
> > *
> >
> >> for idx, n in enumerate(MasterNode.subtree()):
> >>     c.deleteOutline(n)
> >
> >
> > As previously said, I'm adding all those to an easy access list (which 
> > hopefully will be a part of the quickstart guide) so new users will 
> > directly know how to apply those.
> > Thanks!
> >
> 

-- 
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?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to