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
This commit is contained in:
2004-07-29 12:12:20 +00:00
parent 7ed803f6a8
commit 28f0f2d048
5 changed files with 83 additions and 62 deletions

View File

@@ -1,10 +1,10 @@
#!BPY #!BPY
""" Registration info for Blender menus: """ Registration info for Blender menus:
Name: 'HotKeys' Name: 'Hotkey Reference'
Blender: 232 Blender: 232
Group: 'Help' Group: 'Help'
Tip: 'All the hotkeys.' Tip: 'All the hotkeys'
""" """
# $Id$ # $Id$
#------------------------ #------------------------

View File

@@ -2,7 +2,7 @@
""" """
Name: 'System Information...' Name: 'System Information...'
Blender: 234 Blender: 234
Group: 'Help' Group: 'HelpSystem'
Tooltip: 'Information about your Blender environment, useful to diagnose problems.' Tooltip: 'Information about your Blender environment, useful to diagnose problems.'
""" """

View File

@@ -78,6 +78,8 @@ static int bpymenu_group_atoi (char *str)
if (!strcmp(str, "Import")) return PYMENU_IMPORT; if (!strcmp(str, "Import")) return PYMENU_IMPORT;
else if (!strcmp(str, "Export")) return PYMENU_EXPORT; else if (!strcmp(str, "Export")) return PYMENU_EXPORT;
else if (!strcmp(str, "Help")) return PYMENU_HELP; 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, "Add")) return PYMENU_ADD;
else if (!strcmp(str, "Mesh")) return PYMENU_MESH; else if (!strcmp(str, "Mesh")) return PYMENU_MESH;
else if (!strcmp(str, "Wizards")) return PYMENU_WIZARDS; else if (!strcmp(str, "Wizards")) return PYMENU_WIZARDS;
@@ -104,6 +106,12 @@ char *BPyMenu_group_itoa (short menugroup)
case PYMENU_HELP: case PYMENU_HELP:
return "Help"; return "Help";
break; break;
case PYMENU_HELPWEBSITES:
return "Websites";
break;
case PYMENU_HELPSYSTEM:
return "System";
break;
case PYMENU_MESH: case PYMENU_MESH:
return "Mesh"; return "Mesh";
break; break;

View File

@@ -83,7 +83,9 @@ typedef enum {
PYMENU_MISC, PYMENU_MISC,
PYMENU_MESH, PYMENU_MESH,
PYMENU_MATERIALS, 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_IMPORT,
PYMENU_EXPORT, PYMENU_EXPORT,
PYMENU_ANIMATION, PYMENU_ANIMATION,

View File

@@ -1549,12 +1549,8 @@ static uiBlock *info_rendermenu(void *arg_unused)
static void do_info_help_websitesmenu(void *arg, int event) static void do_info_help_websitesmenu(void *arg, int event)
{ {
/* these are no defines, easier this way, the codes are in the function below */ BPY_menu_do_python(PYMENU_HELPWEBSITES, event);
switch(event) {
case 0: /* */
break;
}
allqueue(REDRAWVIEW3D, 0); 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) static uiBlock *info_help_websitesmenu(void *arg_unused)
{ {
uiBlock *block; uiBlock *block;
BPyMenu *pym;
short yco = 20, menuwidth = 120; short yco = 20, menuwidth = 120;
int i = 0;
block= uiNewBlock(&curarea->uiblocks, "info_help_websitesmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin); block= uiNewBlock(&curarea->uiblocks, "info_help_websitesmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
uiBlockSetButmFunc(block, do_info_help_websitesmenu, NULL); 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, ""); for (pym = BPyMenuTable[PYMENU_HELPWEBSITES]; pym; pym = pym->next, i++) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Blender E-shop *", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); 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);
}
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, "");
uiBlockSetDirection(block, UI_RIGHT); uiBlockSetDirection(block, UI_RIGHT);
uiTextBoundsBlock(block, 60); uiTextBoundsBlock(block, 60);
@@ -1585,24 +1575,13 @@ static uiBlock *info_help_websitesmenu(void *arg_unused)
return block; return block;
} }
static void do_info_help_systemmenu(void *arg, int event)
static void do_info_helpmenu(void *arg, int event)
{ {
ScrArea *sa; /* events >=10 are registered bpython scripts */
if (event >= 10) BPY_menu_do_python(PYMENU_HELPSYSTEM, event - 10);
else {
switch(event) {
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) {
case 0: /* About Blender */
break;
case 1: /* Benchmark */ case 1: /* Benchmark */
/* dodgy hack turning on CTRL ALT SHIFT key to do a benchmark /* dodgy hack turning on CTRL ALT SHIFT key to do a benchmark
* rather than copying lines and lines of code from toets.c :( * 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; 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); 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, ""); 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, ""); 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, ""); }
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, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); 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, ""); 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, ""); 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, ""); uiDefIconTextBlockBut(block, info_help_systemmenu, NULL, ICON_RIGHTARROW_THIN, "System", 0, yco-=20, 120, 19, "");
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);
}
uiBlockSetDirection(block, UI_DOWN); uiBlockSetDirection(block, UI_DOWN);
uiTextBoundsBlock(block, 80); uiTextBoundsBlock(block, 80);