There is a gap in my understanding of Python Add-Ins.
When I create a Python Add-In it is easy to see where buttons, tools and extensions are implemented as Classes in the *_addin.py script of the Install folder, and how these get written into the shareable *.esriaddin file.
However, I find the ArcGIS 10.2 Online Help for Creating an add-in menu to be more than minimalist. By some trial and error I have figured out, within ArcMap, how to drag add-in menus, buttons and tools from the Customize dialog onto an add-in toolbar to achieve a menu like below.
What I am unable to figure out is how this "layout" of the add-in toolbar, with its add-in menu and add-in button and add-in tool gets written into the *.esriaddin file.
Is the way to get add-in menu customization/configuration written into the *.esriaddin file by editing the config.xml, and if so, is the syntax used to do that documented anywhere?
Answer
An .esriaddin
file is just a ZIP-compressed archive containing the files that make up your add-in. You can open it with something like 7-Zip to prove this to yourself. The Essential Python Add-in concepts article hints at this.
The layout of your-addin, including definitions of toolbars, menus and buttons, is all stored within the config.xml
, whose syntax is not particularly well documented anywhere (though you might check the .NET or, particularly, the Java add-in docs which for some reason have a better-documented dissection of the file).
However, you are not really expected to have to mess with the config.xml
and are encouraged to instead use the Python Add-in Wizard to build out your add-in's structure. Presumably you are already using this.
As far as adding a menu to a toolbar, and a button to a menu, it's just a matter of right-clicking the appropriate entries in the wizard and selecting the desired items:
No comments:
Post a Comment