Python button to cycle edit sessions on data sources of visible layers in the TOC

Discussion created by greggorvitch on Nov 20, 2013
Hi everyone!

I want to use the Addin Assistant and PyScripter to make a button that will cycle edit sessions but I see that ArcPy wants the exact location of the GDB (or source)...

Can I use a variable or function to pick up the layers that are visible in the TOC so the user can cycle through those? They could be anything, anywhere... SDE, FGDB, MDB etc... We use everything here!

I assume the steps would be like:

1. User opens the MXD, not editing yet.
2. User clicks the magic button, the appropriate Create Features Template for the first visible layer's edit session shows.
3. User makes some changes to the layer.
4. User clicks the magic button again and it saves edits and starts editing the next visible layer's templates show up.
5. Go to Step 2 for the rest of the working day.

Can the QT module for Python be used to add an input box in there as well? Does that even work in ArcMap even if it does in PyScripter?

I've made simple buttons in the past that do field calcs on different layers serially without the user having to fiddle, but they are static calculations that never change. With this button, the editting can be anything from an attribute change to adding/deleting features across at least two different data sources.

Thank you in advance!