class ButtonClass5(object): """Implementation for GLADIS_Hilfe_addin.button (Button)""" def __init__(self): self.enabled = True self.checked = False def onClick(self): counter += 1 status = counter % 2 if counter == 1: (id of the toolbar).enable = True elif: (id of the toolbar).enable = False pass
class ButtonClass5(object): """Implementation for GLADIS_Hilfe_addin.button (Button)""" def __init__(self): self.enabled = True self.checked = False def onClick(self): if ToolbarID.enabled == True: ToolbarID.enabled == False ToolbarID.refresh() elif ToolbarID.enabled == False: ToolbarID.enabled = True ToolbarID.refresh() else: pass
"""Implementation for GLADIS.Hilfe (Button)"""
Hilfe.enabled == True
import arcpy import pythonaddins class ToolbarToggle(object): """Implementation for GLADIS.Hilfe (Button)""" def __init__(self): self.enabled = True self.checked = False def onClick(self): if ToolbarID.enabled == True: ToolbarID.enabled = False self.checked = False ToolbarID.refresh() elif ToolbarID.enabled == False: ToolbarID.enabled = True self.checked = True ToolbarID.refresh() else: pass
John, I realize this is an old post, but I went to vote up your idea, and of course it is still pointing to the old site. No you know the title to search, or can you post the link to the new site ArcGIS Ideas ? If it was implemented and not there anymore, all the better.
Hi Rebecca,
I've reposted it but I doubt it can actually go anywhere because of how python addins work and also Esri's development priorities.
So the way a python addin works is that on initialization, ArcMap/Catalog/whatever your target application is, extracts the contents from the .esriaddin file - which is actually just a zip file (seriously, change the extension to from .esriaddin to .zip, open it up and you'll see all your addin files). Anyway, Esri extracts the contents of it to your application's Assembly Cache. For ArcMap on Windows 7 for example, this is the directory C:\Users\<username>\AppData\Local\ESRI\Desktop<version>\AssemblyCache. There's a catch however. It doesn't extract everything in the .esriaddin file to your assembly cache, only the contents of the install folder. So your images folder and config.xml, those don't get extracted. I assume they get loaded into the target application's address space (memory), ArcMap.exe for instance.
So without the config.xml and your image files sitting in your assembly cache or somewhere else on disk for you to modify and the target application such as ArcMap continually checking those files for updates or addins having some kind of reload function, it's pretty much impossible to do this with the current architecture of Python Addins - as I understand them.
That said, Esri could fix it. I'd bet money they won't, though. Esri isn't dedicating very many development resources to keeping Python Addins going these days. You can witness that in the fact that new releases of ArcGIS for Desktop haven't really added any functionality to python addins since they first came out. You might have also noticed that Python Addins for ArcGIS Pro is not actually even a thing. If you want to develop Python Addins for Pro, .NET is your only option. I asked an Esri associate about this at the DevSummit this year and got a pretty amusing response; "We're waiting to see if there's actually any demand for that.".
I've posted two new ideas:
Hi John, I was out of the office and this got lost in the pile of unread emails. I voted both ideas up, and also posted a workaround of sorts to the reload button, which I'll also include here.
I find the fastest way to refresh addins when developing (i.e. after a .updating a .py) without having to close/open Catalog/Map is to
That loads the update addin without having to close the ArcGIS Desktop session which saves a lot of time. And it at least remembers this path if you are editing the same addin over and over. So not a wonderful solution, but as often as I "repeat" when working on addins, saving 15-60+ seconds each time reduces my frustration.
If there was a way to create a button that enters the Customize Mode and loads from a file, that would make this process work, but I don't know if that is possible.