Skip to content

Commit

Permalink
Merge pull request #1680 from scottp-dpaw/progress_fix
Browse files Browse the repository at this point in the history
Fix progress bar code to support progressbar2
  • Loading branch information
dmach authored Jan 3, 2025
2 parents ffca873 + b45f874 commit d0d6965
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions osc/meter.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
try:
import progressbar as pb
have_pb_module = True
using_pb_progressbar2 = tuple(map(int, pb.__version__.split('.'))) >= (3, 1)
except ImportError:
have_pb_module = False

Expand Down Expand Up @@ -62,9 +63,14 @@ def end(self):
for i in self.bar.widgets:
if not isinstance(i, pb.Bar):
continue
i.marker = " "
i.left = " "
i.right = " "
if using_pb_progressbar2:
i.marker = lambda _progress, _data, _width: " "
i.left = lambda _progress, _data, _width: " "
i.right = lambda _progress, _data, _width: " "
else:
i.marker = " "
i.left = " "
i.right = " "

self.bar.finish()

Expand Down

0 comments on commit d0d6965

Please sign in to comment.