Skip to content
Snippets Groups Projects
Commit 28f0f2d0 authored by Matt Ebb's avatar Matt Ebb
Browse files

Help menu!

Thanks to Willian for integrating the webbrowser module.

Some of the URLs (Python reference, Release notes) will
need to be updated upon release. These are contained in
http://www.blender3d.org/Help/index.php
parent 7ed803f6
No related branches found
No related tags found
No related merge requests found
#!BPY
""" Registration info for Blender menus:
Name: 'HotKeys'
Name: 'Hotkey Reference'
Blender: 232
Group: 'Help'
Tip: 'All the hotkeys.'
Tip: 'All the hotkeys'
"""
# $Id$
#------------------------
......
......@@ -2,7 +2,7 @@
"""
Name: 'System Information...'
Blender: 234
Group: 'Help'
Group: 'HelpSystem'
Tooltip: 'Information about your Blender environment, useful to diagnose problems.'
"""
......
......@@ -78,6 +78,8 @@ static int bpymenu_group_atoi (char *str)
if (!strcmp(str, "Import")) return PYMENU_IMPORT;
else if (!strcmp(str, "Export")) return PYMENU_EXPORT;
else if (!strcmp(str, "Help")) return PYMENU_HELP;
else if (!strcmp(str, "HelpWebsites")) return PYMENU_HELPWEBSITES;
else if (!strcmp(str, "HelpSystem")) return PYMENU_HELPSYSTEM;
else if (!strcmp(str, "Add")) return PYMENU_ADD;
else if (!strcmp(str, "Mesh")) return PYMENU_MESH;
else if (!strcmp(str, "Wizards")) return PYMENU_WIZARDS;
......@@ -104,6 +106,12 @@ char *BPyMenu_group_itoa (short menugroup)
case PYMENU_HELP:
return "Help";
break;
case PYMENU_HELPWEBSITES:
return "Websites";
break;
case PYMENU_HELPSYSTEM:
return "System";
break;
case PYMENU_MESH:
return "Mesh";
break;
......
......@@ -83,7 +83,9 @@ typedef enum {
PYMENU_MISC,
PYMENU_MESH,
PYMENU_MATERIALS,
PYMENU_HELP, /* inserted in the info header 'Help' menu */
PYMENU_HELP, /* Main Help menu items - prob best to leave for 'official' ones */
PYMENU_HELPSYSTEM, /* Resources, troubleshooting, system tools */
PYMENU_HELPWEBSITES, /* Help -> Websites submenu */
PYMENU_IMPORT,
PYMENU_EXPORT,
PYMENU_ANIMATION,
......
......@@ -1549,12 +1549,8 @@ static uiBlock *info_rendermenu(void *arg_unused)
static void do_info_help_websitesmenu(void *arg, int event)
{
/* these are no defines, easier this way, the codes are in the function below */
switch(event) {
case 0: /* */
BPY_menu_do_python(PYMENU_HELPWEBSITES, event);
break;
}
allqueue(REDRAWVIEW3D, 0);
}
......@@ -1562,22 +1558,16 @@ static void do_info_help_websitesmenu(void *arg, int event)
static uiBlock *info_help_websitesmenu(void *arg_unused)
{
uiBlock *block;
BPyMenu *pym;
short yco = 20, menuwidth = 120;
int i = 0;
block= uiNewBlock(&curarea->uiblocks, "info_help_websitesmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
uiBlockSetButmFunc(block, do_info_help_websitesmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Blender Website *", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Blender E-shop *", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Development Community *", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "User Community *", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "...? *", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
for (pym = BPyMenuTable[PYMENU_HELPWEBSITES]; pym; pym = pym->next, i++) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, pym->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i, pym->tooltip?pym->tooltip:pym->filename);
}
uiBlockSetDirection(block, UI_RIGHT);
uiTextBoundsBlock(block, 60);
......@@ -1585,24 +1575,13 @@ static uiBlock *info_help_websitesmenu(void *arg_unused)
return block;
}
static void do_info_helpmenu(void *arg, int event)
static void do_info_help_systemmenu(void *arg, int event)
{
ScrArea *sa;
if(curarea->spacetype==SPACE_INFO) {
sa= find_biggest_area_of_type(SPACE_SCRIPT);
if (!sa) sa= closest_bigger_area();
areawinset(sa->win);
}
/* events >=2 are registered bpython scripts */
if (event >= 2) BPY_menu_do_python(PYMENU_HELP, event - 2);
else switch(event) {
/* events >=10 are registered bpython scripts */
if (event >= 10) BPY_menu_do_python(PYMENU_HELPSYSTEM, event - 10);
else {
switch(event) {
case 0: /* About Blender */
break;
case 1: /* Benchmark */
/* dodgy hack turning on CTRL ALT SHIFT key to do a benchmark
* rather than copying lines and lines of code from toets.c :(
......@@ -1621,6 +1600,53 @@ static void do_info_helpmenu(void *arg, int event)
}
break;
}
}
allqueue(REDRAWVIEW3D, 0);
}
static uiBlock *info_help_systemmenu(void *arg_unused)
{
uiBlock *block;
BPyMenu *pym;
short yco = 20, menuwidth = 120;
int i = 0;
block= uiNewBlock(&curarea->uiblocks, "info_help_systemmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
uiBlockSetButmFunc(block, do_info_help_systemmenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Benchmark", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
for (pym = BPyMenuTable[PYMENU_HELPSYSTEM]; pym; pym = pym->next, i++) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, pym->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i+10, pym->tooltip?pym->tooltip:pym->filename);
}
uiBlockSetDirection(block, UI_RIGHT);
uiTextBoundsBlock(block, 60);
return block;
}
static void do_info_helpmenu(void *arg, int event)
{
ScrArea *sa;
if(curarea->spacetype==SPACE_INFO) {
sa= find_biggest_area_of_type(SPACE_SCRIPT);
if (!sa) sa= closest_bigger_area();
areawinset(sa->win);
}
/* events >=10 are registered bpython scripts */
if (event >= 10) BPY_menu_do_python(PYMENU_HELP, event - 10);
else {
switch(event) {
case 0: /* About Blender */
break;
}
}
allqueue(REDRAWINFO, 0);
}
......@@ -1641,32 +1667,17 @@ static uiBlock *info_helpmenu(void *arg_unused)
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
/* uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "-- Placeholders only --", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Tutorials *", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "User Manual *", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Python Scripting Reference *", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
for (pym = BPyMenuTable[PYMENU_HELP]; pym; pym = pym->next, i++) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, pym->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i+10, pym->tooltip?pym->tooltip:pym->filename);
}
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBlockBut(block, info_help_websitesmenu, NULL, ICON_RIGHTARROW_THIN, "Websites", 0, yco-=20, 120, 19, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
*/
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Benchmark", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
/* uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Release Notes *", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
*/
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
for (pym = BPyMenuTable[PYMENU_HELP]; pym; pym = pym->next, i++) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, pym->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i+2, pym->tooltip?pym->tooltip:pym->filename);
}
uiDefIconTextBlockBut(block, info_help_systemmenu, NULL, ICON_RIGHTARROW_THIN, "System", 0, yco-=20, 120, 19, "");
uiBlockSetDirection(block, UI_DOWN);
uiTextBoundsBlock(block, 80);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment