MCPcopy Create free account
hub / github.com/ImageEngine/cortex / __formatParameter

Function __formatParameter

python/IECore/FormattedParameterHelp.py:140–165  ·  view source on GitHub ↗
( parm, formatter )

Source from the content-addressed store, hash-verified

138 formatter.unindent()
139
140def __formatParameter( parm, formatter ) :
141
142 formatter.heading( parm.name + " (" + parm.__class__.__name__.replace( "Parameter", "" ) + ")" )
143 formatter.paragraph( parm.description )
144
145 formatter.indent()
146
147 d = parm.defaultValue
148 defaultPresetName = None
149 for k, v in parm.getPresets().items() :
150 if d == v :
151 defaultPresetName = k
152 break
153
154 if defaultPresetName :
155 formatter.paragraph( "Default : " + defaultPresetName )
156 elif isinstance( d, IECore.Data ) and hasattr( d, "value" ) :
157 formatter.paragraph( "Default : " + str( d.value ) )
158
159 if len( parm.presetNames() ) :
160 formatter.paragraph( "Presets : " )
161 formatter.indent()
162 formatter.paragraph( "\n".join( parm.presetNames() ) )
163 formatter.unindent()
164
165 formatter.unindent()
166
167__formatters = {
168 IECore.CompoundParameter : __formatCompoundParameter,

Callers 5

__formatNumericParameterFunction · 0.85
__formatDirNameParameterFunction · 0.85

Calls 8

joinMethod · 0.80
strFunction · 0.50
lenFunction · 0.50
headingMethod · 0.45
paragraphMethod · 0.45
indentMethod · 0.45
itemsMethod · 0.45
unindentMethod · 0.45

Tested by

no test coverage detected