Select to view content in your preferred language

Python add-in for Save/Stop edits button

2723
2
06-25-2012 09:46 AM
SteveRichards2
Deactivated User
Hello, I am looking to create a custom button that would combine the save and stop edits buttons on the Editor toolbar. IE I want a single button that would perform save and stop edits with one click. Has anyone developed something like this? Can you call "Save edits" and "Stop editing" using the arcpy site package? I am looking into creating a python add-in using arcgis 10.1. Any help with this would be appreciated.
Tags (2)
0 Kudos
2 Replies
AnthonyTimpson2
Regular Contributor
to make things like that i believe you need to get into the arcObjects library. I've seen some stuff around about arcobjects in python, mostly i see that coded in C# or similar.
0 Kudos
NobbirAhmed
Esri Alum
Add an Extension along with your button. Here is the code example:

import arcpy
import pythonaddins

class ButtonClass1(object):
    """Implementation for StopStartEdits_addin.button (Button)"""
    def __init__(self):
        self.enabled = True
        self.checked = False
        
    def onClick(self):
        # your button event logic is here

class ExtensionClass2(object):
    """Implementation for StopStartEdits_addin.extension3 (Extension)"""
    def __init__(self):
        # For performance considerations, please remove all unused methods in this class.
        self.enabled = True
        
    def onStartEditing(self):
        button.enabled = False
        
    def onStopEditing(self, save_changes):
        button.enabled = True


The button gets disabled when the user clicks Start Editing and is enabled when the user selects Stop Editing. Enable/Disable is just for example but you can do whatever you want to.
0 Kudos