Prevent cancellation if process is at 99%

This commit is contained in:
Deniz Şafak
2025-05-09 01:50:09 +03:00
parent cab0a7631f
commit 101012d9aa
2 changed files with 9 additions and 0 deletions
+1
View File
@@ -1,6 +1,7 @@
# v1.0.7 (pre-release) # v1.0.7 (pre-release)
- Improve chaptered audio generation by outputting directly as `m4b` instead of converting from `wav`. - Improve chaptered audio generation by outputting directly as `m4b` instead of converting from `wav`.
- Ignore chapter markers and single newlines when calculating text length, improving the accuracy of the text length calculation. - Ignore chapter markers and single newlines when calculating text length, improving the accuracy of the text length calculation.
- Prevent cancellation if process is at 99%, ensuring the process is not interrupted at the last moment.
- Added `.opus` as output format for generated audio files. - Added `.opus` as output format for generated audio files.
- Added "Playing..." indicator for "Preview" button in the voice mixer. - Added "Playing..." indicator for "Preview" button in the voice mixer.
+8
View File
@@ -1127,12 +1127,20 @@ class abogen(QWidget):
QApplication.processEvents() QApplication.processEvents()
def update_progress(self, value, etr_str): # Add etr_str parameter def update_progress(self, value, etr_str): # Add etr_str parameter
# Ensure progress doesn't exceed 99%
if value >= 100:
value = 99
self.progress_bar.setValue(value) self.progress_bar.setValue(value)
self.progress_bar.setFormat("%p%") # Keep format as percentage only self.progress_bar.setFormat("%p%") # Keep format as percentage only
self.etr_label.setText( self.etr_label.setText(
f"Estimated time remaining: {etr_str}" f"Estimated time remaining: {etr_str}"
) # Update ETR label ) # Update ETR label
self.etr_label.show() # Show only when estimate is ready self.etr_label.show() # Show only when estimate is ready
# Disable cancel button if progress is >= 98%
if value >= 98:
self.btn_cancel.setEnabled(False)
self.progress_bar.repaint() self.progress_bar.repaint()
QApplication.processEvents() QApplication.processEvents()