__all__ = ['SuggestedEnvironmentsCustom', 'instantiate']
from MessageInterpreter import MessageInterpreter
from RTFapi import ExternalDataAccess
from UserCustomization import UserCustomBase, CustomInfo
from Application import theApplication
class SuggestedEnvironmentsCustom (UserCustomBase):
def __init__(self):
self.__myInterpreter = LocalInterpreter()
def getInterpreter( self, isInteractive ):
return (self.__myInterpreter if isInteractive else None)
def appendMenuItems(self, id, menu):
if "Edit" == id:
menu.appendItem("TaskUI - Force Recommended Environments",self.setRecommended)
menu.appendItem("TaskUI - Update Environment Images",self.updateImages)
def setRecommended(self,event):
self.__myInterpreter.setRecommended()
def updateImages(self,event):
self.__myInterpreter.updateImages()
class LocalInterpreter( MessageInterpreter ):
def __init__( self ):
MessageInterpreter.__init__( self )
def setRecommended(self):
self.sendMessage( 'EXTERNAL_DATA_ACCESS_ASSOCIATE_UPDATE',
(ExternalDataAccess.kEnvironments,"","",) )
def updateImages(self):
theApplication.getDisplay().handlerInvoke("_root.ShowcaseLoadEnvironmentThumbs","")
def EXTERNAL_DATA_ACCESS_ASSOCIATE_UPDATED(self,message):
(what,) = message.data
self.updateImages()
def MODEL_IMPORT_DISPLAYED_ALL(self,message):
self.setRecommended()
def APPLICATION_CLOSE_SCENE( self, message ):
self.setRecommended()
def instantiate():
return SuggestedEnvironmentsCustom()
def info():
customInfo = CustomInfo()
customInfo.vendor = 'Autodesk'
customInfo.version = '2.0'
customInfo.api = '2013'
customInfo.shortInfo = 'Update suggested on model load.'
customInfo.longInfo = \
"""A sample add-in that updates suggested environments on model load.
"""
return customInfo