UI: correct the keymap editor to match the OSKEY label to the platform
This commit is contained in:
@@ -175,6 +175,8 @@ def draw_kmi(display_keymaps, kc, km, kmi, layout, level):
|
||||
sub.prop(kmi, "idname", text="")
|
||||
|
||||
if map_type not in {'TEXTINPUT', 'TIMER'}:
|
||||
from sys import platform
|
||||
|
||||
sub = split.column()
|
||||
subrow = sub.row(align=True)
|
||||
|
||||
@@ -195,11 +197,21 @@ def draw_kmi(display_keymaps, kc, km, kmi, layout, level):
|
||||
subrow = sub.row()
|
||||
subrow.scale_x = 0.75
|
||||
subrow.prop(kmi, "any", toggle=True)
|
||||
|
||||
# Match text in `WM_key_event_string`.
|
||||
match platform:
|
||||
case "darwin":
|
||||
oskey_label = "Cmd"
|
||||
case "win32":
|
||||
oskey_label = "Win"
|
||||
case _:
|
||||
oskey_label = "OS"
|
||||
|
||||
# Use `*_ui` properties as integers aren't practical.
|
||||
subrow.prop(kmi, "shift_ui", toggle=True)
|
||||
subrow.prop(kmi, "ctrl_ui", toggle=True)
|
||||
subrow.prop(kmi, "alt_ui", toggle=True)
|
||||
subrow.prop(kmi, "oskey_ui", text="Cmd", toggle=True)
|
||||
subrow.prop(kmi, "oskey_ui", text=oskey_label, toggle=True)
|
||||
|
||||
# On systems that don't support Hyper, only show if it's enabled.
|
||||
# Otherwise the user may have a key binding that doesn't work and can't be changed.
|
||||
|
||||
@@ -1134,6 +1134,7 @@ const char *WM_key_event_string(const short type, const bool compact)
|
||||
return key_event_glyph_or_text(font_id, IFACE_("Alt"), single_glyph);
|
||||
}
|
||||
case EVT_OSKEY: {
|
||||
/* Keep these labels in sync with: `scripts/modules/rna_keymap_ui.py`. */
|
||||
if (platform == MACOS) {
|
||||
return key_event_glyph_or_text(
|
||||
font_id, IFACE_("Cmd"), BLI_STR_UTF8_PLACE_OF_INTEREST_SIGN);
|
||||
|
||||
Reference in New Issue
Block a user