diff options
6 files changed, 29 insertions, 29 deletions
diff --git a/release/scripts/modules/bpy_extras/keyconfig_utils.py b/release/scripts/modules/bpy_extras/keyconfig_utils.py index eb727167d33..a8cf9ab7e53 100644 --- a/release/scripts/modules/bpy_extras/keyconfig_utils.py +++ b/release/scripts/modules/bpy_extras/keyconfig_utils.py @@ -474,7 +474,7 @@ def _kmi_props_setattr(kmi_props, attr, value): print(f"Warning: {ex!r}") -def keymap_items_from_data(km, km_items, is_modal=False): +def keymap_init_from_data(km, km_items, is_modal=False): new_fn = getattr(km.keymap_items, "new_modal" if is_modal else "new") for (kmi_idname, kmi_args, kmi_data) in km_items: kmi = new_fn(kmi_idname, **kmi_args) @@ -494,7 +494,7 @@ def keyconfig_init_from_data(kc, keyconfig_data): # Runs at load time, keep this fast! for (km_name, km_args, km_content) in keyconfig_data: km = kc.keymaps.new(km_name, **km_args) - keymap_items_from_data(km, km_content["items"], is_modal=km_args.get("modal", False)) + keymap_init_from_data(km, km_content["items"], is_modal=km_args.get("modal", False)) def keyconfig_import_from_data(name, keyconfig_data): diff --git a/release/scripts/presets/keyconfig/blender.py b/release/scripts/presets/keyconfig/blender.py index c6d106d5806..7d4f2213a87 100644 --- a/release/scripts/presets/keyconfig/blender.py +++ b/release/scripts/presets/keyconfig/blender.py @@ -7,8 +7,8 @@ from bpy.props import ( idname = os.path.splitext(os.path.basename(__file__))[0] -def update(_self, _context): - _load() +def update_fn(_self, _context): + load() class Prefs(bpy.types.KeyConfigPreferences): @@ -24,7 +24,7 @@ class Prefs(bpy.types.KeyConfigPreferences): "Mouse button used for selection" ), default='RIGHT', - update=update, + update=update_fn, ) spacebar_action: EnumProperty( name="Spacebar", @@ -43,15 +43,15 @@ class Prefs(bpy.types.KeyConfigPreferences): "Action when 'Space' is pressed ('Shift-Space' is used for the other action)" ), default='TOOL', - update=update, + update=update_fn, ) use_select_all_toggle: BoolProperty( name="Select All Toggles", description=( - "Causes select-all (A-key) to de-select in the case a selection exists" + "Causes select-all ('A' key) to de-select in the case a selection exists" ), default=False, - update=update, + update=update_fn, ) def draw(self, layout): @@ -71,14 +71,14 @@ from bpy_extras.keyconfig_utils import ( keyconfig_module_from_preset, ) -mod = keyconfig_module_from_preset(os.path.join("keymap_data", "blender_default"), __file__) +blender_default = keyconfig_module_from_preset(os.path.join("keymap_data", "blender_default"), __file__) -def _load(): +def load(): kc = bpy.context.window_manager.keyconfigs.new(idname) kc_prefs = kc.preferences - keyconfig_data = mod.generate_keymaps( - mod.KeymapParams( + keyconfig_data = blender_default.generate_keymaps( + blender_default.Params( select_mouse=kc_prefs.select_mouse, spacebar_action=kc_prefs.spacebar_action, use_select_all_toggle=kc_prefs.use_select_all_toggle, @@ -89,4 +89,4 @@ def _load(): if __name__ == "__main__": bpy.utils.register_class(Prefs) - _load() + load() diff --git a/release/scripts/presets/keyconfig/blender_27x.py b/release/scripts/presets/keyconfig/blender_27x.py index 15888b68e50..e9fa7c3ec6a 100644 --- a/release/scripts/presets/keyconfig/blender_27x.py +++ b/release/scripts/presets/keyconfig/blender_27x.py @@ -6,8 +6,8 @@ from bpy.props import ( idname = os.path.splitext(os.path.basename(__file__))[0] -def update(_self, _context): - _load() +def update_fn(_self, _context): + load() class Prefs(bpy.types.KeyConfigPreferences): @@ -23,7 +23,7 @@ class Prefs(bpy.types.KeyConfigPreferences): "Mouse button used for selection" ), default='RIGHT', - update=update, + update=update_fn, ) def draw(self, layout): @@ -36,14 +36,14 @@ from bpy_extras.keyconfig_utils import ( keyconfig_module_from_preset, ) -mod = keyconfig_module_from_preset(os.path.join("keymap_data", "blender_default"), __file__) +blender_default = keyconfig_module_from_preset(os.path.join("keymap_data", "blender_default"), __file__) -def _load(): +def load(): kc = bpy.context.window_manager.keyconfigs.new(idname) kc_prefs = kc.preferences - keyconfig_data = mod.generate_keymaps( - mod.KeymapParams( + keyconfig_data = blender_default.generate_keymaps( + blender_default.Params( select_mouse=kc_prefs.select_mouse, legacy=True, ), @@ -53,4 +53,4 @@ def _load(): if __name__ == "__main__": bpy.utils.register_class(Prefs) - _load() + load() diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py index f32b9d8fb73..18ee81977aa 100644 --- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -20,7 +20,7 @@ # ------------------------------------------------------------------------------ # Configurable Parameters -class KeymapParams: +class Params: __slots__ = ( "apple", "legacy", @@ -5674,7 +5674,7 @@ def km_3d_view_tool_gpencil_edit_to_sphere(params): def generate_keymaps(params=None): if params is None: - params = KeymapParams() + params = Params() return [ # Window, screen, area, region. km_window(params), @@ -5889,7 +5889,7 @@ def generate_keymaps(params=None): # import pprint # for legacy in (False, True): # with open("keymap_default.py" if not legacy else "keymap_legacy.py", 'w') as fh: -# fh.write(pprint.pformat(generate_keymaps(KeymapParams(legacy=legacy)), indent=2, width=80)) +# fh.write(pprint.pformat(generate_keymaps(Params(legacy=legacy)), indent=2, width=80)) # import sys # sys.exit() # # end code @@ -5905,5 +5905,5 @@ def generate_keymaps(params=None): if __name__ == "__main__": from bpy_extras.keyconfig_utils import keyconfig_import_from_data - keyconfig_import_from_data("Blender", generate_keymaps()) - keyconfig_import_from_data("Blender 27X", generate_keymaps(KeymapParams(legacy=True))) + keyconfig_import_from_data("blender", generate_keymaps()) + keyconfig_import_from_data("blender_27", generate_keymaps(Params(legacy=True))) diff --git a/release/scripts/startup/bl_ui/space_toolsystem_common.py b/release/scripts/startup/bl_ui/space_toolsystem_common.py index d1068ab2950..24195dcf4dc 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_common.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_common.py @@ -49,8 +49,8 @@ def _keymap_fn_from_seq(keymap_data): def keymap_fn(km): if keymap_fn.keymap_data: - from bpy_extras.keyconfig_utils import keymap_items_from_data - keymap_items_from_data(km, keymap_fn.keymap_data) + from bpy_extras.keyconfig_utils import keymap_init_from_data + keymap_init_from_data(km, keymap_fn.keymap_data) keymap_fn.keymap_data = keymap_data return keymap_fn diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index ace2d1b17d1..a2f9c11b46d 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -1075,7 +1075,7 @@ class USERPREF_PT_input(Panel): kc_prefs = kc.preferences if kc_prefs is not None: box = layout.box() - box.label(text=kc.name.replace("_", " ").title() + " Keymap Options") + box.label(text=kc.name.replace("_", " ").title() + " Keymap") # Defined by user preset, may contain mistakes out of our control. try: kc_prefs.draw(box) |