(self)
return char, scan, modscan
Retrieve one keypress.
Retrieve one keypress.
Retrieve one keypress .
def _get_key(self):
        """Retrieve one keypress."""
        char, key, mods = console.read_key()
        if not char and not key:
            return None, None, []
        # override characters wth alt
        if 'ALT' in mods and 'CTRL' not in mods:
            char = ALT_KEY_TO_EASCII.get(key, u'')
        # don't override ctrl characters
        if not char:
            if 'CTRL' in mods and 'ALT' not in mods:
                char = CTRL_KEY_TO_EASCII.get(key, u'')
            elif mods == {'SHIFT'}:
                char = SHIFT_KEY_TO_EASCII.get(key, char)
            else:
                char = KEY_TO_EASCII.get(key, char)
        scan = KEY_TO_SCAN.get(key, None)
        modscan = [MOD_TO_SCAN[mod] for mod in mods if mod in MOD_TO_SCAN]
        return char, scan, modscan
def _get_key ( self ) : char , key , mods = console . read_key ( ) if not char and not key : return None , None , [ ] # override characters wth alt if 'ALT' in mods and 'CTRL' not in mods : char = ALT_KEY_TO_EASCII . get ( key , u'' ) # don't override ctrl characters if not char : if 'CTRL' in mods and 'ALT' not in mods : char = CTRL_KEY_TO_EASCII . get ( key , u'' ) elif mods == { 'SHIFT' } : char = SHIFT_KEY_TO_EASCII . get ( key , char ) else : char = KEY_TO_EASCII . get ( key , char ) scan = KEY_TO_SCAN . get ( key , None ) modscan = [ MOD_TO_SCAN [ mod ] for mod in mods if mod in MOD_TO_SCAN ] return char , scan , modscan