filter 'Enable' wasnt working.

This commit is contained in:
Campbell Barton 2010-04-21 16:50:51 +00:00
parent bd1363a898
commit d5e60226e5

@ -1137,7 +1137,7 @@ class USERPREF_PT_addons(bpy.types.Panel):
cats = ['All', 'Disabled', 'Enabled'] + sorted(cats)
bpy.types.Scene.EnumProperty(items=[(cats[i], cats[i], str(i)) for i in range(len(cats))],
bpy.types.Scene.EnumProperty(items=[(cat, cat, str(i)) for i, cat in enumerate(cats)],
name="Category", attr="addon_filter", description="Filter add-ons by category")
bpy.types.Scene.StringProperty(name="Search", attr="addon_search",
description="Search within the selected filter")
@ -1153,12 +1153,14 @@ class USERPREF_PT_addons(bpy.types.Panel):
for mod, info in addons:
module_name = mod.__name__
# check if add-on should be visible with current filters
if filter != "All" and \
filter != info["category"] and \
not (module_name not in used_ext and filter == "Disabled"):
is_enabled = module_name in used_ext
# check if add-on should be visible with current filters
if (filter == "All") or \
(filter == info["category"]) or \
(filter == "Enabled" and is_enabled) or \
(filter == "Disabled" and not is_enabled):
continue
if search and search not in info["name"].lower():
if info["author"]:
@ -1185,7 +1187,7 @@ class USERPREF_PT_addons(bpy.types.Panel):
arrow.operator("wm.addon_expand", icon="TRIA_RIGHT").module = module_name
row.label(text=info["name"])
row.operator("wm.addon_disable" if module_name in used_ext else "wm.addon_enable").module = module_name
row.operator("wm.addon_disable" if is_enabled else "wm.addon_enable").module = module_name
# Expanded UI (only if additional infos are available)
if info["expanded"]: