Skip to content

Commit

Permalink
Merge branch 'dev' into 394-improve-error-message-for-images
Browse files Browse the repository at this point in the history
  • Loading branch information
tsterbak committed Jan 14, 2024
2 parents bb1cd20 + 6859a5e commit cbea2e9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions openandroidinstaller/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ def display_progress_bar(self, line: str):
elif result.group(1):
percentage_done = int(result.group(1))
percentage_done = max(1, min(99, percentage_done))

# update the progress bar
self.set_progress_bar(percentage_done)

Expand All @@ -150,9 +149,10 @@ def set_progress_bar(self, percentage_done: int):
Args:
percentage_done (int): Percentage of the progress bar to be filled.
"""
assert (
percentage_done >= 0 and percentage_done <= 100
), "Percentage must be between 0 and 100"
assert percentage_done >= 0, "Percentage must be non-negative."
# clip the percentage to 100
if percentage_done > 100:
percentage_done = 100
if self.progress_bar:
self.progress_bar.value = percentage_done / 100
self.percentage_text.value = f"{percentage_done}%"
Expand Down

0 comments on commit cbea2e9

Please sign in to comment.