AnsweredAssumed Answered

python addin enable/disable button

Question asked by cwholmes on Jul 24, 2017
Latest reply on Sep 19, 2017 by cwholmes

Hello,

I have a python addin which has a combobox and a series of buttons. I added some code so that depending upon what's selected from the combobox, the buttons are either enabled or disabled. It's working fine except for one button (cleanupdatabtn). In all cases this button does not enable or disable. I've checked many times and the spelling is correct. I'm at a bit of a loss for what I'm missing, maybe someone can see something here that I don't.

Thanks!

class ApplicationType(object):
    """Implementation for PlanningTools_addin.applicationtypecmb (ComboBox)"""
    def __init__(self):
        self.items = ['Community Boundary Change','Development Permit','Disposal of Reserve',
                      'Land Use Amendment','New Community Proposal','Outline Plan','Road Closure',
                      'SDAB','Street Name Change','Subdivision','Export Map Window as JPEG']
        #self.text = 'Select Application Type'
        self.editable = True
        self.enabled = True
        self.dropdownWidth = 'WWWWWWWWWWWWWWWWWWWW'
        self.width = 'WWWWWWWWWWWWWWWWWWWW'
    def onSelChange(self, selection):
        #pythonaddins.MessageBox(selection,'text in combobox',0)
        if selection in ('Community Boundary Change','Development Permit','Disposal of Reserve',
                         'New Community Proposal','Outline Plan','Road Closure',
                         'SDAB','Street Name Change','Subdivision'):
            setupprojectbtn.enabled = True
            setupparcelbtn.enabled = False
            reviewmapbtn.enabled = False
            createimagebtn.enabled = False
            cleanupdatabtn.enabled = True
        elif selection == 'Land Use Amendment':
            setupprojectbtn.enabled = True
            setupparcelbtn.enabled = True
            reviewmapbtn.enabled = True
            createimagebtn.enabled = True
            cleanupdatabtn.enabled = False
        elif selection == 'Export Map Window as JPEG':
            setupprojectbtn.enabled = False
            setupparcelbtn.enabled = False
            reviewmapbtn.enabled = False
            createimagebtn.enabled = True
            cleanupdatabtn.enabled = False
        else:
            pythonaddins.MessageBox('something is wrong','e',0)

Outcomes