Re: An implementation of paste-retaining-outside-clones command

2020-05-29 Thread Edward K. Ream
On Fri, May 29, 2020 at 7:01 AM vitalije wrote: > Now I would like to point out some problems I encountered while writing this code and suggestions how to improve Leo. ... >it would be natural to use FastRead to read clipboard, but it was almost imposible to reuse anything from this class, becaus

Re: An implementation of paste-retaining-outside-clones command

2020-05-29 Thread Edward K. Ream
On Fri, May 29, 2020 at 7:01 AM vitalije wrote: Done at a48cdaa67f367b30. [in devel] > > I've added some comments to make code easier to understand. > Many thanks for all this work! Feel free to close #1593 when you complete work. The node

Re: An implementation of paste-retaining-outside-clones command

2020-05-29 Thread Edward K. Ream
On Fri, May 29, 2020 at 7:25 AM vitalije wrote: Done at c9e92f5574cd. > > This version handles unknown attributes using FastRead.scanTnodes method. > It would be nicer if this method was a function... > Feel free to make the change if you like. There is an ongoing tension between using methods

Re: An implementation of paste-retaining-outside-clones command

2020-05-29 Thread Edward K. Ream
On Fri, May 29, 2020 at 7:07 AM vitalije wrote: > Something is wrong with google groups code formatting. My code examples in > the previous message have some line breaks that I didn't write. When I > tried to edit that message, those line breaks disappeared and now they are > again present. > I

Re: An implementation of paste-retaining-outside-clones command

2020-05-29 Thread vitalije
Done at c9e92f5574cd. This version handles unknown attributes using FastRead.scanTnodes method. It would be nicer if this method was a function because it really doesn't need neither c nor gnxDict. If it were just a plain function inside leoGlobals, I could use it as: bodies, uas = g.scanTnode

Re: An implementation of paste-retaining-outside-clones command

2020-05-29 Thread vitalije
I am glad to report that I've just found FastRead.scanTnodes method that I could use in paste-as-template. This method is a perfect example of what I was writing about: it provides functionality without disturbing anything else by returning an ordinary pair of dicts. Easy to use, easy to test.

Re: An implementation of paste-retaining-outside-clones command

2020-05-29 Thread vitalije
Something is wrong with google groups code formatting. My code examples in the previous message have some line breaks that I didn't write. When I tried to edit that message, those line breaks disappeared and now they are again present. Vitalije -- You received this message because you are sub

Re: An implementation of paste-retaining-outside-clones command

2020-05-29 Thread vitalije
Done at a48cdaa67f367b30. I've added some comments to make code easier to understand. The function skip_root: def skip_root(v, root_gnx): if v.gnx != root_gnx: yield v for ch in v.children: yield from skip_root(ch, root_gnx) outside = { x.gnx for x in skip_root(c.h

Re: An implementation of paste-retaining-outside-clones command

2020-05-28 Thread Edward K. Ream
On Thursday, May 28, 2020 at 1:06:39 PM UTC-5, Edward K. Ream wrote: Rev 5ec08e8 in devel adds NodeIndices.computeNewIndex. You don't *have* to use it, but imo there is no reason not to. I've updated the title and second comment of #1593 . V

Re: An implementation of paste-retaining-outside-clones command

2020-05-28 Thread Edward K. Ream
On Thursday, May 28, 2020 at 12:33:30 PM UTC-5, Edward K. Ream wrote: > Thanks for this. I'll take a look. This is great stuff. The code is difficult, and it seems to work. To create the paste-as-template command, create the following in commands/commanderOutlineCommands.py: @g.commander_comma

Re: An implementation of paste-retaining-outside-clones command

2020-05-28 Thread Edward K. Ream
On Thu, May 28, 2020 at 5:28 AM vitalije wrote: This might not be the best possible name but it reflects an idea that came > from Seth Jonson in another thread. > Thanks for this. I'll take a look. Imo, copy-node followed by paste-as-template is even better than an atomic duplicate-template comm

Re: An implementation of paste-retaining-outside-clones command

2020-05-28 Thread Differance
Glad I could help here in some manner! Even if I'm still stymied about what the difference is in what you're trying to solve versus what I'm trying to solve. :-) I gather that you're not trying to do the "make local/internal clones with a new vnode" thing I focused on. Rather, you're figuri

Re: An implementation of paste-retaining-outside-clones command

2020-05-28 Thread vitalije
It doesn't paste unknownAttributes but it would be trivial to add this functionality. 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 leo-editor+unsubsc

An implementation of paste-retaining-outside-clones command

2020-05-28 Thread vitalije
This might not be the best possible name but it reflects an idea that came from Seth Jonson in another thread. The idea is to clone all those nodes that are present in the outline outside copied tree. All nodes that are located only under the copied tree should not be cloned unless they have cl