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:
Thomas Dinges 2010-05-31 11:38:13 +00:00
parent bff5410504
commit ccda04131a
4 changed files with 17 additions and 103 deletions

@ -418,7 +418,7 @@ class WM_OT_context_modal_mouse(bpy.types.Operator):
class WM_OT_url_open(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_idname = "wm.url_open"
bl_label = "" bl_label = ""

@ -310,19 +310,19 @@ class INFO_MT_help(bpy.types.Menu):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
layout.operator("help.manual", icon='HELP') layout.operator("wm.url_open", text="Manual", icon='HELP').url = 'http://wiki.blender.org/index.php/Doc:Manual'
layout.operator("help.release_logs", icon='URL') layout.operator("wm.url_open", text="Release Log", icon='URL').url = 'http://www.blender.org/development/release-logs/blender-250/'
layout.separator() layout.separator()
layout.operator("help.blender_website", icon='URL') layout.operator("wm.url_open", text="Blender Website", icon='URL').url = 'http://www.blender.org/'
layout.operator("help.blender_eshop", icon='URL') layout.operator("wm.url_open", text="Blender e-Shop", icon='URL').url = 'http://www.blender.org/e-shop'
layout.operator("help.developer_community", icon='URL') layout.operator("wm.url_open", text="Developer Community", icon='URL').url = 'http://www.blender.org/community/get-involved/'
layout.operator("help.user_community", icon='URL') layout.operator("wm.url_open", text="User Community", icon='URL').url = 'http://www.blender.org/community/user-community/'
layout.separator() 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.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.operator("help.operator_cheat_sheet")
layout.separator() layout.separator()
layout.operator("wm.splash") layout.operator("wm.splash")
@ -331,70 +331,6 @@ class INFO_MT_help(bpy.types.Menu):
# Help operators # 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): class HELP_OT_operator_cheat_sheet(bpy.types.Operator):
bl_idname = "help.operator_cheat_sheet" bl_idname = "help.operator_cheat_sheet"
bl_label = "Operator Cheat Sheet (new textblock)" bl_label = "Operator Cheat Sheet (new textblock)"
@ -435,14 +371,6 @@ classes = [
INFO_MT_render, INFO_MT_render,
INFO_MT_help, 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] HELP_OT_operator_cheat_sheet]

@ -1224,9 +1224,9 @@ class USERPREF_PT_addons(bpy.types.Panel):
split = column.row().split(percentage=0.15) split = column.row().split(percentage=0.15)
split.label(text="Internet:") split.label(text="Internet:")
if info["wiki_url"]: 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"]: 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"]: if info["wiki_url"] and info["tracker_url"]:
split.separator() split.separator()
@ -1421,19 +1421,6 @@ class WM_OT_addon_expand(bpy.types.Operator):
return {'FINISHED'} 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 = [ classes = [
USERPREF_HT_header, USERPREF_HT_header,
USERPREF_PT_tabs, USERPREF_PT_tabs,
@ -1451,8 +1438,7 @@ classes = [
WM_OT_addon_enable, WM_OT_addon_enable,
WM_OT_addon_disable, WM_OT_addon_disable,
WM_OT_addon_install, WM_OT_addon_install,
WM_OT_addon_expand, WM_OT_addon_expand]
WM_OT_addon_links]
def register(): def register():

@ -1202,11 +1202,11 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unuse
split = uiLayoutSplit(layout, 0, 0); split = uiLayoutSplit(layout, 0, 0);
col = uiLayoutColumn(split, 0); col = uiLayoutColumn(split, 0);
uiItemL(col, "Links", 0); uiItemL(col, "Links", 0);
uiItemO(col, NULL, ICON_URL, "HELP_OT_release_logs"); uiItemStringO(col, "Release Log", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/release-logs/blender-250/");
uiItemO(col, NULL, ICON_URL, "HELP_OT_manual"); uiItemStringO(col, "Manual", ICON_URL, "WM_OT_url_open", "url", "http://wiki.blender.org/index.php/Doc:Manual");
uiItemO(col, NULL, ICON_URL, "HELP_OT_blender_website"); uiItemStringO(col, "Blender Website", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/");
uiItemO(col, NULL, ICON_URL, "HELP_OT_user_community"); uiItemStringO(col, "User Community", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/community/user-community/");
uiItemO(col, NULL, ICON_URL, "HELP_OT_python_api"); uiItemStringO(col, "Python API Reference", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/documentation/250PythonDoc/contents.html");
uiItemL(col, "", 0); uiItemL(col, "", 0);
col = uiLayoutColumn(split, 0); col = uiLayoutColumn(split, 0);