Ref 4952 of the trunk fixes bug 87933:
"Redefining a key binding breaks menu items with same binding"

This was a difficult bug to fix--I rewrote significant parts of Leo's
code that deals with settings for key binding.

All unit tests pass, and I have been using this code happily for a few
days, but significant problems could be lurking.  Please use caution
and please report any problems immediately, especially settings-
related problems.

Besides fixing the bug, Leo computes accelerators, in menu items
dynamically when the user activates a menu.  The accelerator shows
*all* keys bound to the command associated with the menu item.

In the next few days I'll be simplifying the new code further, so if
you want more stable code please stay away from the trunk and the
nightly builds for the next several days.

Here is the checkin log:

A major reorganization of the configuration code that fixes bug 87933
Redefining a key binding breaks menu items with same binding

- Replaced g.bunches with ShortcutInfo objects, and bunchList name by
aList followed by
  assert isinstance(si,ShortcutInfo),si

  Using ShortcutInfo objects rather than g.bunch was a big win.

- Wrote and tested make_settings_dict and its helpers,
merge_settings_dicts, invert and uninvert.

- Leo computes menu texts dynamically in onAboutToShow.

- leo_update_shortcut now shows all shortcuts for a command.

- leoMenu.define_enable_dict encapsulates data used to enable/disable
commands regardless
  of where those commands appear in Leo's menu. The old code assumed
that a fixed menu
  location for all commands that could be enabled or disabled.

- Removed dynamic_menus "compile-time" constant.

- Created << define global key dicts >> in leoApp.py.

  This is a duplicate of dicts in leoKeys.py: they will be merged
later today
  in a location to be determined.

- Added unused ShortcutName and ShortcutsDict classes.

  The ShortcutName class will go away: it's methods may become methods
of the ShortcutInfo class.
  Alternatively, the methods might stay where they are.

  The ShortcutsDict class *will* become functional: it's the only way
to eliminate the wretched
  _hash hack used in the present raw key dictionaries. Furthermore,
the ShortcutsDict class
  will probably encapsulate inverted dicts.

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