Skip to content

Commit

Permalink
Add set_items_completed() to ProgressBarCounter
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagocoutinho committed Jun 14, 2020
1 parent 5562121 commit 8f31302
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions prompt_toolkit/shortcuts/progress_bar/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,11 @@ def item_completed(self, n: int = 1) -> None:
self.items_completed += n
self.progress_bar.invalidate()

def set_items_completed(self, nb_items: int) -> None:
if nb_items != self.items_completed:
self.items_completed = nb_items
self.progress_bar.invalidate()

@property
def done(self) -> bool:
"""Whether a counter has been completed.
Expand Down

0 comments on commit 8f31302

Please sign in to comment.