--- a/src/core/utils.py Fri Feb 07 16:45:20 2014 +0100
+++ b/src/core/utils.py Mon Feb 10 18:05:39 2014 +0100
@@ -41,11 +41,12 @@
@author: ymh
'''
-import sys
import codecs #@UnresolvedImport
import math
+import sys
-def show_progress(current_line, total_line, label, width, writer=None):
+
+def show_progress(current_line, total_line, label, width, writer=None, newline=False):
if writer is None:
writer = sys.stdout
@@ -59,11 +60,11 @@
loader = u'[' + (u'=' * int(marks)) + (u' ' * int(spaces)) + u']'
- s = u"%s %3d%% %*d/%d - %*s\r" % (loader, percent, len(str(total_line)), current_line, total_line, width, label[:width])
+ s = u"%s %3d%% %*d/%d - %*s%s" % (loader, percent, len(str(total_line)), current_line, total_line, width, label[:width], "\n" if newline else "\r")
writer.write(s) #takes the header into account
if percent >= 100:
writer.write("\n")
writer.flush()
- return writer
+ return writer
\ No newline at end of file