2 Commits

Author SHA1 Message Date
Jason Piper 6a417e5bdf v0.4.1 2014-10-12 00:10:07 +01:00
Jason Piper 7431c17fe4 Decision to hide must be at runtime, not at import 2014-10-11 23:57:59 +01:00
3 changed files with 19 additions and 11 deletions
+13 -1
View File
@@ -1,6 +1,11 @@
History
-------
0.4.1
+++++
* Fix bug in logic that decides whether progress bars should be hidden or not
0.4.0
+++++
* clint.textui.prompt now has a query function with validators! (thanks to @aeby) - see `examples/prompt.py`
@@ -12,39 +17,47 @@ History
+++++
* Clint now obeys the CLINT_FORCE_COLOR environmental variable
0.3.6
+++++
* Fixed faulty PyPI deployment
0.3.5
+++++
* progress.bar is now a context manager - doesn't require an iterable anymore (thanks to @jric)
* Bug fixes
0.3.4
+++++
* Fixed Python 3 basestring deprecation
* Fixed examples
0.3.3
+++++
* Fixed Python 3 build issues
* Fixed README and HISTORY being installed to /usr
* Support added for bold text
0.3.2
+++++
* Unknown
0.3.1
+++++
* Unknown
0.3.0
+++++
* Python 3 support!
0.2.4
+++++
@@ -102,7 +115,6 @@ History
* Lots of Examples
0.1.0 (2011-03-20)
++++++++++++++++++
+2 -2
View File
@@ -26,8 +26,8 @@ from .pipes import piped_in
__title__ = 'clint'
__version__ = '0.4.0'
__build__ = 0x000400
__version__ = '0.4.1'
__build__ = 0x000401
__author__ = 'Kenneth Reitz'
__license__ = 'ISC'
__copyright__ = 'Copyright 2012 Kenneth Reitz'
+4 -8
View File
@@ -14,11 +14,6 @@ import sys
import time
STREAM = sys.stderr
# Only show bar in terminals by default (better for piping, logging etc.)
try:
HIDE_DEFAULT = not STREAM.isatty()
except AttributeError: # output does not support isatty()
HIDE_DEFAULT = True
BAR_TEMPLATE = '%s[%s%s] %i/%i - %s\r'
MILL_TEMPLATE = '%s %s %i/%i\r'
@@ -48,6 +43,7 @@ class Bar(object):
self.label = label
self.width = width
self.hide = hide
# Only show bar in terminals by default (better for piping, logging etc.)
if hide is None:
try:
self.hide = not STREAM.isatty()
@@ -107,7 +103,7 @@ class Bar(object):
return time.strftime('%H:%M:%S', time.gmtime(seconds))
def bar(it, label='', width=32, hide=HIDE_DEFAULT, empty_char=BAR_EMPTY_CHAR,
def bar(it, label='', width=32, hide=None, empty_char=BAR_EMPTY_CHAR,
filled_char=BAR_FILLED_CHAR, expected_size=None, every=1):
"""Progress iterator. Wrap your iterables with it."""
@@ -121,7 +117,7 @@ def bar(it, label='', width=32, hide=HIDE_DEFAULT, empty_char=BAR_EMPTY_CHAR,
bar.show(i + 1)
def dots(it, label='', hide=HIDE_DEFAULT, every=1):
def dots(it, label='', hide=None, every=1):
"""Progress iterator. Prints a dot for each item being iterated"""
count = 0
@@ -143,7 +139,7 @@ def dots(it, label='', hide=HIDE_DEFAULT, every=1):
STREAM.flush()
def mill(it, label='', hide=HIDE_DEFAULT, expected_size=None, every=1):
def mill(it, label='', hide=None, expected_size=None, every=1):
"""Progress iterator. Prints a mill while iterating over the items."""
def _mill_char(_i):