On Jan 29, 10:13 am, "Edward K. Ream" <[email protected]> wrote:

> Already, putting [the busy] pattern in place has revealed some problems.
> I'll be upping the new code after I test it awhile.

OMG, this is so complicated.  However, there is light at the end of
the tunnel...

After making what I thought were straightforward changes to the event
handlers, not only did lots of unit tests fail, but unitTest.leo was
being corrupted.

So I saved my work, and reverted my local branch, planning to go make
tiny steps and run unit tests after each change.

The very first change was bug fix was in nativeWidget.setItemIcon.
The original code was::

    try:
        # Suppress onItemChanged.
        self.redrawingIcons = True
        self.setItemIconHelper(item,icon)
    except Exception:  #### Oops: this should be 'finally'
        self.redrawingIcons = False

I found this because self.busy was saying that redrawingIcons was true
in afterSelectHint.  After staring at the code for about 15 minutes, I
finally realized why self.redrawingIcons was never being set to
True :-)

Ever careful now, I ran the unit tests.  Imagine my surprise when the
old chaos reappeared!  Think about this: redrawingIcons is used only
to disable the onItemChanged event handler.  But the bug meant that
onItemChanged was never being active!

In other words, we can get rid of onItemChanged, and furthermore,
onItemChanged might have been the cause of all the failed unit tests!
So this is good :-)

My plan is to un-revert this morning's work, put a 'return' at the
start of onItemChanged, and rerun all the unit tests.  Wish me luck.

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
-~----------~----~----~----~------~----~------~--~---

Reply via email to