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

Function __formatNumericParameter

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

Source from the content-addressed store, hash-verified

43 fn( parm, formatter )
44
45def __formatNumericParameter( parm, formatter ) :
46
47 ## \todo Could this be put somewhere generally useful?
48 def formatFloat( f ) :
49
50 f = "%.10f" % f
51 f = f.rstrip( "0" )
52 f = f.rstrip( "." )
53 return f
54
55 __formatParameter( parm, formatter )
56
57 formatter.indent()
58
59 if not parm.presetsOnly :
60
61 if isinstance( parm, IECore.IntData ) :
62 minValue = str( parm.minValue )
63 maxValue = str( parm.maxValue )
64 else :
65 minValue = formatFloat( parm.minValue )
66 maxValue = formatFloat( parm.maxValue )
67
68 if parm.hasMinValue() and parm.hasMaxValue() :
69 formatter.paragraph( "Range : %s - %s" % ( minValue, maxValue ) )
70 elif parm.hasMinValue() :
71 formatter.paragraph( "Min : %s" % minValue )
72 elif parm.hasMaxValue() :
73 formatter.paragraph( "Max : %s" % maxValue )
74
75 formatter.unindent()
76
77def __formatFileNameParameter( parm, formatter ) :
78

Callers

nothing calls this directly

Calls 8

__formatParameterFunction · 0.85
formatFloatFunction · 0.85
hasMinValueMethod · 0.80
hasMaxValueMethod · 0.80
strFunction · 0.50
indentMethod · 0.45
paragraphMethod · 0.45
unindentMethod · 0.45

Tested by

no test coverage detected