def pause(self):
# ====== clear the report ====== #
if self._last_report is not None:
nlines = len(self._last_report.split("\n"))
self.__pb.moveto(-nlines)
for i in range(nlines):
Progbar.FP.write('\r')
Progbar.FP.write(' ' * _environ_cols_wrapper()(Progbar.FP))
Progbar.FP.write('\r') # place cursor back at the beginning of line
self.__pb.moveto(1)
else:
nlines = 0
# ====== clear the bar ====== #
if self.__pb is not None:
self.__pb.clear()
self.__pb.moveto(-nlines)
# ====== reset the last report ====== #
# because we already clean everythin, set _last_report=None prevent
# further moveto(-nlines) in add()
self._last_report = None
return self
评论列表
文章目录