import win32com.client
from win32com.client import constants as C
propName = "TheProperty"
gridDataName = "TheGrid"
siProperty = Application.ActiveSceneRoot.AddProperty( "CustomProperty", False, propName )
gridData = siProperty.AddGridParameter( gridDataName ).Value ;
gridData.ColumnCount = 6
gridData.RowCount = 2
for row in range( 2 ):
gridData.SetRowLabel( row, "Row %d"%row )
# siColumnCombo
gridData.SetColumnLabel( 0, "siColumnCombo" )
gridData.SetColumnDef( 0, C.siColumnCombo, [ "First", 1, "Second", 2, "Tenth", 10 ] )
# siColumnInt
gridData.SetColumnLabel( 1, "siColumnInt" )
gridData.SetColumnDef( 1, C.siColumnInt, [ -10, 10, 1 ] )
# siColumnFloat
gridData.SetColumnLabel( 2, "siColumnFloat" )
gridData.SetColumnDef( 2, C.siColumnFloat, [ -10, 10, 1, 2 ] )
# siColumnImageClip
gridData.SetColumnLabel( 3, "siColumnImageClip" )
gridData.SetColumnDef( 3, C.siColumnImageClip, [ 64 ] )
# siColumnVector
gridData.SetColumnLabel( 4, "siColumnVector" )
gridData.SetColumnDef( 4, C.siColumnVector, [ 3, -10, 10, 1, 2 ] )
# siColumnFile
gridData.SetColumnLabel( 5, "siColumnFile" )
gridData.SetColumnDef( 5, C.siColumnFile, [ "File", "C:\\", ".exe" ] )
# siColumnShaderBall
gridData.SetColumnLabel( 6, "siColumnShaderBall" )
gridData.SetColumnDef( 6, C.siColumnShaderBall, [ 64 ] )
# siColumnMultiLine
gridData.SetColumnLabel( 7, "siColumnMultiLine" )
gridData.SetColumnDef( 7, C.siColumnMultiLine, [ ] )
Application.InspectObj( siProperty )
# Now log the definitions
for col in range(8):
Application.LogMessage( "Definition for column %d:%s"%( col, gridData.GetColumnDef( col ) ) )
# Expected log:
# INFO : Definition for column 0:(u'First', 1, u'Second', 2, u'Tenth', 10)
# INFO : Definition for column 1:(-10, 10, 1)
# INFO : Definition for column 2:(-10.0, 10.0, 1.0, 2)
# INFO : Definition for column 3:(64,)
# INFO : Definition for column 4:(3, -10.0, 10.0, 1.0, 2)
# INFO : Definition for column 5:(u'file', u'C:\\', u'.exe')
# INFO : Definition for column 6:(64, )
# INFO : Definition for column 7:None
|