Rev 5664 changes the crucial selectHelper method in leoFrame.py. I believe
the new code is as clean, clear and correct as possible.
The new code should cause no problems for *most* people, but it might cause
a problem for someone (I don't remember who) who requested changes I made
maybe a year ago. Please report any problems immediately. And yes, I've
checked that a newly-created node always has empty body text ;-)
*Some* kind of changes had to be made: the code clearly didn't do what was
intended. The 'unselect1' event was being generated twice; the 'select1'
hook wasn't being selected at all.
The heart of the new code is::
# Part 1: Unselect.
if call_event_handlers:
unselect = not
g.doHook("unselect1",c=c,new_p=p,old_p=old_p,new_v=p,old_v=old_p)
else:
unselect = True
if unselect:
<< unselect the old node >>
if call_event_handlers:
g.doHook("unselect2",c=c,new_p=p,old_p=old_p,new_v=p,old_v=old_p)
# Part 2a: Start selecting:
if call_event_handlers:
select = not
g.doHook("select1",c=c,new_p=p,old_p=old_p,new_v=p,old_v=old_p)
else:
select = True
if select:
self.selectNewNode(p,old_p)
c.nodeHistory.update(p) # Remember this position.
As you can see, there is now some "symmetry" in the way events are
generated. Here are the essential features of the code:
1. Both Part1 and Part 2a do the default processing unless the call to
doHook returns a value equivalent to True. In that case, the event handler
claims to have *fully* handled the event and nothing happens.
2. Neither Part1 nor Part 2a (nor the not-shown part 2b) generate any
unselect or select events if call_event_handlers is False, that is, p ==
old_p. This means that clicking a headline (which *does* the
tree-selection logic, will generate no events if the node being clicked is
the already-selected node. That makes sense, imo.
Edward
--
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.
For more options, visit https://groups.google.com/groups/opt_out.