diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-08-09 18:16:22 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-08-09 18:16:22 +0400 |
commit | da6bc69ca9c79ad351950b0df7acdd6483fbc8c3 (patch) | |
tree | 0e468839e7e05bb94b500011f8f26849700ef871 | |
parent | 08e184f3022494e1c834c22a25f7a23d2312e9d8 (diff) |
fix [#28191] Exception when enabling a script for a newer Blender build
-rw-r--r-- | doc/python_api/rst/bge.logic.rst | 4 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_userpref.py | 16 |
2 files changed, 14 insertions, 6 deletions
diff --git a/doc/python_api/rst/bge.logic.rst b/doc/python_api/rst/bge.logic.rst index 7c392901eec..798491b4710 100644 --- a/doc/python_api/rst/bge.logic.rst +++ b/doc/python_api/rst/bge.logic.rst @@ -220,8 +220,8 @@ General functions .. note:: This function is not effective immediately, the scene is queued - and added on the next logic cycle where it will be available - from `getSceneList` + and added on the next logic cycle where it will be available + from `getSceneList` :arg name: The name of the scene :type name: string diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index e6fd8dcb949..944f5aaf4c1 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -1076,17 +1076,25 @@ class WM_OT_addon_enable(bpy.types.Operator): bl_idname = "wm.addon_enable" bl_label = "Enable Add-On" - module = StringProperty(name="Module", description="Module name of the addon to enable") + module = StringProperty( + name="Module", + description="Module name of the addon to enable", + ) def execute(self, context): mod = addon_utils.enable(self.module) if mod: - # check if add-on is written for current blender version, or raise a warning info = addon_utils.module_bl_info(mod) - if info.get("blender", (0, 0, 0)) > bpy.app.version: - self.report("WARNING','This script was written for a newer version of Blender and might not function (correctly).\nThe script is enabled though.") + info_ver = info.get("blender", (0, 0, 0)) + + if info_ver > bpy.app.version: + self.report({'WARNING'}, ("This script was written Blender " + "version %d.%d.%d and might not " + "function (correctly).\n" + "The script is enabled though.") % + info_ver) return {'FINISHED'} else: return {'CANCELLED'} |