Show
Ignore:
Timestamp:
07/08/08 12:20:56 (5 months ago)
Author:
rob
Message:

Fixed #480: added DescribeKey? action
* modified keystroke processing to send an action to a callback rather than processing the action
* updated the keystroke definition to use the built-in keystrokes from wx itself rather than a hard-coded list here in the source
* changed some default key bindings to C-h for Help

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/peppy/mainmenu.py

    r1460 r1471  
    799799    tooltip = "Describe an action by name" 
    800800    default_menu = ("&Help", -200) 
     801    key_bindings = {'emacs': "C-h a", } 
    801802 
    802803    def __init__(self, *args, **kwargs): 
     
    825826 
    826827 
     828class DescribeKey(SelectAction): 
     829    """Look up the action from the keystroke""" 
     830    name = "&Describe Key" 
     831    alias = "describe-key" 
     832    default_menu = ("&Help", 201) 
     833    key_bindings = {'emacs': "C-h k", } 
     834 
     835    def action(self, index=-1, multiplier=1): 
     836        self.frame.keys.setReportNext(self.displayAction) 
     837 
     838    def displayAction(self, action): 
     839        if action: 
     840            dprint("looking up docs for %s" % action) 
     841            Publisher().sendMessage('peppy.log.info', action.getHelp()) 
     842            self.frame.SetStatusText("Keystroke found.") 
     843        else: 
     844            self.frame.SetStatusText("Unbound keystroke.") 
     845 
     846 
    827847class CancelMinibuffer(SelectAction): 
    828848    alias = "cancel-minibuffer" 
     
    841861    tooltip = "Show help for the currently active minibuffer" 
    842862    default_menu = ("&Help", 210) 
    843     key_bindings = {'emacs': "M-S-/ m", } 
     863    key_bindings = {'emacs': "C-h m", } 
    844864     
    845865    def isEnabled(self): 
     
    903923                NewWindow, DeleteWindow, WindowList, 
    904924                 
    905                 ExecuteActionByName, DescribeAction, HelpMinibuffer, 
     925                ExecuteActionByName, DescribeAction, DescribeKey, HelpMinibuffer, 
    906926                 
    907927                CancelMinibuffer,