Interactive/PreloadCustomOnStartup.py

##
## (C) Copyright 2008 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.
##

#
#
from ScriptRunner       import ScriptRunner
from UserCustomization  import theUserCustomization
from Utilities          import LoadModuleFromPath
from awSupportApi       import ApplicationSettings

import os.path

# Just a simple example of combining the start-up script with the
# custom modules.  Instead of having the custom module in the preferences
# directory, you can directly include it during the preload() method
# of the startup script.
class PreloadCustomOnStartup( ScriptRunner ):
    def __init__( self, scriptName, args ):
        ScriptRunner.__init__( self, scriptName, args )


    def Main( self ):
        print "All the work was done in preload"

                     
# ===============================================================
def preload():
    supportDir = ApplicationSettings.instance().getSupportDirectory()
    moduleLocation = os.path.join(supportDir, "../extras/Interactive/EchoMessagesCustom.py")
    module = LoadModuleFromPath(moduleLocation)
    theUserCustomization.addExtraCustomization(module)



def instantiate( scriptName, args ):
    return PreloadCustomOnStartup( scriptName, args )
# ===============================================================