[common]show 99.9% instead of 100.0% when not complete but near

This commit is contained in:
MaxwellGoblin 2017-07-23 09:29:29 +08:00
parent 84624d8a8b
commit 9e7a84ffbe

View File

@ -656,6 +656,9 @@ class SimpleProgressBar:
percent_str = '100'
else:
percent = math.floor(self.received * 100 / self.total_size)
# near but not complete - kick it to 99.9
if percent_str == '100.0':
percent_str = '99.9'
dots = bar_size * percent // 100
plus = percent - dots // bar_size * 100
if plus > 0.8: