forked from bartvdbraak/blender
Python Open Link operator.
* Unified some code for Opening an URL to use only one operator: WM_OT_url_open * Removed the HELP_OT_url operators.
This commit is contained in:
parent
bff5410504
commit
ccda04131a
@ -418,7 +418,7 @@ class WM_OT_context_modal_mouse(bpy.types.Operator):
|
||||
|
||||
|
||||
class WM_OT_url_open(bpy.types.Operator):
|
||||
"Open the Blender Wiki in the Webbrowser"
|
||||
"Open a website in the Webbrowser"
|
||||
bl_idname = "wm.url_open"
|
||||
bl_label = ""
|
||||
|
||||
|
@ -310,19 +310,19 @@ class INFO_MT_help(bpy.types.Menu):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator("help.manual", icon='HELP')
|
||||
layout.operator("help.release_logs", icon='URL')
|
||||
layout.operator("wm.url_open", text="Manual", icon='HELP').url = 'http://wiki.blender.org/index.php/Doc:Manual'
|
||||
layout.operator("wm.url_open", text="Release Log", icon='URL').url = 'http://www.blender.org/development/release-logs/blender-250/'
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("help.blender_website", icon='URL')
|
||||
layout.operator("help.blender_eshop", icon='URL')
|
||||
layout.operator("help.developer_community", icon='URL')
|
||||
layout.operator("help.user_community", icon='URL')
|
||||
layout.operator("wm.url_open", text="Blender Website", icon='URL').url = 'http://www.blender.org/'
|
||||
layout.operator("wm.url_open", text="Blender e-Shop", icon='URL').url = 'http://www.blender.org/e-shop'
|
||||
layout.operator("wm.url_open", text="Developer Community", icon='URL').url = 'http://www.blender.org/community/get-involved/'
|
||||
layout.operator("wm.url_open", text="User Community", icon='URL').url = 'http://www.blender.org/community/user-community/'
|
||||
layout.separator()
|
||||
layout.operator("help.report_bug", icon='URL')
|
||||
layout.operator("wm.url_open", text="Report a Bug", icon='URL').url = 'http://projects.blender.org/tracker/?atid=498&group_id=9&func=browse'
|
||||
layout.separator()
|
||||
layout.operator("help.python_api", icon='URL')
|
||||
layout.operator("wm.url_open", text="Python API Reference", icon='URL').url = 'http://www.blender.org/documentation/250PythonDoc/contents.html'
|
||||
layout.operator("help.operator_cheat_sheet")
|
||||
layout.separator()
|
||||
layout.operator("wm.splash")
|
||||
@ -331,70 +331,6 @@ class INFO_MT_help(bpy.types.Menu):
|
||||
# Help operators
|
||||
|
||||
|
||||
class HelpOperator(bpy.types.Operator):
|
||||
|
||||
def execute(self, context):
|
||||
import webbrowser
|
||||
webbrowser.open(self._url)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class HELP_OT_manual(HelpOperator):
|
||||
'''The Blender Wiki manual'''
|
||||
bl_idname = "help.manual"
|
||||
bl_label = "Manual"
|
||||
_url = 'http://wiki.blender.org/index.php/Doc:Manual'
|
||||
|
||||
|
||||
class HELP_OT_release_logs(HelpOperator):
|
||||
'''Information about the changes in this version of Blender'''
|
||||
bl_idname = "help.release_logs"
|
||||
bl_label = "Release Log"
|
||||
_url = 'http://www.blender.org/development/release-logs/blender-250/'
|
||||
|
||||
|
||||
class HELP_OT_blender_website(HelpOperator):
|
||||
'''The official Blender website'''
|
||||
bl_idname = "help.blender_website"
|
||||
bl_label = "Blender Website"
|
||||
_url = 'http://www.blender.org/'
|
||||
|
||||
|
||||
class HELP_OT_blender_eshop(HelpOperator):
|
||||
'''Buy official Blender resources and merchandise online'''
|
||||
bl_idname = "help.blender_eshop"
|
||||
bl_label = "Blender e-Shop"
|
||||
_url = 'http://www.blender.org/e-shop'
|
||||
|
||||
|
||||
class HELP_OT_developer_community(HelpOperator):
|
||||
'''Get involved with Blender development'''
|
||||
bl_idname = "help.developer_community"
|
||||
bl_label = "Developer Community"
|
||||
_url = 'http://www.blender.org/community/get-involved/'
|
||||
|
||||
|
||||
class HELP_OT_user_community(HelpOperator):
|
||||
'''Get involved with other Blender users'''
|
||||
bl_idname = "help.user_community"
|
||||
bl_label = "User Community"
|
||||
_url = 'http://www.blender.org/community/user-community/'
|
||||
|
||||
|
||||
class HELP_OT_report_bug(HelpOperator):
|
||||
'''Report a bug in the Blender bug tracker'''
|
||||
bl_idname = "help.report_bug"
|
||||
bl_label = "Report a Bug"
|
||||
_url = 'http://projects.blender.org/tracker/?atid=498&group_id=9&func=browse'
|
||||
|
||||
|
||||
class HELP_OT_python_api(HelpOperator):
|
||||
'''Reference for operator and data Python API'''
|
||||
bl_idname = "help.python_api"
|
||||
bl_label = "Python API Reference"
|
||||
_url = 'http://www.blender.org/documentation/250PythonDoc/contents.html'
|
||||
|
||||
|
||||
class HELP_OT_operator_cheat_sheet(bpy.types.Operator):
|
||||
bl_idname = "help.operator_cheat_sheet"
|
||||
bl_label = "Operator Cheat Sheet (new textblock)"
|
||||
@ -435,14 +371,6 @@ classes = [
|
||||
INFO_MT_render,
|
||||
INFO_MT_help,
|
||||
|
||||
HELP_OT_manual,
|
||||
HELP_OT_release_logs,
|
||||
HELP_OT_blender_website,
|
||||
HELP_OT_blender_eshop,
|
||||
HELP_OT_developer_community,
|
||||
HELP_OT_user_community,
|
||||
HELP_OT_report_bug,
|
||||
HELP_OT_python_api,
|
||||
HELP_OT_operator_cheat_sheet]
|
||||
|
||||
|
||||
|
@ -1224,9 +1224,9 @@ class USERPREF_PT_addons(bpy.types.Panel):
|
||||
split = column.row().split(percentage=0.15)
|
||||
split.label(text="Internet:")
|
||||
if info["wiki_url"]:
|
||||
split.operator("wm.addon_links", text="Link to the Wiki").link = info["wiki_url"]
|
||||
split.operator("wm.url_open", text="Link to the Wiki", icon='HELP').url = info["wiki_url"]
|
||||
if info["tracker_url"]:
|
||||
split.operator("wm.addon_links", text="Report a Bug").link = info["tracker_url"]
|
||||
split.operator("wm.url_open", text="Report a Bug", icon='URL').url = info["tracker_url"]
|
||||
|
||||
if info["wiki_url"] and info["tracker_url"]:
|
||||
split.separator()
|
||||
@ -1421,19 +1421,6 @@ class WM_OT_addon_expand(bpy.types.Operator):
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class WM_OT_addon_links(bpy.types.Operator):
|
||||
"Open a website in the webbrowser"
|
||||
bl_idname = "wm.addon_links"
|
||||
bl_label = ""
|
||||
|
||||
link = StringProperty(name="Link", description="Link to open")
|
||||
|
||||
def execute(self, context):
|
||||
import webbrowser
|
||||
webbrowser.open(self.properties.link)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
classes = [
|
||||
USERPREF_HT_header,
|
||||
USERPREF_PT_tabs,
|
||||
@ -1451,8 +1438,7 @@ classes = [
|
||||
WM_OT_addon_enable,
|
||||
WM_OT_addon_disable,
|
||||
WM_OT_addon_install,
|
||||
WM_OT_addon_expand,
|
||||
WM_OT_addon_links]
|
||||
WM_OT_addon_expand]
|
||||
|
||||
|
||||
def register():
|
||||
|
@ -1202,11 +1202,11 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unuse
|
||||
split = uiLayoutSplit(layout, 0, 0);
|
||||
col = uiLayoutColumn(split, 0);
|
||||
uiItemL(col, "Links", 0);
|
||||
uiItemO(col, NULL, ICON_URL, "HELP_OT_release_logs");
|
||||
uiItemO(col, NULL, ICON_URL, "HELP_OT_manual");
|
||||
uiItemO(col, NULL, ICON_URL, "HELP_OT_blender_website");
|
||||
uiItemO(col, NULL, ICON_URL, "HELP_OT_user_community");
|
||||
uiItemO(col, NULL, ICON_URL, "HELP_OT_python_api");
|
||||
uiItemStringO(col, "Release Log", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/release-logs/blender-250/");
|
||||
uiItemStringO(col, "Manual", ICON_URL, "WM_OT_url_open", "url", "http://wiki.blender.org/index.php/Doc:Manual");
|
||||
uiItemStringO(col, "Blender Website", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/");
|
||||
uiItemStringO(col, "User Community", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/community/user-community/");
|
||||
uiItemStringO(col, "Python API Reference", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/documentation/250PythonDoc/contents.html");
|
||||
uiItemL(col, "", 0);
|
||||
|
||||
col = uiLayoutColumn(split, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user