Thank you very much for your answers. Yes, I am importing from freemind but enjoying the experience as a way to learn Leo's working style so I would like to still make the full script myself. The problem is importing through html generates a lot of nodes called "li" and other things, which I want to remove and leave only with the information I want (just node names and bodies) So I have to both loop through the nodes and keep deleting some of them, renamig some of them, sometimes adding some of them probably. Marking them and deleting all of them together would be a solution, but I still need to create nodes with iterations, which remains unsolved through marking nodes. I will actually look at the way html files are imported since they create a lot of nested nodes and I guess some of them are created after the structure exists so hopefully there are recursive loops in there.
I already tried (in several ways) to go to the "childest" child and delete it, then go up, delete, etc, but after the first "childest child" deletion, when trying to delete its brothers with the iteration, Leo wont work as I would expect. (We can discard the problem you suggested) Cheers, Fidel. On Sunday, May 12, 2013 8:18:16 PM UTC+2, Terry wrote: > > On Sun, 12 May 2013 10:52:39 -0700 (PDT) > Fidel Pérez <[email protected] <javascript:>> 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 > > I know deleting nodes was discussed at length when > > .../leo/plugins/leoPluginsRef.leo#Plugins--> Qt only plugins-->@file > contextmenu.py-->deletenodes_rclick > > was written. I thought the discussion resulted in a core method to > deal with this, but perhaps not. deletenodes_rclick() works even when > multiple nodes are selected, which is an unusual case. > > You're probably running in to trouble because your code deletes the > first child of Masternode before moving on to that *childs* children, > which are already gone - deleteOutline is recursive itself. > > What happens if you just use MasterNode.children() > > ? > > Cheers -Terry > > > 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.
