From 4afb42bd064165cd18a0d130caef78d4a9cf7d52 Mon Sep 17 00:00:00 2001 From: dougollerenshaw Date: Mon, 7 Oct 2024 17:17:17 -0700 Subject: [PATCH] Cleaned up progressbar --- codeaide/ui/chat_window.py | 42 ++++++++------------------------------ 1 file changed, 8 insertions(+), 34 deletions(-) diff --git a/codeaide/ui/chat_window.py b/codeaide/ui/chat_window.py index 4a8339a..68f83a8 100644 --- a/codeaide/ui/chat_window.py +++ b/codeaide/ui/chat_window.py @@ -4,8 +4,6 @@ QTimer, QThread, pyqtSignal, - QPropertyAnimation, - QEasingCurve, ) from PyQt5.QtGui import QColor from PyQt5.QtWidgets import ( @@ -19,8 +17,7 @@ QWidget, QComboBox, QLabel, - QProgressBar, - QDialog, + QProgressDialog, ) from codeaide.ui.code_popup import CodePopup from codeaide.ui.example_selection_dialog import show_example_dialog @@ -123,35 +120,6 @@ def run(self): self.finished.emit(transcribed_text) -class AnimatedProgressDialog(QDialog): - def __init__(self, parent=None): - super().__init__(parent) - self.setWindowTitle("Transcribing Audio") - self.setFixedSize(300, 100) - layout = QVBoxLayout(self) - - self.label = QLabel("Transcribing audio...") - layout.addWidget(self.label) - - self.progress_bar = QProgressBar(self) - self.progress_bar.setRange(0, 100) - self.progress_bar.setValue(0) - layout.addWidget(self.progress_bar) - - self.animation = QPropertyAnimation(self.progress_bar, b"value") - self.animation.setDuration(1000) # 1 second for a full cycle - self.animation.setStartValue(0) - self.animation.setEndValue(100) - self.animation.setEasingCurve(QEasingCurve.Linear) - self.animation.finished.connect(self.restart_animation) - - self.animation.start() - - def restart_animation(self): - self.progress_bar.setValue(0) - self.animation.start() - - class ChatWindow(QMainWindow): def __init__(self, chat_handler): super().__init__() @@ -666,8 +634,14 @@ def on_recording_finished(self, filename, recording_duration): ) def transcribe_audio(self, filename): - progress_dialog = AnimatedProgressDialog(self) + progress_dialog = QProgressDialog("Transcribing audio...", None, 0, 0, self) + progress_dialog.setWindowTitle("Please Wait") progress_dialog.setWindowModality(Qt.WindowModal) + progress_dialog.setAutoClose(True) + progress_dialog.setAutoReset(True) + progress_dialog.setMinimumDuration(0) + progress_dialog.setValue(0) + progress_dialog.setMaximum(0) # This makes it an indeterminate progress dialog progress_dialog.show() self.transcription_thread = TranscriptionThread(self.whisper_model, filename)