ability to register your own online manual callbacks - useful for 3rd party addon developers, who may want to link to their own URL's.

This commit is contained in:
Campbell Barton
2012-08-25 14:07:51 +00:00
parent 71d1b09708
commit a7ec09aef9
2 changed files with 52 additions and 17 deletions

View File

@@ -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__))
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
import sys
del sys.modules["rna_wiki_reference"]
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):