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

Method SetRange

gui/attribute_gauge.py:97–123  ·  view source on GitHub ↗

Sets the range of the gauge. The gauge length is its value as a proportion of the range.

(self, range, reinit=False, animate=True)

Source from the content-addressed store, hash-verified

95 self._timer.Stop()
96
97 def SetRange(self, range, reinit=False, animate=True):
98 """
99 Sets the range of the gauge. The gauge length is its
100 value as a proportion of the range.
101 """
102
103 if self._max_range == range:
104 return
105
106 # we cannot have a range of zero (laws of physics, etc), so we set it
107 if range <= 0:
108 self._max_range = 0.01
109 else:
110 self._max_range = range
111
112 if reinit is False:
113 self._old_percentage = self._percentage
114 self._percentage = (self._value / self._max_range) * 100
115 else:
116 self._old_percentage = self._percentage
117 self._percentage = 0
118 self._value = 0
119
120 if animate:
121 self.Animate()
122
123 self._tooltip.SetTip("%.2f/%.2f" % (self._value, self._max_range if self._max_range > 0.01 else 0))
124
125 def GetValue(self):
126 return self._value

Callers

nothing calls this directly

Calls 1

AnimateMethod · 0.95

Tested by

no test coverage detected