Select to view content in your preferred language

How can I programatically deactivate my python addin tool?

3264
23
08-31-2016 08:48 AM
GregoryAllspaw
Occasional Contributor

How can I programatically deactivate my python addin tool at the end of tool execution?  In other words, I want to select my tool, click the map to execute my script logic, and then I want the tool to automatically deactivate or select a different tool by default.  Is this possible?  I'm currently working in ArcGIS 10.2, but I'm planning  to move on to 10.4, if this matters.

Tags (2)
0 Kudos
23 Replies
NobbirAhmed
Esri Regular Contributor

No, I haven’t ☹ I have just sent you a message – let me know if you received it. You can email me at nahmed@esri.com

0 Kudos
LukeWebb
Frequent Contributor

100% duplicate of my question all the way!

https://community.esri.com/thread/181642-arcpy-add-in-tool-deselect-tool 

Please add a method to the pythonAddins to let us select the basic "ArcGIS Select" tool at end of processing.

0 Kudos
GregoryAllspaw
Occasional Contributor

Thanks, Luke.  Nobbir and I are still looking for a workaround, so keep your fingers crossed.

0 Kudos
GregoryAllspaw
Occasional Contributor

Just to wrap up for those who are following this or those who may find this post in the future...

The only reasonable workaround that I have found (with lots of help from Nobbir) for this issue is to effectively create two different 'modes' for my GUI.  I created a button to toggle between the two modes.  When the button is pressed certain controls are enabled while others are disabled. The enabled states are reversed each time the button is pressed.  By doing this, I made it impossible for my conflicting  controls to be enabled at the same time.  Keep in mind that you need to set the enabled states appropriately on startup.  Additionally, I added some code to the execution of some of my addin controls so that the 'mode' will change automatically when that is likely to be the desired action for the user.  But having the toggle button ensures that the user can switch modes at any time.

This solution is less than ideal, but it is not terrible.  It is adequate for the immediate needs of my particular project.  In future development, I would like to see much better programmatic access to activate/deactivate and enable/disable states of addin contols.

0 Kudos