I18n: Restore keyconfig after extracting messages

The translation extraction goes through each keyconfig preset file and
activates it in order to extract its messages. This change makes it
restore the original config, otherwise it would end up switching to
Industry Compatible.

Pull Request: https://projects.blender.org/blender/blender/pulls/122789
This commit is contained in:
Damien Picard
2024-06-05 01:44:46 +02:00
committed by Gitea
parent 8cb94adbef
commit 3b5f7b0052
@@ -455,6 +455,7 @@ def dump_rna_messages(msgs, reports, settings, verbose=False):
walk_class(cls)
# Parse keymap preset preferences
active_keyconfig = bpy.context.window_manager.keyconfigs.active.name
for preset_filename in sorted(
os.listdir(os.path.join(settings.PRESETS_DIR, "keyconfig"))):
preset_path = os.path.join(settings.PRESETS_DIR, "keyconfig", preset_filename)
@@ -466,6 +467,10 @@ def dump_rna_messages(msgs, reports, settings, verbose=False):
preset = bpy.data.window_managers[0].keyconfigs[preset_name]
if preset.preferences is not None:
walk_properties(preset.preferences)
# Restore original keyconfig
bpy.utils.keyconfig_set(
os.path.join(settings.PRESETS_DIR, "keyconfig", active_keyconfig + ".py")
)
# And parse keymaps!
from bl_keymap_utils import keymap_hierarchy