I am glad that you started to work on this issue. 

Your recent posts in other thread have opened my eyes and I was planing to 
encourage you to go and do this issue yourself in your own way.

In our previous discussions and disagreements I misjudge you. I was at some 
points annoyed by your replies because I was thinking that you disagree 
with my ideas for some bad reason. I was suspecting that your pride is 
being hurt or something similar, but I was very wrong indeed. You haven't 
done anything to hurt me or annoy me yet I was annoyed. Now I see it was 
all my fault. My suspicions were the only reason I was annoyed by your 
comments. It was very hard for me to believe that you really think the way 
you write. So, I suspected that you weren't fully honest. Now I am truly 
sorry and I do apologize  for even mentally accusing you for something you 
were not guilty of. 

Your recent posts made me believe that you are honest in your opinions and 
you truly think the way you write. The only trouble is that your opinions 
are quite different than mine. We are looking at the same code but we see 
totally different things and we make opposite conclusions. When I see 
something as a design flaw you proudly claim that it was your intention to 
make it just like that. When I am proud of some code thinking it is almost 
perfect, you see some flaws and defects in it and naturally you feel need 
to improve it.

It is astonishing how different our minds are. Considering all this, it is 
hard to believe that you and me will ever be able to work on the same file 
and both be satisfied with it. Most likely if one of us is satisfied the 
other one will be unsatisfied. 

Our differences are not necessarily a bad thing. It could be also an 
advantage to have different perspectives and different opinions about any 
programming problem.

After all efforts I put in ltm-leo branch and having all unit tests pass, I 
am not very happy with the resulting code. Yes, I have put on my todo list 
to clean up and document the code, but somehow I cant find enough will 
power to do this. Personally I am unsatisfied with the code I just wrote. 
In fact if I should vote on this code right now, I might not wish to 
approve it.

I just learned that Leo is in so many places designed in the way that is 
most unnatural for new data model. To make it work with new model, I had to 
write many lines of code that I am not very proud of, and final result is: 
Leo works with it, but make a very poor usage of new data model. To really 
take the advantage of new data model it has to be redesigned quite a lot. 
It is highly unlikely to happen that we fully agree on all these changes.

*Conclusion*

I think that the best (or most productive) way forward is that I continue 
to work on miniTkLeo and perhaps one day it may become a mini Leo or Leo's 
little brother. I hope that you dont mind this repository staying under 
leo-editor team on github. I might borrow some code from Leo. I see this as 
an opportunity to start from a clean sheet, and to leave out some ancient 
features of Leo and also to use latest Python version. Python 3.6 and later 
are huge improvements for Python and if I drop Python2.7 compatibility 
those improvements might be used freely. 

As for Leo, I will continue to work on it mostly by fixing bugs. I do hope 
you will find some good and inspirational ideas in my code and apply them 
to Leo, using your own style. If you ever need some explanation of my code, 
please don't hesitate to ask and I will do my best to explain the code so 
that you can understand and apply good parts of it in Leo.

*A few hints for the fast draw*

Using QTreeWidget it won't be easy to start drawing at some given position. 
Tree items must have a parent item, so you can't start drawing from some 
middle node, it needs parents all the way to the root. But, you can try 
QGraphicsScene and its items. They are most similar to Tk.Canvas and you 
can have a handful of GraphicItems that you just need to move horizontally 
to the proper indentation, and to set their content. 

Great help in quickly traversing tree to the given top position is to now 
how many nodes are in its subtree. In my model it is the size of a node. I 
thought about adding these field to vnode. The hard part is to keep it 
accurate when some node is added to the subtree or removed from subtree. It 
can be made that Leo internally update this field when ever Leo adds or 
deletes node. It also can be recalculated after script execution. Even if 
it goes out of sync, nothing very bad will happen. The only issue it may 
cause is Leo's tree might look wrong. But that is something users will 
report and than it can be solved.

You may also consider using NewTreeWidget which is drawing tree on its own 
using QPainter. At least you can use its draw_tree method and leave all 
other methods out. It uses iterator display_items of the new data model. 
But if you make a generator using vnodes and positions that yields the same 
values than it will work without new data model. 

It wasn't very obvious to me at first, but it is great help when searching 
for visible nodes, to notice that if we have a single visible item, the 
next visible is either its first child if it has children and if it is 
expanded, or it is the next sibling if there is one or its parent's 
sibling, ... If this node is visible, we know that all its ancestor nodes 
are expanded. This fact might short-cut some searching. 

Also it is good to know that levels of nodes can grow only by 1 step/row, 
but may be reduced by arbitrarily many steps. And whenever level of the 
next node is less than the level of current node, the next node is visible 
(i.e. all its ancestors are expanded).

I hope this will help and if you have any further questions regarding my 
model please ask.

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+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to