UI: show the version as a string for extensions

Extensions use SEMVER, not a tuple of numbers.
This commit is contained in:
Campbell Barton
2024-01-25 13:45:54 +11:00
parent f212be48ee
commit b686f2a536
2 changed files with 16 additions and 1 deletions

View File

@@ -6,6 +6,7 @@ __all__ = (
"paths",
"modules",
"check",
"check_extension",
"enable",
"disable",
"disable_all",
@@ -268,6 +269,14 @@ def check(module_name):
return loaded_default, loaded_state
def check_extension(module_name):
"""
Return true if the module is an extension.
"""
return module_name.startswith(_ext_base_pkg_idname_with_dot)
# utility functions

View File

@@ -2271,6 +2271,8 @@ class USERPREF_PT_addons(AddOnPanel, Panel):
colsub = box.column()
row = colsub.row(align=True)
is_extension = addon_utils.check_extension(module_name)
row.operator(
"preferences.addon_expand",
icon='DISCLOSURE_TRI_DOWN' if info["show_expanded"] else 'DISCLOSURE_TRI_RIGHT',
@@ -2319,7 +2321,11 @@ class USERPREF_PT_addons(AddOnPanel, Panel):
if value := info["version"]:
split = colsub.row().split(factor=0.15)
split.label(text="Version:")
split.label(text=".".join(str(x) for x in value), translate=False)
# Extensions use SEMVER.
if is_extension:
split.label(text=value, translate=False)
else:
split.label(text=".".join(str(x) for x in value), translate=False)
if value := info["warning"]:
split = colsub.row().split(factor=0.15)
split.label(text="Warning:")