================= Extension Manager ================= .. raw:: html Register and load user-defined extensions in the **Extension Manager**, found under the **File** menu at **File** > **Extension Manager**. .. raw:: html | An extension provides the means to extend the application through shared libraries or scripts. Use extensions to create new profiles, contexts, model views, and more. Sample extensions that illustrate the various use cases are included in the **Extension Manager**. Extension Structure --------------------- An extension is comprised of a folder containing a manifest file, *plugin.xml*, and all related scripts and resources. The *plugin.xml* file defines the metadata of the extension such as name, version, and minimum supported product version. The entire content of *plugin.xml* should be wrapped inside of *section* as shown below: ::
.. csv-table:: Table 1. Supported attributes in extension.xml :header: "Attribute", "Description" :widths: 20, 60 "name", "Name of the Extension" "minProductVersion", "The minimum version of the product that is supported by this extension" "description", "A short description about this extension that is displayed in the Extension Manager user interface" "documentation", "HTML file with the detailed description of the extension that can be opened in a web browser through the Extension Manager user interface" "author", "The author of this extension" "publisher", "The publisher of this extension" "script", "The script that should be executed when this extension is loaded" "resources", "Location of the resources directory relative to the extension directory" "settings", "An xml file that defines the settings of this extension" "advancedToolTip", "An xml file that defines the tooltips related to this extension" "workFlowHelp", "An xml file that defines the workflow help content of this extension" "required", "The plugin that should be loaded as a pre-requisite for this extension" "extends","The plugin that this plugin should be auto-loaded after" "profile", "The name of the profile implemented in this extension" .. raw:: html
Implementing a Profile as an Extension ------------------------------------------ A Profile is the UI state that defines menus, ribbon pages, toolbars and dock windows. There can be multiple Profiles, but only one can be active, or displayed, at a time. Splitting functionality into Profiles can reduce screen clutter, allowing the user to focus on specific tasks. Profiles can be hierarchical with a Profile having sub-Profiles. Sub-Profiles can make use of the base Profile functionality and implement additional functionality as required. There are two types of Profiles, *stand-alone* and *add-on*. * A *stand-alone* Profile re-configures the entire UI. * An *add-on* Profile contributes added functionality to an existing Profile. The *plugin.xml* should have an entry defining the Profile name so that the Framework loads this extension when the Profile is requested to be activated. :: The following command line should be used to load the Profile, where ``-p`` denotes the extension and ``-pr`` denotes the Profile: :: /hwx/bin/win64/runhwx.exe -p MyExtension -pr MyProfile Sample code snippet for Profile Creation ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: from hwx import gui class MyProfile(gui.Profile): def build(self): gui.RibbonPage(name="Geometry", children=[ gui.RibbonPageGroup(name="Modify", children=[ gui.SpriteActionGroup ( text = "Boolean", children = [gui.SpriteAction (text = "Test", icon = "ribbonBooleanMainStrip-80.png", command = lambda: print('you clicked a button!!!'))])])]) def activate(self): print('activate') #Profile creation profile = MyProfile("MyProfile") .. raw:: html
Managing Extensions --------------------- Add an Extension ^^^^^^^^^^^^^^^^^^^^ #. Click **File** > **Extension Manager** to open the **Extension Manager**. #. Click **Add Extension**, and browse to the extension folder to register it. .. figure:: ../_static/images/em_add.png :scale: 75 % :alt: Add extension :Note: All of the extensions located in the **Custom plugins location** specified in **Preferences** are automatically registered by the **Extension Manager**. The default custom plugins location is */Documents/Altair/extensions*. #. Toggle **Load** to load the extension in Inspire. .. figure:: ../_static/images/em_load.png :scale: 75 % :alt: Load extension **Result:** The extension is loaded in Inspire. This extension creates a new icon on a new ribbon. .. figure:: ../_static/images/em_loaded.png :scale: 75 % :alt: A Loaded extension Unload an Extension ^^^^^^^^^^^^^^^^^^^^^^^ #. Click **File** > **Extension Manager** to open the **Extension Manager**. #. Toggle **Unload** to unload an extension but preserve it in the **Extension Manager** and keep its registration. .. figure:: ../_static/images/em_unload.png :scale: 75 % :alt: Unload extension Remove an Extension ^^^^^^^^^^^^^^^^^^^^^^^ #. Click **File** > **Extension Manager** to open the **Extension Manager**. #. Click **Remove** to unregister an extension and remove it from the **Extension Manager**. .. figure:: ../_static/images/em_remove.png :scale: 75 % :alt: Remove extension :Note: If you unregister an extension that is in the custom plugins folder, click **Add Extension** to manually re-register it. .. toctree:: :maxdepth: 1