On Sun, Oct 5, 2008 at 8:38 AM, Ville M. Vainio <[EMAIL PROTECTED]> wrote: > > On Sun, Oct 5, 2008 at 3:09 PM, Edward K. Ream <[EMAIL PROTECTED]> wrote: > >> It may be worthwhile to really provide methods to set node / >>> subtree "dirty", so only that part of the tree would need to be >>> regenerated. Moreover, if clones are detected, the subtrees of all the >>> clones would need to be recreated as well. >> >> This seems like an heroic solution if done in Leo's core. Another >> possibility would be to try to compute the diffs within >> leoQtTree.redraw_now. For now, I'll leave possible optimizations to >> you. > > Ok, here's a simple plan that should work: > > subtree_changed_tnodes = set() > > - When a tree-changing operation happens, we add the tnode of the > parent (subtree of which needs to be created) to the set > > - Then, it's just a matter of maintaining a dict that maps tnode to > list of positions (all clones), iterating though > subtree_changed_tnodes and using the dict to re-create the dirty > subtrees, skipping invalid positions.
An interesting idea, and simple enough to put into the core. Feel free to experiment directly in the trunk if you like. Init questions always come up while porting guis. The essence of the init problem is that everyone wants to go last: init code is easiest to write if the code is executed late in the init sequence. At present, most classes are inited in two steps: the ctor is called first--a finishCreate method is called later. It would be easy to add a third stage, say initAfterLoad. Leo, that is, g.openWithFileName, would call c.initAfterLoad and c.frame.initAfterLoad at about the time the 'after-create-leo-frame' event handler is called. The default actions (in the base leoFrame class) would be to call c.frame.tree.initAfterLoad, c.frame.body.initAfterLoad, etc, and the default actions for *those* methods (in the base class) would be a pass. This provides an official hook for late initialization. In our case, we could call populate_tree in c.frame.tree.initAfterLoad, and have c.frame.tree.redraw_now do nothing. I'll do this soon. Edward --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "leo-editor" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/leo-editor?hl=en -~----------~----~----~----~------~----~------~--~---
