Interactive/DisableTemplates.py

# (C) Copyright 2011 Autodesk, Inc.  All rights reserved.
#
# Use of this software is subject to the terms of the Autodesk license
# agreement provided at the time of installation or download, or which
# otherwise accompanies this software in either electronic or hard copy
# form.

# You will need Autodesk Showcase 2012 or later
#
# If active, this plug-in will supress the import templates interaction.

__all__ = ['DisableTemplates', 'instantiate']

from UserCustomization      import UserCustomBase, CustomInfo
from MessagingAPI           import MessageSender
from RTFapi                 import SystemInformation


class DisableTemplates( UserCustomBase, MessageSender ):

    def appendMenuItems( self, id, menu ):
        SystemInformation.instance().setConfigSwitch('preview-disable-templates',True)  
        if "Help" == id:
            menu.appendSeparator()
            menu.appendItem("Import Templates...", self.onFileNew)

    def onFileNew( self, *args ) :
        self.sendMessage( "TEMPLATE_FILE_NEW", (True,) )


def instantiate():
    return DisableTemplates()


def info():
    customInfo = CustomInfo()
    customInfo.vendor = 'Autodesk'
    customInfo.version = '1.0'
    customInfo.api = '2012'
    customInfo.shortInfo = "Disable import templates"
    customInfo.longInfo = \
"""Changes the behavior of File->New to create an empty file instead of presenting the user with the import templates workflow.
"""
    return customInfo


if __name__ == '__main__' :
    bfu = instantiate()