Skip to content

Commit cbea2e9

Browse files
authored
Merge branch 'dev' into 394-improve-error-message-for-images
2 parents bb1cd20 + 6859a5e commit cbea2e9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎openandroidinstaller/widgets.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ def display_progress_bar(self, line: str):
140140
elif result.group(1):
141141
percentage_done = int(result.group(1))
142142
percentage_done = max(1, min(99, percentage_done))
143-
144143
# update the progress bar
145144
self.set_progress_bar(percentage_done)
146145

@@ -150,9 +149,10 @@ def set_progress_bar(self, percentage_done: int):
150149
Args:
151150
percentage_done (int): Percentage of the progress bar to be filled.
152151
"""
153-
assert (
154-
percentage_done >= 0 and percentage_done <= 100
155-
), "Percentage must be between 0 and 100"
152+
assert percentage_done >= 0, "Percentage must be non-negative."
153+
# clip the percentage to 100
154+
if percentage_done > 100:
155+
percentage_done = 100
156156
if self.progress_bar:
157157
self.progress_bar.value = percentage_done / 100
158158
self.percentage_text.value = f"{percentage_done}%"

0 commit comments

Comments
 (0)