I followed your suggestions. I ended up with a Python script as follows:
import arcpy
import pythonaddins
class MyDDPTools_clsSyncDataFrameRotation(object):
"""Implementation for DDPTools_addin.clsSyncDataFrameRotation (Extension)"""
def __init__(self):
# For performance considerations, please remove all unused methods in this class.
self.enabled = True
def pageIndexExtentChanged(self, new_id):
mxd = arcpy.mapping.MapDocument("Current")
df1, df2 = arcpy.mapping.ListDataFrames(mxd)
df2.rotation = df1.rotation
print "pageIndexExtentChanged Event"
print "Rotation DF1: " + df1.rotation
print "Rotation DF2: " + df2.rotation
pass
class btnPrevPage(object):
"""Implementation for DDPTools_addin.btnPrevPage (Button)"""
def __init__(self):
self.enabled = True
self.checked = False
def onClick(self):
mxd = arcpy.mapping.MapDocument("CURRENT")
topDF = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
bottomDF = arcpy.mapping.ListDataFrames(mxd, "Shadow")[0]
if mxd.dataDrivenPages.currentPageID > 1:
mxd.dataDrivenPages.currentPageID = mxd.dataDrivenPages.currentPageID - 1
bottomDF.rotation = topDF.rotation
print "btnPrevPage"
print "Rotation topDF: " + str(round(topDF.rotation,2))
print "Rotation bottomDF: " + str(round(bottomDF.rotation,2))
pass
I created a custom toolbar with a custom button (the lower class in the code) that would allow me to click a 'Previous' button and have it to adjust the rotation based on the button_click code. I also used your code and made it an add-in extension responding the the event you mentioned. My button works, but the pageIndexExtentChanged event does not seem to get called. The debug 'prints' in the code shows in the Python command window for my button, but nothing prints when using the Data Driven Pages Toolbar nav buttons to change pages. Maybe a different event I should code to?
Is there something else wrong that I did not see? I set the extension properties to load on application startup as well. Any ideas?
Thanks!