projects
/
snf-image-creator
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add size param in the Output.Progress constructor
[snf-image-creator]
/
image_creator
/
output.py
diff --git
a/image_creator/output.py
b/image_creator/output.py
index
4eabc06
..
040029c
100644
(file)
--- a/
image_creator/output.py
+++ b/
image_creator/output.py
@@
-91,8
+91,9
@@
class Output(object):
Progress = property(_get_progress)
class _Progress(object):
Progress = property(_get_progress)
class _Progress(object):
- def __init__(self, title, bar_type='default'):
+ def __init__(self, size, title, bar_type='default'):
self.output.output("%s..." % title, False)
self.output.output("%s..." % title, False)
+ self.size = size
def goto(self, dest):
pass
def goto(self, dest):
pass
@@
-140,7
+141,7
@@
class Output_wth_progress(Output_wth_colors):
'mb': '%(index)d/%(max)d MB'
}
'mb': '%(index)d/%(max)d MB'
}
- def __init__(self, title, bar_type='default'):
+ def __init__(self, size, title, bar_type='default'):
super(Output_wth_progress._Progress, self).__init__()
self.title = title
self.fill = '#'
super(Output_wth_progress._Progress, self).__init__()
self.title = title
self.fill = '#'
@@
-148,6
+149,10
@@
class Output_wth_progress(Output_wth_colors):
self.bar_suffix = '] '
self.message = ("%s:" % self.title).ljust(self.MESSAGE_LENGTH)
self.suffix = self.template[bar_type]
self.bar_suffix = '] '
self.message = ("%s:" % self.title).ljust(self.MESSAGE_LENGTH)
self.suffix = self.template[bar_type]
+ self.max = size
+
+ # print empty progress bar workaround
+ self.goto(1)
def success(self, result):
self.output.output("\r%s... \033[K" % self.title, False)
def success(self, result):
self.output.output("\r%s... \033[K" % self.title, False)