From 5305d1e1160eabe910adc831fcab10d69cd024b2 Mon Sep 17 00:00:00 2001 From: Dave Buchfuhrer Date: Wed, 5 Feb 2014 22:01:46 -0800 Subject: [PATCH 1/2] Properly updates mill characters when every isn't equal to 1 mod 4 --- clint/textui/progress.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clint/textui/progress.py b/clint/textui/progress.py index 92aaf1b..c185edf 100644 --- a/clint/textui/progress.py +++ b/clint/textui/progress.py @@ -100,7 +100,7 @@ def mill(it, label='', hide=HIDE_DEFAULT, expected_size=None, every=1): if _i == 100: return ' ' else: - return MILL_CHARS[_i % len(MILL_CHARS)] + return MILL_CHARS[(_i / every) % len(MILL_CHARS)] def _show(_i): if not hide: From 84dafbeabe7b62d4281f892f0956b24d185d748a Mon Sep 17 00:00:00 2001 From: Dave Buchfuhrer Date: Wed, 5 Feb 2014 22:01:56 -0800 Subject: [PATCH 2/2] Clears the mill when complete --- clint/textui/progress.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clint/textui/progress.py b/clint/textui/progress.py index c185edf..3ac2298 100644 --- a/clint/textui/progress.py +++ b/clint/textui/progress.py @@ -97,7 +97,7 @@ def mill(it, label='', hide=HIDE_DEFAULT, expected_size=None, every=1): """Progress iterator. Prints a mill while iterating over the items.""" def _mill_char(_i): - if _i == 100: + if _i >= count: return ' ' else: return MILL_CHARS[(_i / every) % len(MILL_CHARS)]