Guest User

DY_propTestPlugin

a guest
Dec 11th, 2015
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.99 KB | None | 0 0
  1. # DY_propTestPlugin
  2. from win32com.client import constants as c
  3. import os
  4. import shutil
  5.  
  6. xsi = Application
  7. pr = xsi.LogMessage
  8.  
  9. def XSILoadPlugin( in_reg ):
  10.     in_reg.Author = "Dan Yargici"
  11.     in_reg.Name = "DY_propTestPlugin"
  12.     in_reg.Email = "[email protected]"
  13.     in_reg.Major = 1
  14.     in_reg.Minor = 0
  15.  
  16.     in_reg.RegisterProperty("DY_propTest")
  17.     #RegistrationInsertionPoint - do not remove this line
  18.     return True
  19.  
  20. def XSIUnloadPlugin( in_reg ):
  21.     strPluginName = in_reg.Name
  22.     pr(str(strPluginName) + str(" has been unloaded."),c.siVerbose)
  23.     return True
  24.  
  25. def DY_propTest_Define( in_ctxt ):
  26.     oCustomProperty = in_ctxt.Source
  27.     oCustomProperty.AddParameter3("ComboMode", c.siInt2, 0, 0, 999, False)
  28.     oCustomProperty.AddParameter3("ComboItems", c.siInt2, 0, 0, 999, False)
  29.     return True
  30.  
  31. # Tip: Use the "Refresh" option on the Property Page context menu to
  32. # reload your script changes and re-execute the DefineLayout callback.
  33. def DY_propTest_DefineLayout( in_ctxt ):
  34.     buildPPGLayout(PPG)
  35.     return True
  36.    
  37. def DY_propTest_ComboMode_OnChanged():
  38.     buildPPGLayout(PPG)
  39.     return True
  40.  
  41. def DY_propTest_OnInit( ):
  42.     buildPPGLayout(PPG)
  43.     pr("DY_propTest_OnInit called",c.siVerbose)
  44.  
  45. def DY_propTest_OnClosed( ):
  46.     pr("DY_propTest_OnClosed called",c.siVerbose)
  47.  
  48. def buildPPGLayout(oPPG):
  49.     oPPGLayout = oPPG.Layout
  50.     oPPGLayout.Clear()
  51.  
  52.     # Create an array to populate the "Mode" dropdown menu
  53.     modeComboArray = ["ModeA", 0, "ModeB", 1]
  54.  
  55.     # Create an array to populate the "Workgroups" dropdown menu and an array of paths to lookup
  56.     itemsComboArray = ["ItemA", "ItemB", "ItemC"]
  57.  
  58.     oPlugin = Application.Plugins("DY_propTestPlugin")
  59.     pluginPath = oPlugin.OriginPath
  60.     oPPGLayout.AddGroup("Mode")
  61.     oPPGLayout.AddEnumControl("ComboMode", modeComboArray, "Chose Mode", c.siControlCombo)
  62.     oPPGLayout.EndGroup()
  63.     if oPPG.ComboMode.value == 1:
  64.         oPPGLayout.AddGroup("Items")
  65.         oPPGLayout.AddEnumControl("ComboItems", itemsComboArray, "Select Item", c.siControlCombo)
  66.         oPPGLayout.EndGroup()
  67.     oPPG.Refresh()
Advertisement
Add Comment
Please, Sign In to add comment