flipped main and secondary progress bars

This commit is contained in:
Lex Berezhny 2020-07-12 16:43:44 -04:00
parent 862c51946a
commit 7f01b1cb84
2 changed files with 17 additions and 17 deletions

View file

@ -111,8 +111,8 @@ class Bar2(Bar):
def __format__(self, format_spec):
width = self.default_len
row1 = (1,)*int(self.frac * width * 2)
row2 = (2,)*int(self.frac2 * width * 2)
row1 = (1,)*int(self.frac2 * width * 2)
row2 = (2,)*int(self.frac * width * 2)
fill = []
for one, two, _ in itertools.zip_longest(row1, row2, range(width*2)):
fill.append((one or 0)+(two or 0))

View file

@ -9,20 +9,20 @@ class TestBar2(unittest.TestCase):
def test_rendering(self):
self.bar(0.00, 0.00, ' ')
self.bar(0.00, 0.05, '')
self.bar(0.05, 0.00, '')
self.bar(0.05, 0.00, '')
self.bar(0.00, 0.05, '')
self.bar(0.05, 0.05, '')
self.bar(0.00, 0.10, '')
self.bar(0.10, 0.00, '')
self.bar(0.05, 0.10, '')
self.bar(0.10, 0.05, '')
self.bar(0.30, 0.50, '███▄▄ ')
self.bar(0.35, 0.55, '███▙▄▖ ')
self.bar(0.40, 0.60, '████▄▄ ')
self.bar(0.50, 0.30, '███▀▀ ')
self.bar(0.55, 0.35, '███▛▀▘ ')
self.bar(0.60, 0.40, '████▀▀ ')
self.bar(0.95, 0.90, '█████████▘')
self.bar(0.99, 0.98, '█████████▌')
self.bar(0.99, 1.00, '█████████▙')
self.bar(0.10, 0.00, '')
self.bar(0.00, 0.10, '')
self.bar(0.10, 0.05, '')
self.bar(0.05, 0.10, '')
self.bar(0.50, 0.30, '███▄▄ ')
self.bar(0.55, 0.35, '███▙▄▖ ')
self.bar(0.60, 0.40, '████▄▄ ')
self.bar(0.30, 0.50, '███▀▀ ')
self.bar(0.35, 0.55, '███▛▀▘ ')
self.bar(0.40, 0.60, '████▀▀ ')
self.bar(0.90, 0.95, '█████████▘')
self.bar(0.98, 0.99, '█████████▌')
self.bar(1.00, 0.99, '█████████▙')
self.bar(1.00, 1.00, '██████████')