Skip to content

Commit 4d62c08

Browse files
authored
Merge pull request #85 from joco-nz/bar-indicator-percent-texts-cale
Enhance bar indicator for 100% value separate from max
2 parents 5c44d8f + 90ecba1 commit 4d62c08

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

qtpyvcp/widgets/base_widgets/bar_indicator.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def __init__(self, parent=None):
1414
self._value = 100
1515
self._minimum = 0.0
1616
self._maximum = 100.0
17+
self._value_at_100_percent = 100.0
1718
self._format = '{p}%'
1819

1920
self._text_color = QColor(0, 0, 0)
@@ -226,9 +227,18 @@ def orientation(self, orient):
226227
self.adjustTransformation()
227228
self.update()
228229

230+
@Property(float)
231+
def valueAt100Percent(self):
232+
return self._value_at_100_percent
233+
234+
@valueAt100Percent.setter
235+
def valueAt100Percent(self, value_at):
236+
self._value_at_100_percent = value_at
237+
self.update()
238+
229239
def text(self):
230240
values = {'v': self._value,
231-
'p': int((self._value * 100 / self._maximum) + .5)}
241+
'p': int((self._value * 100 / self._value_at_100_percent) + .5)}
232242
try:
233243
return self.format.encode("utf-8").format(**values)
234244
except:

0 commit comments

Comments
 (0)