54.6.4 An example of adding a kernel plug-in to a plug-ins toolbox

You use the registerKernelToolButton() command to make a kernel plug-in available from a plug-ins toolbox. When you add a plug-in to a toolbox, an item appears in the Plug-insToolboxes menu. When you select this item, ABAQUS/CAE displays a plug-ins toolbox. Although you can display text in a toolbox, you will probably want to supply an icon instead and not use text (for more information on creating icons, see Appendix A, Icons,” of the ABAQUS GUI Toolkit User's Manual).

The registerKernelToolButton registration command uses the same arguments as the registerKernelMenuButton command; however, it also requires a toolbox name. You can use the buttonText argument to specify only a tooltip by preceding the tip text with “\t” as shown in the following version of myUtils_plugin.py:

from abaqusGui import getAFXApp, FXXPMIcon
from myIcons import vpIconData
vpIcon = FXXPMIcon(getAFXApp(), vpIconData)

toolset = getAFXApp().getAFXMainWindow().getPluginToolset()
toolset.registerKernelToolButton(toolboxName='My Utils',
    buttonText='\tPrint Current Viewport', icon=vpIcon,
    moduleName='myUtils', functionName='printCurrentVp()' )

This example creates a My Utils item under the Plug-insToolboxes menu. When a user clicks My Utils, ABAQUS/CAE displays a toolbox with My Utils shown in its title bar. When you click the icon in the toolbox, ABAQUS/CAE sends the following command to the kernel:

myUtils.printCurrentVp()
The same command would be sent to the kernel if you registered the plug-in in the Plug-ins menu.

The Toolboxes item, if it exists, always appears first in the Plug-ins menu; and the About Plug-ins item always appears last. Other items in the Plug-ins menu are listed alphabetically.