MCPcopy Create free account
hub / github.com/pyfa-org/Pyfa / getDigitPlaces

Method getDigitPlaces

gui/builtinItemStatsViews/attributeSlider.py:86–99  ·  view source on GitHub ↗
(minValue, maxValue)

Source from the content-addressed store, hash-verified

84 return chosenStep
85
86 def getDigitPlaces(minValue, maxValue):
87 minDigits = 3
88 maxDigits = 5
89 currentDecision = minDigits
90 for value in (floatUnerr(minValue), floatUnerr(maxValue)):
91 for currentDigit in range(minDigits, maxDigits + 1):
92 if round(value, currentDigit) == value:
93 if currentDigit > currentDecision:
94 currentDecision = currentDigit
95 break
96 # Max decimal places we can afford to show was not enough
97 else:
98 return maxDigits
99 return currentDecision
100
101 self.ctrl = wx.SpinCtrlDouble(self, min=minValue, max=maxValue, inc=getStep(maxValue - minValue))
102 self.ctrl.SetDigits(getDigitPlaces(minValue, maxValue))

Callers

nothing calls this directly

Calls 1

floatUnerrFunction · 0.90

Tested by

no test coverage detected