Give that a check and I think the work at #213 partialy captures the parse_platform logic at https://github.com/napari/napari/blob/main/napari/utils/interactions.py#L312 The missing thing I would say is also being able to parse symbols from non modifier keys like enter, arrows, backspace, delete, tab, space, etc. Could it be worthy to further extend the parsing capabilities to any symbol or representation that os_symbol and os_name can return? From a quick check, maybe extending the KEYCODE_FROM_LOWERCASE_STRING dictionary could be a way to achieve this? So something like:
KEYCODE_FROM_LOWERCASE_STRING: Dict[str, KeyCode] = {
# two special cases for assigning os-specific strings to the meta key
'win': KeyCode.Meta,
'cmd': KeyCode.Meta,
# special cases for symbols and other os-specific strings
'↵': KeyCode.Enter,
'→': KeyCode.RightArrow,
...
}
Originally posted by @dalthviz in #211 (comment)
Give that a check and I think the work at #213 partialy captures the
parse_platformlogic at https://github.com/napari/napari/blob/main/napari/utils/interactions.py#L312 The missing thing I would say is also being able to parse symbols from non modifier keys like enter, arrows, backspace, delete, tab, space, etc. Could it be worthy to further extend the parsing capabilities to any symbol or representation thatos_symbolandos_namecan return? From a quick check, maybe extending theKEYCODE_FROM_LOWERCASE_STRINGdictionary could be a way to achieve this? So something like:Originally posted by @dalthviz in #211 (comment)