diff --git a/overviewer_core/progressbar.py b/overviewer_core/progressbar.py index c8b5f0a..c4fc722 100644 --- a/overviewer_core/progressbar.py +++ b/overviewer_core/progressbar.py @@ -3,17 +3,17 @@ # # progressbar - Text progressbar library for python. # Copyright (c) 2005 Nilton Volpato -# +# # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. -# +# # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. -# +# # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -148,6 +148,12 @@ class Percentage(ProgressBarWidget): def update(self, pbar): return '%3d%%' % pbar.percentage() +class FractionWidget(ProgressBarWidget): + def __init__(self, sep=' / '): + self.sep = sep + def update(self, pbar): + return '%2d%s%2d' % (pbar.currval, self.sep, pbar.maxval) + class Bar(ProgressBarWidgetHFill): "The bar of progress. It will strech to fill the line." def __init__(self, marker='#', left='|', right='|'): @@ -301,7 +307,7 @@ class ProgressBar(object): self.update(self.maxval) if self.signal_set: signal.signal(signal.SIGWINCH, signal.SIG_DFL) - +