I think you are probably seeing the key difference between ArcPy
and ArcObjects
and later the Python Add-in
.
Arcpy is designed to access the data itself, but doesn't have ties to the user interface. This is why, if you want to access a layer in the table of contents, you have to return the list of layers, then iterate through until you get to the one you want. From what I can tell, Arcpy doesn't know anything about a user interface. Even in the case of a selection of features, they are seen as an object collection, but there is no reference to how this selection may have been created.
On the other hand, ArcObjects, and now the Add-ins, have a definite tie-in to the user interface. As you listed with ArcObjects, the IEditLayers.CurrentLayer
class sees that a user has selected a particular layer in the editor.
For the Python add-in, you found the onCurrentLayerchanged
method, which returns when the layer has been changed.
If you look in the python addins module, there is a function for GetSelectedTOCLayerOrDataFrame
. This would at least return what has been selected in the table of contents.
I think the way you would use these two methods is in combination. Knowing the selected layer to start with will let you perform actions based on that layer name, or feature type, etc. If you then are checking to see when the current layer changes during an edit session, you would be able to enable or disable tools, or raise warnings based on if said tools were relevant to the characteristics of the new layer that was selected.