Fix UI extension removal

App-templates & keymap names had their extensions removed twice.

Confusing for filenames containing dots.
This commit is contained in:
Campbell Barton 2019-01-25 13:45:56 +11:00
parent 3d8cbb534f
commit 6cc5c28d15
3 changed files with 5 additions and 4 deletions

@ -201,7 +201,7 @@ _display_name_literals = {
}
def display_name(name):
def display_name(name, *, has_ext=True):
"""
Creates a display string from name to be used menus and the user interface.
Capitalize the first letter in all lowercase names,
@ -209,7 +209,8 @@ def display_name(name):
filenames and module names.
"""
name = _os.path.splitext(basename(name))[0]
if has_ext:
name = _os.path.splitext(basename(name))[0]
# string replacements
for disp_value, file_value in _display_name_literals.items():

@ -369,7 +369,7 @@ def draw_keymaps(context, layout):
spref = context.space_data
# row.prop_search(wm.keyconfigs, "active", wm, "keyconfigs", text="Key Config")
text = bpy.path.display_name(kc_active.name)
text = bpy.path.display_name(kc_active.name, has_ext=False)
if not text:
text = "Blender (default)"

@ -588,7 +588,7 @@ class TOPBAR_MT_file(Menu):
app_template = None
if app_template:
layout.label(text=bpy.path.display_name(app_template))
layout.label(text=bpy.path.display_name(app_template, has_ext=False))
layout.operator("wm.save_homefile")
layout.operator(
"wm.read_factory_settings",