mirror of
https://github.com/gryf/coach.git
synced 2025-12-18 11:40:18 +01:00
progress bar update
This commit is contained in:
@@ -558,14 +558,15 @@ class ProgressBar(object):
|
|||||||
self.max_value = max_value
|
self.max_value = max_value
|
||||||
self.current_value = 0
|
self.current_value = 0
|
||||||
|
|
||||||
def update(self, current_value):
|
def update(self, current_value, additional_info=""):
|
||||||
self.current_value = current_value
|
self.current_value = current_value
|
||||||
percentage = int((100 * current_value) / self.max_value)
|
percentage = int((100 * current_value) / self.max_value)
|
||||||
sys.stdout.write("\rProgress: ({}/{}) Time: {} sec {}%|{}{}| "
|
sys.stdout.write("\rProgress: ({}/{}) Time: {} sec {}%|{}{}| {}"
|
||||||
.format(current_value, self.max_value,
|
.format(current_value, self.max_value,
|
||||||
round(time.time() - self.start_time, 2),
|
round(time.time() - self.start_time, 2),
|
||||||
percentage, '#' * int(percentage / 10),
|
percentage, '#' * int(percentage / 10),
|
||||||
' ' * (10 - int(percentage / 10))))
|
' ' * (10 - int(percentage / 10)),
|
||||||
|
additional_info))
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user