AddTool()

Add an item to the Tools menu.

Usage

AddTool( text=None, icon=None,
                   menuText=None, accel=None,
                   toolbar=True, tooltip=None,
                   whatsthis=None, helpURL=None,
                   active=None, func=None )

Parameters

text (string)
Menu item description text.
icon (icon)
Menu item icon.
menuText (string)
The text that will be displayed on menu item.
accel (key)
Menu item keyboard accelerator.
toolbar (boolean)
Flag states whether or not to put this item on the toolbar.
tooltip (string)
Tooltip help information, also known as bubble. The content of this argument is displayed in a small dynamic placed opened above the menu, when the cursor remains at the menu for short time. This is typically a short phrase.
whatsthis (string)
Whatsthis help information. When you click on the whatsthis icon followed by clicking on this menu, a small box opens above the menu and the content of this argument is displayed in it. This is typically a short sentence or two, which provides more information than that given by the tooltip argument. The whatsthis argument is a rich text format, which means you can embed many of the HTML tags, such as <br> for line separator and <b> for bold.
helpURL (string)
This is the HTML-URL address containing detailed help on the menu item. When you press the F1 key while the cursor is on top of this menu, the assistance help system opens and displays this page.
active (string)
This argument specifies when the function is accessible (enabled).
func (function)
The function to be executed when this option (menu item) is selected.

Return Value

None

Error

The function specified by func must be already defined.

Description

This routine adds an item to the Tools menu. The menu item specifications are given by arguments. toolbar flag states whether or not to put this on the toolbar. When this menu item is selected, the function specified by func will be executed. For example,
AddTool( text = 'Generate Mesh',
                   icon = 'meshgen',
                   menuText = 'Generate Mesh',
                   accel = qt.Qt.SHIFT+qt.Qt.CTRL+qt.Qt.Key_M,
                   toolbar = True,
                   tooltip = 'Generate Mesh (Shift+Ctrl+M)',
                   whatsthis = '<img source="meshgen">'
                   'Click this button to <em>generate '
                   '</em>the mesh.',
                   active = 'geom',
                   func = genMesh )