Extensions: show add-on errors in the add-ons panel
Restore the UI from 4.1. Also correct an error when extensions are disabled.
This commit is contained in:
parent
f49780b888
commit
f3630777f6
@ -561,6 +561,30 @@ def addons_panel_draw_items(
|
|||||||
return module_names
|
return module_names
|
||||||
|
|
||||||
|
|
||||||
|
def addons_panel_draw_error_duplicates(layout, error_duplicates):
|
||||||
|
import addon_utils
|
||||||
|
box = layout.box()
|
||||||
|
row = box.row()
|
||||||
|
row.label(text="Multiple add-ons with the same name found!")
|
||||||
|
row.label(icon='ERROR')
|
||||||
|
box.label(text="Delete one of each pair to resolve:")
|
||||||
|
for (addon_name, addon_file, addon_path) in addon_utils.error_duplicates:
|
||||||
|
box.separator()
|
||||||
|
sub_col = box.column(align=True)
|
||||||
|
sub_col.label(text=addon_name + ":")
|
||||||
|
sub_col.label(text=" " + addon_file)
|
||||||
|
sub_col.label(text=" " + addon_path)
|
||||||
|
|
||||||
|
|
||||||
|
def addons_panel_draw_error_generic(layout, lines):
|
||||||
|
box = layout.box()
|
||||||
|
sub = box.row()
|
||||||
|
sub.label(text=lines[0])
|
||||||
|
sub.label(icon='ERROR')
|
||||||
|
for l in lines[1:]:
|
||||||
|
box.label(text=l)
|
||||||
|
|
||||||
|
|
||||||
def addons_panel_draw_impl(
|
def addons_panel_draw_impl(
|
||||||
self,
|
self,
|
||||||
context, # `bpy.types.Context`
|
context, # `bpy.types.Context`
|
||||||
@ -580,14 +604,26 @@ def addons_panel_draw_impl(
|
|||||||
|
|
||||||
from . import repo_cache_store_ensure
|
from . import repo_cache_store_ensure
|
||||||
|
|
||||||
|
layout = self.layout
|
||||||
|
|
||||||
|
# First show any errors, this should be an exceptional situation that should be resolved,
|
||||||
|
# otherwise add-ons may not behave correctly.
|
||||||
|
if addon_utils.error_duplicates:
|
||||||
|
addons_panel_draw_error_duplicates(layout, addon_utils.error_duplicates)
|
||||||
|
if addon_utils.error_encoding:
|
||||||
|
addons_panel_draw_error_generic(
|
||||||
|
layout, (
|
||||||
|
"One or more add-ons do not have UTF-8 encoding",
|
||||||
|
"(see console for details)",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
repo_cache_store = repo_cache_store_ensure()
|
repo_cache_store = repo_cache_store_ensure()
|
||||||
|
|
||||||
# This isn't elegant, but the preferences aren't available on registration.
|
# This isn't elegant, but the preferences aren't available on registration.
|
||||||
if not repo_cache_store.is_init():
|
if not repo_cache_store.is_init():
|
||||||
repo_cache_store_refresh_from_prefs(repo_cache_store)
|
repo_cache_store_refresh_from_prefs(repo_cache_store)
|
||||||
|
|
||||||
layout = self.layout
|
|
||||||
|
|
||||||
prefs = context.preferences
|
prefs = context.preferences
|
||||||
|
|
||||||
# Define a top-most column to place warnings (if-any).
|
# Define a top-most column to place warnings (if-any).
|
||||||
|
@ -2617,7 +2617,6 @@ class USERPREF_PT_addons(AddOnPanel, Panel):
|
|||||||
if filter in {"All", "Enabled"}:
|
if filter in {"All", "Enabled"}:
|
||||||
# Append missing scripts
|
# Append missing scripts
|
||||||
# First collect scripts that are used but have no script file.
|
# First collect scripts that are used but have no script file.
|
||||||
module_names = {mod.__name__ for mod in addon_modules}
|
|
||||||
missing_modules = {
|
missing_modules = {
|
||||||
addon_module_name for addon_module_name in used_addon_module_name_map
|
addon_module_name for addon_module_name in used_addon_module_name_map
|
||||||
if addon_module_name not in module_names
|
if addon_module_name not in module_names
|
||||||
|
Loading…
Reference in New Issue
Block a user