The pythonaddins.GPToolDialog() function should offer the ability to communicate progress/completion of the tool back to the python add-in.

Idea created by Eddie63 on Jun 2, 2014
    New
    Score120
    The pythonaddins.GPToolDialog() function should offer the ability to communicate progress/completion of the tool back to the python add-in (or any other place it is called from). When a tool dialog is called from a python add-in, the python script should be able to communicate with the tool that was launched, rather than losing communication. This will enable the python script to wait until the user has entered inputs into the tool dialog and either hit "OK" or "Cancel" and/or geoprocessing is complete. As things stand with 10.2.2, the pythonaddins.GPToolDialog() launches the tool dialog and the python code in the add-in continues to run (i.e. no communication), which causes problems if there are a sequence of tools to be launched that rely on the geoprocessing to happen in a sequential manner, or simply if the add-in relies on the geoprocessing of the tool immediately after the tool is complete.
     
    One idea is to specify whether or not the tool should be run as “MODAL” or “NONMODAL”. Effectively mixing the functionality between 10.2.1 and 10.2.2, but adding “gptool” object for communication.
     
    gptool = pythonaddins.GPToolDialog(toolbox, tool_name, {“NONMODAL”})


     
    Tools called with pythonaddins.GPToolDialog() launch as “MODAL” in 10.2.1, which means that the user can interact with the tool until “OK” or “Cancel” is pressed. It also means that the python script will wait until the tool is complete to execute the code that follows pythonaddins.GPToolDialog(), which is desirable.  In 10.2.2, the tool launches as “NONMODAL” so that the user can interact with the map/other tools while the tool dialog box is still open. However, the python script does not wait for completion, which is undesirable. Both modal and non-modal functionality are useful for particular situations, so having the option to use either would greatly increase user flexibility.
     
    The “gptool” object would provide a much needed means to communicate between python and the tool, much like a multiprocessing “pipe” or a “queue” (see python “multiprocessing” module). The object could have multiple methods and information associated with it, and would represent enhanced functionality of the pythonaddins.GPToolDialog() method.
     
    To summarize, having the option to be modal or non-modal, and have communication about progress/completion between python and the tool is would be fantastic.