Commit e3c565d6 authored by Celine Mercier's avatar Celine Mercier

Cleaner progress bar

parent d88390c6
......@@ -68,7 +68,7 @@ cdef class ProgressBar:
'##########'
def __call__(self, object pos):
def __call__(self, object pos, bint force=False):
cdef off_t ipos
cdef clock_t elapsed
cdef clock_t newtime
......@@ -82,7 +82,7 @@ cdef class ProgressBar:
self.cycle+=1
if self.cycle % self.freq == 0:
if self.cycle % self.freq == 0 or force:
self.cycle=1
newtime = self.clock()
delta = newtime - self.lasttime
......@@ -117,7 +117,7 @@ cdef class ProgressBar:
self.arrow=(self.arrow+1) % 4
if days:
<void>fprintf(stderr,b'\r%s %5.1f %% |%.*s%c%.*s] remain : %d days %02d:%02d:%02d\t',
<void>fprintf(stderr,b'\r%s %5.1f %% |%.*s%c%.*s] remain : %d days %02d:%02d:%02d\033[K',
self.chead,
percent*100,
fraction,self.diese,
......@@ -125,7 +125,7 @@ cdef class ProgressBar:
50-fraction,self.spaces,
days,hour,minu,sec)
else:
<void>fprintf(stderr,b'\r%s %5.1f %% |%.*s%c%.*s] remain : %02d:%02d:%02d\t',
<void>fprintf(stderr,b'\r%s %5.1f %% |%.*s%c%.*s] remain : %02d:%02d:%02d\033[K',
self.chead,
percent*100.,
fraction,self.diese,
......@@ -140,7 +140,7 @@ cdef class ProgressBar:
if self.ontty:
<void>fputs(b'\n',stderr)
self.logger.info('%s %5.1f %% remain : %02d:%02d:%02d' % (
self.logger.info('%s %5.1f %% remain : %02d:%02d:%02d\033[K' % (
bytes2str(self._head),
percent*100.,
hour,minu,sec))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment