Cleanup: minor simplification to user-addon check
authorCampbell Barton <ideasman42@gmail.com>
Wed, 7 Nov 2018 22:54:13 +0000 (09:54 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 7 Nov 2018 22:54:13 +0000 (09:54 +1100)
release/scripts/startup/bl_ui/space_userpref.py

index 26facd251748f163c1ebb57b9fbce95fe7ff2ac0..56bcd2870c298ce11e847746e60550119a51f916 100644 (file)
@@ -1371,8 +1371,13 @@ class USERPREF_PT_addons(Panel):
         userpref = context.user_preferences
         used_ext = {ext.module for ext in userpref.addons}
 
-        userpref_addons_folder = os.path.join(userpref.filepaths.script_directory, "addons")
-        scripts_addons_folder = bpy.utils.user_resource('SCRIPTS', "addons")
+        addon_user_dirs = tuple(
+            p for p in (
+                os.path.join(userpref.filepaths.script_directory, "addons"),
+                bpy.utils.user_resource('SCRIPTS', "addons"),
+            )
+            if p
+        )
 
         # collect the categories that can be filtered on
         addons = [
@@ -1429,12 +1434,13 @@ class USERPREF_PT_addons(Panel):
                 continue
 
             # check if addon should be visible with current filters
-            if ((filter == "All") or
-                        (filter == info["category"]) or
-                        (filter == "Enabled" and is_enabled) or
+            if (
+                    (filter == "All") or
+                    (filter == info["category"]) or
+                    (filter == "Enabled" and is_enabled) or
                     (filter == "Disabled" and not is_enabled) or
-                    (filter == "User" and (mod.__file__.startswith((scripts_addons_folder, userpref_addons_folder))))
-                    ):
+                    (filter == "User" and (mod.__file__.startswith(addon_user_dirs)))
+            ):
                 if search and search not in info["name"].lower():
                     if info["author"]:
                         if search not in info["author"].lower():