diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-07-31 07:15:37 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-07-31 07:15:37 +0400 |
commit | f4293067c1420827ddfa62e62430870c6b790a8a (patch) | |
tree | 6ad74d1ea760e4450dd27236a0f7ed3987d4283b /release/scripts/modules/addon_utils.py | |
parent | 670f58023c478995ed055e194482ab288db436a7 (diff) |
py api: sphinx doc corrections, pep8 cleanup and style edits, also added __all__ to some modules which were missing it.
Diffstat (limited to 'release/scripts/modules/addon_utils.py')
-rw-r--r-- | release/scripts/modules/addon_utils.py | 45 |
1 files changed, 35 insertions, 10 deletions
diff --git a/release/scripts/modules/addon_utils.py b/release/scripts/modules/addon_utils.py index 5aed0581ea9..22936f4c209 100644 --- a/release/scripts/modules/addon_utils.py +++ b/release/scripts/modules/addon_utils.py @@ -16,7 +16,7 @@ # # ##### END GPL LICENSE BLOCK ##### -# <pep8 compliant> +# <pep8-80 compliant> __all__ = ( "paths", @@ -26,7 +26,7 @@ __all__ = ( "disable", "reset_all", "module_bl_info", -) + ) import bpy as _bpy @@ -129,7 +129,12 @@ def modules(module_cache): error_duplicates = True elif mod.__time__ != os.path.getmtime(mod_path): - print("reloading addon:", mod_name, mod.__time__, os.path.getmtime(mod_path), mod_path) + print("reloading addon:", + mod_name, + mod.__time__, + os.path.getmtime(mod_path), + mod_path, + ) del module_cache[mod_name] mod = None @@ -144,7 +149,9 @@ def modules(module_cache): del modules_stale mod_list = list(module_cache.values()) - mod_list.sort(key=lambda mod: (mod.bl_info['category'], mod.bl_info['name'])) + mod_list.sort(key=lambda mod: (mod.bl_info['category'], + mod.bl_info['name'], + )) return mod_list @@ -164,8 +171,9 @@ def check(module_name): loaded_state = mod and getattr(mod, "__addon_enabled__", Ellipsis) if loaded_state is Ellipsis: - print("Warning: addon-module %r found module but without" - " __addon_enabled__ field, possible name collision from file: %r" % + print("Warning: addon-module %r found module " + "but without __addon_enabled__ field, " + "possible name collision from file: %r" % (module_name, getattr(mod, "__file__", "<unknown>"))) loaded_state = False @@ -208,7 +216,8 @@ def enable(module_name, default_set=True): return None mod.__addon_enabled__ = False - # Split registering up into 3 steps so we can undo if it fails par way through + # Split registering up into 3 steps so we can undo + # if it fails par way through. # 1) try import try: mod = __import__(module_name) @@ -255,8 +264,9 @@ def disable(module_name, default_set=True): import sys mod = sys.modules.get(module_name) - # possible this addon is from a previous session and didnt load a module this time. - # so even if the module is not found, still disable the addon in the user prefs. + # possible this addon is from a previous session and didnt load a + # module this time. So even if the module is not found, still disable + # the addon in the user prefs. if mod: mod.__addon_enabled__ = False @@ -311,7 +321,22 @@ def reset_all(reload_scripts=False): disable(mod_name) -def module_bl_info(mod, info_basis={"name": "", "author": "", "version": (), "blender": (), "api": 0, "location": "", "description": "", "wiki_url": "", "tracker_url": "", "support": 'COMMUNITY', "category": "", "warning": "", "show_expanded": False}): +def module_bl_info(mod, info_basis={"name": "", + "author": "", + "version": (), + "blender": (), + "api": 0, + "location": "", + "description": "", + "wiki_url": "", + "tracker_url": "", + "support": 'COMMUNITY', + "category": "", + "warning": "", + "show_expanded": False, + } + ): + addon_info = getattr(mod, "bl_info", {}) # avoid re-initializing |