Adding new Tools

SDK ›› Python ››
Parent Previous Next

Adding new Tools


The Extension Pack UI Convention


Tools added by the Extension Pack are usually tightly integrated into the MARI UI and Menus.

However we do encourage you to place a copy of the Tool under the Common Script Directory



Folder Structure


Scripts should live in the Default Folder Structure for Tools


~\Scripts\ExtensionPack_XvXX\Tools\Subfolder\


Registering new Scripts


Modules are imported via the __init__.py located in your ~\Scripts\ExtensionPack_XvXX\Tools/ Folder...



.. then registered within the ExtensionPack Class



Adding new Actions to Mari


Actions that are added as part of Mari Extension Pack should be added to the 'Mari Extension Pack'

Action path.


Instead of creating an action without a path



add a proper Path to it, starting with the Extension Pack identifier and defining a path reflecting the actions use



Adding new Scripts to the UI


UI elements are added via the gui_actions.py file found in your  ~\Scripts\ExtensionPack_XvXX\Tools\ Folder...

As stated under UI Convention  items are placed once in the correct menu, once in the script menu.



In order for Menu Items to be correctly disabled when no project is open it is advisable to add them to the existing set

'RequiresProject'. The 'RequiresProject' set is ensured to be toggled on and off based on the project state.



Using the Extension Pack Shortcut System


While it is possible to define default shortcuts for actions just by using



doing that will always set your shortcut, no matter what the user wants.

If added like above, the user has no way to overwrite the shortcut with his own, because on launch Mari

will always set it to the shortcut defined by your script.


Mari Extension Pack has an existing system in place to handle shortcut assignments.

At the end of  the gui_actions.py file located in your  ~\Scripts\ExtensionPack_XvXX\Tools\ Folder a section exists

to assign shortcuts to added actions




Shortcuts should be assigned via the



Function to ensure that User set Shortcuts are respected.


Blacklisting Modules, Files, Functions


To avoid clashing Versions caused by renamed files etc. a system is in place to detect modules and files

based on a blacklist and prompt the user to take action.


The Blacklist is contained in multiple variables in your __init__.py file found in your ~\Scripts\ExtensionPack_XvXX\ Folder.





Created with the Personal Edition of HelpNDoc: Full-featured Help generator