Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix progress bar code to support progressbar2 #1680

Merged
merged 1 commit into from
Jan 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading