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
""" Registration info for Blender menus:
Name: 'HotKeys'
Name: 'Hotkey Reference'
Blender: 232
Group: 'Help'
Tip: 'All the hotkeys.'
Tip: 'All the hotkeys'
"""
# $Id$
#------------------------

View File

@@ -2,7 +2,7 @@
"""
Name: 'System Information...'
Blender: 234
Group: 'Help'
Group: 'HelpSystem'
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;
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;

View File

@@ -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,

View File

@@ -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,6 +1575,58 @@ static uiBlock *info_help_websitesmenu(void *arg_unused)
return block;
}
static void do_info_help_systemmenu(void *arg, int event)
{
/* events >=10 are registered bpython scripts */
if (event >= 10) BPY_menu_do_python(PYMENU_HELPSYSTEM, event - 10);
else {
switch(event) {
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 :(
*/
if(select_area(SPACE_VIEW3D)) {
mainqenter(LEFTSHIFTKEY, 1);
mainqenter(LEFTCTRLKEY, 1);
mainqenter(LEFTALTKEY, 1);
mainqenter(TKEY, 1);
mainqenter(TKEY, 0);
mainqenter(EXECUTE, 1);
mainqenter(LEFTSHIFTKEY, 0);
mainqenter(LEFTCTRLKEY, 0);
mainqenter(LEFTALTKEY, 0);
}
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)
{
@@ -1596,32 +1638,16 @@ static void do_info_helpmenu(void *arg, int event)
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_HELP, 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 :(
*/
if(select_area(SPACE_VIEW3D)) {
mainqenter(LEFTSHIFTKEY, 1);
mainqenter(LEFTCTRLKEY, 1);
mainqenter(LEFTALTKEY, 1);
mainqenter(TKEY, 1);
mainqenter(TKEY, 0);
mainqenter(EXECUTE, 1);
mainqenter(LEFTSHIFTKEY, 0);
mainqenter(LEFTCTRLKEY, 0);
mainqenter(LEFTALTKEY, 0);
case 0: /* About Blender */
break;
}
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);