Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # TestCmdPlugin
- import win32com.client
- from win32com.client import constants
- import siutils
- null = None
- false = 0
- true = 1
- Application.LogMessage( "Global: %s" % __sipath__ )
- siutils.add_to_syspath( __sipath__ )
- import TestModule
- '''
- # Make a TestModule.py file in the same place as this testCmdPlugin.py file.
- # with this code:
- def hello():
- print "hello world."
- def test():
- print "it works!"
- '''
- def XSILoadPlugin( in_reg ):
- in_reg.Author = "blairs"
- in_reg.Name = "TestCmdPlugin"
- in_reg.Major = 1
- in_reg.Minor = 0
- Application.LogMessage( "XSILoadPlugin: %s" % __sipath__ )
- in_reg.RegisterCommand("TestCmd","TestCmd")
- in_reg.RegisterProperty("fooProperty")
- #RegistrationInsertionPoint - do not remove this line
- return true
- def XSIUnloadPlugin( in_reg ):
- strPluginName = in_reg.Name
- Application.LogMessage( "XSIUnloadPlugin: %s" % __sipath__ )
- Application.LogMessage(str(strPluginName) + str(" has been unloaded."),constants.siVerbose)
- return true
- def TestCmd_Init( in_ctxt ):
- oCmd = in_ctxt.Source
- oCmd.Description = ""
- oCmd.ReturnValue = true
- oArgs = oCmd.Arguments
- oArgs.AddWithHandler("Arg0","Collection")
- Application.LogMessage( "TestCmd_Init: %s" % __sipath__ )
- return true
- def foo():
- Application.LogMessage( "foo: %s" % __sipath__ )
- TestModule.test()
- TestModule.hello()
- def TestCmd_Execute( Arg0 ):
- Application.LogMessage("TestCmd_Execute called",constants.siVerbose)
- Application.LogMessage( "TestCmd_Execute: %s" % __sipath__ )
- foo()
- #
- # TODO: Put your command implementation here.
- #
- return true
- def fooProperty_Define( in_ctxt ):
- p = in_ctxt.Source
- p.AddParameter2("blah",constants.siString,"",None,None,None,None,constants.siClassifUnknown,constants.siPersistable)
- return True
- def fooProperty_DefineLayout( in_ctxt ):
- l = in_ctxt.Source
- l.Clear()
- b = l.AddButton( "doButton", "DO SOMETHING" )
- b.SetAttribute(constants.siUICX, 120)
- b.SetAttribute(constants.siUICY, 70)
- return True
- def fooProperty_OnInit():
- PPG.Refresh()
- xsi.LogMessage("fooProperty_OnInit called",constants.siVerbose)
- def fooProperty_OnClosed():
- xsi.LogMessage("fooProperty_OnClosed called",constants.siVerbose)
- def fooProperty_doButton_OnClicked( ):
- xsi.TestCmd()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement