diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-08-25 18:07:51 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-08-25 18:07:51 +0400 |
commit | a7ec09aef91d41a8a1fa5ca531cae5bbbbcde161 (patch) | |
tree | b272a6211405921cae0b7f8e4942d310c0b3e059 /release/scripts/startup | |
parent | 71d1b09708f742ee084c498ae031a1c7da6d6328 (diff) |
ability to register your own online manual callbacks - useful for 3rd party addon developers, who may want to link to their own URL's.
Diffstat (limited to 'release/scripts/startup')
-rw-r--r-- | release/scripts/startup/bl_operators/wm.py | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index b34c427c4a1..ed4d5dd55f5 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -862,26 +862,24 @@ class WM_OT_doc_view_manual(Operator): if rna_id is None: return {'PASS_THROUGH'} - import rna_wiki_reference - rna_ref = self._find_reference(rna_id, rna_wiki_reference.url_manual_mapping) + url = None - if rna_ref is None: - self.report({'WARNING'}, "No reference available '%s', " - "Update info in %r" % - (self.doc_id, rna_wiki_reference.__file__)) - - import sys - del sys.modules["rna_wiki_reference"] + for prefix, url_manual_mapping in bpy.utils.manual_map(): + rna_ref = self._find_reference(rna_id, url_manual_mapping) + if rna_ref is not None: + url = prefix + rna_ref + break - if rna_ref is None: + if url is None: + self.report({'WARNING'}, "No reference available %r, " + "Update info in 'rna_wiki_reference.py' " + " or callback to bpy.utils.manual_map()" % + self.doc_id) return {'CANCELLED'} else: - url = rna_wiki_reference.url_manual_prefix + rna_ref - - import webbrowser - webbrowser.open(url) - - return {'FINISHED'} + import webbrowser + webbrowser.open(url) + return {'FINISHED'} class WM_OT_doc_view(Operator): |