Recording transcriber improvements (#1414)

Adding option to hide unconfirmed and variable transcriptions in append and replace mode
This commit is contained in:
Raivis Dejus 2026-03-07 21:26:29 +02:00 committed by GitHub
commit 14cacf6acf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 184 additions and 74 deletions

View file

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: buzz\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-03-07 11:02+0200\n"
"POT-Creation-Date: 2026-03-07 20:20+0200\n"
"PO-Revision-Date: 2025-10-17 07:59+0200\n"
"Last-Translator: Éric Duarte <contacto@ericdq.com>\n"
"Language-Team: Catalan <jmas@softcatala.org>\n"
@ -466,6 +466,10 @@ msgstr "Separador de línies:"
msgid "Transcription step:"
msgstr "Pas de transcripció:"
#: buzz/widgets/transcriber/advanced_settings_dialog.py
msgid "Hide unconfirmed"
msgstr "Amaga el no confirmat"
#: buzz/widgets/transcriber/advanced_settings_dialog.py
msgid "Enable live recording export"
msgstr "Activa l'exportació d'enregistrament en directe"

View file

@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-03-07 11:02+0200\n"
"POT-Creation-Date: 2026-03-07 20:20+0200\n"
"PO-Revision-Date: \n"
"Last-Translator: Ole Guldberg2 <xalt7x.service@gmail.com>\n"
"Language-Team: \n"
@ -461,6 +461,10 @@ msgstr "Linjeseparator:"
msgid "Transcription step:"
msgstr "Transskriberingstrin:"
#: buzz/widgets/transcriber/advanced_settings_dialog.py
msgid "Hide unconfirmed"
msgstr "Skjul ubekræftet"
#: buzz/widgets/transcriber/advanced_settings_dialog.py
msgid "Enable live recording export"
msgstr "Aktiver eksport af live optagelse"

View file

@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-03-07 11:02+0200\n"
"POT-Creation-Date: 2026-03-07 20:20+0200\n"
"PO-Revision-Date: 2025-03-05 14:41+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -467,6 +467,10 @@ msgstr "Zeilentrenner:"
msgid "Transcription step:"
msgstr "Transkriptionsschritt:"
#: buzz/widgets/transcriber/advanced_settings_dialog.py
msgid "Hide unconfirmed"
msgstr "Unbestätigtes ausblenden"
#: buzz/widgets/transcriber/advanced_settings_dialog.py
msgid "Enable live recording export"
msgstr "Export von Live-Aufnahmen aktivieren"

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-03-07 11:02+0200\n"
"POT-Creation-Date: 2026-03-07 20:20+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -445,6 +445,10 @@ msgstr ""
msgid "Transcription step:"
msgstr ""
#: buzz/widgets/transcriber/advanced_settings_dialog.py
msgid "Hide unconfirmed"
msgstr "Hide unconfirmed"
#: buzz/widgets/transcriber/advanced_settings_dialog.py
msgid "Enable live recording export"
msgstr ""

View file

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-03-07 11:02+0200\n"
"POT-Creation-Date: 2026-03-07 20:20+0200\n"
"PO-Revision-Date: 2025-09-08 12:43+0200\n"
"Last-Translator: Éric Duarte <contacto@ericdq.com>\n"
"Language-Team: \n"
@ -486,6 +486,10 @@ msgstr "Separador de línea:"
msgid "Transcription step:"
msgstr "Paso de transcripción:"
#: buzz/widgets/transcriber/advanced_settings_dialog.py
msgid "Hide unconfirmed"
msgstr "Ocultar no confirmado"
#: buzz/widgets/transcriber/advanced_settings_dialog.py
msgid "Enable live recording export"
msgstr "Habilitar la exportación de grabación en vivo"

View file

@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: buzz\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-03-07 11:02+0200\n"
"POT-Creation-Date: 2026-03-07 20:20+0200\n"
"PO-Revision-Date: 2026-01-25 21:42+0200\n"
"Language-Team: (Italiano) Albano Battistella <albanobattistella@gmail.com>\n"
"Language: it_IT\n"
@ -467,6 +467,10 @@ msgstr "Separatore di riga:"
msgid "Transcription step:"
msgstr "Passo di trascrizione:"
#: buzz/widgets/transcriber/advanced_settings_dialog.py
msgid "Hide unconfirmed"
msgstr "Nascondi non confermato"
#: buzz/widgets/transcriber/advanced_settings_dialog.py
msgid "Enable live recording export"
msgstr "Abilita l'esportazione della registrazione live"

View file

@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-03-07 11:02+0200\n"
"POT-Creation-Date: 2026-03-07 20:20+0200\n"
"PO-Revision-Date: \n"
"Last-Translator: nunawa <71294849+nunawa@users.noreply.github.com>\n"
"Language-Team: \n"
@ -458,6 +458,10 @@ msgstr "行区切り:"
msgid "Transcription step:"
msgstr "トランスクリプションステップ:"
#: buzz/widgets/transcriber/advanced_settings_dialog.py
msgid "Hide unconfirmed"
msgstr "未確認を非表示"
#: buzz/widgets/transcriber/advanced_settings_dialog.py
msgid "Enable live recording export"
msgstr "ライブ録音の出力を有効にする"

View file

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-03-07 11:02+0200\n"
"POT-Creation-Date: 2026-03-07 20:20+0200\n"
"PO-Revision-Date: 2026-03-06 13:23+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -470,6 +470,10 @@ msgstr "Rindiņu atdalītājs:"
msgid "Transcription step:"
msgstr "Atpazīšanas solis:"
#: buzz/widgets/transcriber/advanced_settings_dialog.py
msgid "Hide unconfirmed"
msgstr "Slēpt mainīgos fragmentus"
#: buzz/widgets/transcriber/advanced_settings_dialog.py
msgid "Enable live recording export"
msgstr "Eksportēt dzīvā ieraksta transkriptus"

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-03-07 11:02+0200\n"
"POT-Creation-Date: 2026-03-07 20:20+0200\n"
"PO-Revision-Date: 2025-03-20 18:30+0100\n"
"Last-Translator: Heimen Stoffels <vistausss@fastmail.com>\n"
"Language-Team: none\n"
@ -469,6 +469,10 @@ msgstr "Regelscheidingsteken:"
msgid "Transcription step:"
msgstr "Transcriptiestap:"
#: buzz/widgets/transcriber/advanced_settings_dialog.py
msgid "Hide unconfirmed"
msgstr "Verberg onbevestigd"
#: buzz/widgets/transcriber/advanced_settings_dialog.py
msgid "Enable live recording export"
msgstr "Live-opname exporteren inschakelen"

View file

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-03-07 11:02+0200\n"
"POT-Creation-Date: 2026-03-07 20:20+0200\n"
"PO-Revision-Date: 2024-03-17 20:50+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -464,6 +464,10 @@ msgstr "Separator wierszy:"
msgid "Transcription step:"
msgstr "Krok transkrypcji:"
#: buzz/widgets/transcriber/advanced_settings_dialog.py
msgid "Hide unconfirmed"
msgstr "Ukryj niepotwierdzone"
#: buzz/widgets/transcriber/advanced_settings_dialog.py
msgid "Enable live recording export"
msgstr "Włącz eksport nagrywania na żywo"

View file

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Buzz\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-03-07 11:02+0200\n"
"POT-Creation-Date: 2026-03-07 20:20+0200\n"
"PO-Revision-Date: 2025-11-01 17:43-0300\n"
"Last-Translator: Paulo Schopf <pschopf@gmail.com>\n"
"Language-Team: none\n"
@ -463,6 +463,10 @@ msgstr "Separador de linha:"
msgid "Transcription step:"
msgstr "Etapa de transcrição:"
#: buzz/widgets/transcriber/advanced_settings_dialog.py
msgid "Hide unconfirmed"
msgstr "Ocultar não confirmado"
#: buzz/widgets/transcriber/advanced_settings_dialog.py
msgid "Enable live recording export"
msgstr "Habilitar exportação de gravação ao vivo"

View file

@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-03-07 11:02+0200\n"
"POT-Creation-Date: 2026-03-07 20:20+0200\n"
"PO-Revision-Date: \n"
"Last-Translator: Yevhen Popok <xalt7x.service@gmail.com>\n"
"Language-Team: \n"
@ -460,6 +460,10 @@ msgstr "Роздільник рядків:"
msgid "Transcription step:"
msgstr "Крок транскрибування:"
#: buzz/widgets/transcriber/advanced_settings_dialog.py
msgid "Hide unconfirmed"
msgstr "Приховати непідтверджене"
#: buzz/widgets/transcriber/advanced_settings_dialog.py
msgid "Enable live recording export"
msgstr "Увімкнути експорт живого запису"

View file

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-03-07 11:02+0200\n"
"POT-Creation-Date: 2026-03-07 20:20+0200\n"
"PO-Revision-Date: 2023-05-01 15:45+0800\n"
"Last-Translator: \n"
"Language-Team: lamb \n"
@ -455,6 +455,10 @@ msgstr "行分隔符:"
msgid "Transcription step:"
msgstr "转录步长:"
#: buzz/widgets/transcriber/advanced_settings_dialog.py
msgid "Hide unconfirmed"
msgstr "隐藏未确认内容"
#: buzz/widgets/transcriber/advanced_settings_dialog.py
msgid "Enable live recording export"
msgstr "启用实时录制导出"

View file

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-03-07 11:02+0200\n"
"POT-Creation-Date: 2026-03-07 20:20+0200\n"
"PO-Revision-Date: 2023-05-01 15:45+0800\n"
"Last-Translator: \n"
"Language-Team: Lamb\n"
@ -456,6 +456,10 @@ msgstr "行分隔符號:"
msgid "Transcription step:"
msgstr "轉錄步長:"
#: buzz/widgets/transcriber/advanced_settings_dialog.py
msgid "Hide unconfirmed"
msgstr "隱藏未確認內容"
#: buzz/widgets/transcriber/advanced_settings_dialog.py
msgid "Enable live recording export"
msgstr "啟用即時錄製匯出"

View file

@ -30,6 +30,7 @@ class Settings:
RECORDING_TRANSCRIBER_EXPORT_FILE_TYPE = "recording-transcriber/export-file-type"
RECORDING_TRANSCRIBER_EXPORT_MAX_ENTRIES = "recording-transcriber/export-max-entries"
RECORDING_TRANSCRIBER_EXPORT_FILE_NAME = "recording-transcriber/export-file-name"
RECORDING_TRANSCRIBER_HIDE_UNCONFIRMED = "recording-transcriber/hide-unconfirmed"
PRESENTATION_WINDOW_TEXT_COLOR = "presentation-window/text-color"
PRESENTATION_WINDOW_BACKGROUND_COLOR = "presentation-window/background-color"

View file

@ -189,6 +189,9 @@ class RecordingTranscriberWidget(QWidget):
self.transcription_options_group_box.advanced_settings_dialog.recording_mode_changed.connect(
self.on_recording_mode_changed
)
self.transcription_options_group_box.advanced_settings_dialog.hide_unconfirmed_changed.connect(
self.on_hide_unconfirmed_changed
)
recording_options_layout = QFormLayout()
self.microphone_label = QLabel(_("Microphone:"))
@ -218,6 +221,11 @@ class RecordingTranscriberWidget(QWidget):
self._closing = False
self.transcript_export_file = None
self.translation_export_file = None
self.export_file_type = "txt"
self.export_max_entries = 0
self.hide_unconfirmed = self.settings.value(
Settings.Key.RECORDING_TRANSCRIBER_HIDE_UNCONFIRMED, True
)
self.export_enabled = self.settings.value(
key=Settings.Key.RECORDING_TRANSCRIBER_EXPORT_ENABLED,
default_value=False,
@ -464,11 +472,17 @@ class RecordingTranscriberWidget(QWidget):
)
export_file_name_template = custom_template if custom_template else Settings().get_default_export_file_template()
export_file_type = self.settings.value(
self.export_file_type = self.settings.value(
key=Settings.Key.RECORDING_TRANSCRIBER_EXPORT_FILE_TYPE,
default_value="txt",
)
ext = ".csv" if export_file_type == "csv" else ".txt"
self.export_max_entries = self.settings.value(
Settings.Key.RECORDING_TRANSCRIBER_EXPORT_MAX_ENTRIES, 0, int
)
self.hide_unconfirmed = self.settings.value(
Settings.Key.RECORDING_TRANSCRIBER_HIDE_UNCONFIRMED, True
)
ext = ".csv" if self.export_file_type == "csv" else ".txt"
export_file_name = (
export_file_name_template.replace("{{ input_file_name }}", "live recording")
@ -496,6 +510,9 @@ class RecordingTranscriberWidget(QWidget):
def on_recording_mode_changed(self, mode: RecordingTranscriberMode):
self.transcriber_mode = mode
def on_hide_unconfirmed_changed(self, value: bool):
self.hide_unconfirmed = value
def on_transcription_options_changed(
self, transcription_options: TranscriptionOptions
):
@ -859,16 +876,36 @@ class RecordingTranscriberWidget(QWidget):
def process_transcription_merge(self, text: str, texts, text_box, export_file):
texts.append(text)
# Possibly in future we want to tie this to some setting, to limit amount of data that needs
# to be processed and exported. Value should not be less than ~10, so we have enough data to
# work with.
# if len(texts) > 20:
# del texts[:len(texts) - 20]
# Remove possibly errorous parts from overlapping audio chunks
last_common_length = None
for i in range(len(texts) - 1):
common_part = self.find_common_part(texts[i], texts[i + 1])
if common_part:
common_length = len(common_part)
texts[i] = texts[i][:texts[i].rfind(common_part) + common_length]
texts[i + 1] = texts[i + 1][texts[i + 1].find(common_part):]
if i == len(texts) - 2:
last_common_length = common_length
elif i == len(texts) - 2:
last_common_length = None
# When hiding unconfirmed: trim the last text to only the part confirmed by overlap
# with the previous chunk. If no overlap found, drop the last text entirely.
display_texts = list(texts)
if self.hide_unconfirmed and len(display_texts) > 1:
if last_common_length is not None:
display_texts[-1] = display_texts[-1][:last_common_length]
else:
display_texts = display_texts[:-1]
merged_texts = ""
for text in texts:
for text in display_texts:
merged_texts = self.merge_text_no_overlap(merged_texts, text)
merged_texts = NO_SPACE_BETWEEN_SENTENCES.sub(r'\1 \2', merged_texts)
@ -877,10 +914,7 @@ class RecordingTranscriberWidget(QWidget):
text_box.moveCursor(QTextCursor.MoveOperation.End)
if self.export_enabled and export_file:
export_file_type = self.settings.value(
Settings.Key.RECORDING_TRANSCRIBER_EXPORT_FILE_TYPE, "txt"
)
if export_file_type == "csv":
if self.export_file_type == "csv":
# For APPEND_AND_CORRECT mode, rewrite the whole CSV with all merged text as a single entry
self.write_to_export_file(export_file, "", mode="w")
self.write_csv_export(export_file, merged_texts, 0)
@ -896,13 +930,6 @@ class RecordingTranscriberWidget(QWidget):
if self.translator is not None:
self.translator.enqueue(text)
export_file_type = self.settings.value(
Settings.Key.RECORDING_TRANSCRIBER_EXPORT_FILE_TYPE, "txt"
)
max_entries = self.settings.value(
Settings.Key.RECORDING_TRANSCRIBER_EXPORT_MAX_ENTRIES, 0, int
)
if self.transcriber_mode == RecordingTranscriberMode.APPEND_BELOW:
self.transcription_text_box.moveCursor(QTextCursor.MoveOperation.End)
if len(self.transcription_text_box.toPlainText()) > 0:
@ -911,10 +938,10 @@ class RecordingTranscriberWidget(QWidget):
self.transcription_text_box.moveCursor(QTextCursor.MoveOperation.End)
if self.export_enabled and self.transcript_export_file:
if export_file_type == "csv":
self.write_csv_export(self.transcript_export_file, text, max_entries)
if self.export_file_type == "csv":
self.write_csv_export(self.transcript_export_file, text, self.export_max_entries)
else:
self.write_txt_export(self.transcript_export_file, text, "a", max_entries, self.transcription_options.line_separator)
self.write_txt_export(self.transcript_export_file, text, "a", self.export_max_entries, self.transcription_options.line_separator)
elif self.transcriber_mode == RecordingTranscriberMode.APPEND_ABOVE:
self.transcription_text_box.moveCursor(QTextCursor.MoveOperation.Start)
@ -923,7 +950,7 @@ class RecordingTranscriberWidget(QWidget):
self.transcription_text_box.moveCursor(QTextCursor.MoveOperation.Start)
if self.export_enabled and self.transcript_export_file:
if export_file_type == "csv":
if self.export_file_type == "csv":
# For APPEND_ABOVE, prepend in CSV means inserting at beginning of columns
existing_columns = []
if os.path.isfile(self.transcript_export_file):
@ -934,14 +961,14 @@ class RecordingTranscriberWidget(QWidget):
existing_columns = row
break
new_columns = [text] + existing_columns
if max_entries > 0:
new_columns = new_columns[:max_entries]
if self.export_max_entries > 0:
new_columns = new_columns[:self.export_max_entries]
buf = io.StringIO()
writer = csv.writer(buf)
writer.writerow(new_columns)
self.write_to_export_file(self.transcript_export_file, buf.getvalue(), mode="w")
else:
self.write_txt_export(self.transcript_export_file, text, "prepend", max_entries, self.transcription_options.line_separator)
self.write_txt_export(self.transcript_export_file, text, "prepend", self.export_max_entries, self.transcription_options.line_separator)
elif self.transcriber_mode == RecordingTranscriberMode.APPEND_AND_CORRECT:
self.process_transcription_merge(text, self.transcripts, self.transcription_text_box, self.transcript_export_file)
@ -968,13 +995,6 @@ class RecordingTranscriberWidget(QWidget):
if len(text) == 0:
return
export_file_type = self.settings.value(
Settings.Key.RECORDING_TRANSCRIBER_EXPORT_FILE_TYPE, "txt"
)
max_entries = self.settings.value(
Settings.Key.RECORDING_TRANSCRIBER_EXPORT_MAX_ENTRIES, 0, int
)
if self.transcriber_mode == RecordingTranscriberMode.APPEND_BELOW:
self.translation_text_box.moveCursor(QTextCursor.MoveOperation.End)
if len(self.translation_text_box.toPlainText()) > 0:
@ -983,10 +1003,10 @@ class RecordingTranscriberWidget(QWidget):
self.translation_text_box.moveCursor(QTextCursor.MoveOperation.End)
if self.export_enabled and self.translation_export_file:
if export_file_type == "csv":
self.write_csv_export(self.translation_export_file, text, max_entries)
if self.export_file_type == "csv":
self.write_csv_export(self.translation_export_file, text, self.export_max_entries)
else:
self.write_txt_export(self.translation_export_file, text, "a", max_entries, self.transcription_options.line_separator)
self.write_txt_export(self.translation_export_file, text, "a", self.export_max_entries, self.transcription_options.line_separator)
elif self.transcriber_mode == RecordingTranscriberMode.APPEND_ABOVE:
self.translation_text_box.moveCursor(QTextCursor.MoveOperation.Start)
@ -995,7 +1015,7 @@ class RecordingTranscriberWidget(QWidget):
self.translation_text_box.moveCursor(QTextCursor.MoveOperation.Start)
if self.export_enabled and self.translation_export_file:
if export_file_type == "csv":
if self.export_file_type == "csv":
existing_columns = []
if os.path.isfile(self.translation_export_file):
raw = self.read_export_file(self.translation_export_file)
@ -1005,14 +1025,14 @@ class RecordingTranscriberWidget(QWidget):
existing_columns = row
break
new_columns = [text] + existing_columns
if max_entries > 0:
new_columns = new_columns[:max_entries]
if self.export_max_entries > 0:
new_columns = new_columns[:self.export_max_entries]
buf = io.StringIO()
writer = csv.writer(buf)
writer.writerow(new_columns)
self.write_to_export_file(self.translation_export_file, buf.getvalue(), mode="w")
else:
self.write_txt_export(self.translation_export_file, text, "prepend", max_entries, self.transcription_options.line_separator)
self.write_txt_export(self.translation_export_file, text, "prepend", self.export_max_entries, self.transcription_options.line_separator)
elif self.transcriber_mode == RecordingTranscriberMode.APPEND_AND_CORRECT:
self.process_transcription_merge(text, self.translations, self.translation_text_box, self.translation_export_file)

View file

@ -28,6 +28,7 @@ class AdvancedSettingsDialog(QDialog):
transcription_options: TranscriptionOptions
transcription_options_changed = pyqtSignal(TranscriptionOptions)
recording_mode_changed = pyqtSignal(RecordingTranscriberMode)
hide_unconfirmed_changed = pyqtSignal(bool)
def __init__(
self,
@ -71,12 +72,12 @@ class AdvancedSettingsDialog(QDialog):
llm_model = self.transcription_options.llm_model or "gpt-4.1-mini"
self.llm_model_line_edit = LineEdit(llm_model, self)
self.llm_model_line_edit.textChanged.connect(
self.on_llm_model_changed
)
self.llm_model_line_edit.textChanged.connect(self.on_llm_model_changed)
self.llm_model_line_edit.setMinimumWidth(170)
self.llm_model_line_edit.setEnabled(self.transcription_options.enable_llm_translation)
layout.addRow(_("AI model:"), self.llm_model_line_edit)
self.llm_model_label = QLabel(_("AI model:"))
self.llm_model_label.setEnabled(self.transcription_options.enable_llm_translation)
layout.addRow(self.llm_model_label, self.llm_model_line_edit)
default_llm_prompt = self.transcription_options.llm_prompt or _(
"Please translate each text sent to you from English to Spanish. Translation will be used in an automated system, please do not add any comments or notes, just the translation."
@ -86,7 +87,9 @@ class AdvancedSettingsDialog(QDialog):
self.llm_prompt_text_edit.setMinimumWidth(170)
self.llm_prompt_text_edit.setFixedHeight(80)
self.llm_prompt_text_edit.textChanged.connect(self.on_llm_prompt_changed)
layout.addRow(_("Instructions for AI:"), self.llm_prompt_text_edit)
self.llm_prompt_label = QLabel(_("Instructions for AI:"))
self.llm_prompt_label.setEnabled(self.transcription_options.enable_llm_translation)
layout.addRow(self.llm_prompt_label, self.llm_prompt_text_edit)
if show_recording_settings:
recording_settings_title = _("Recording settings")
@ -127,6 +130,15 @@ class AdvancedSettingsDialog(QDialog):
self.transcription_step_label = QLabel(_("Transcription step:"))
layout.addRow(self.transcription_step_label, self.transcription_step_spin_box)
hide_unconfirmed = self.settings.value(
Settings.Key.RECORDING_TRANSCRIBER_HIDE_UNCONFIRMED, True
)
self.hide_unconfirmed_checkbox = QCheckBox(_("Hide unconfirmed"))
self.hide_unconfirmed_checkbox.setChecked(hide_unconfirmed)
self.hide_unconfirmed_checkbox.stateChanged.connect(self.on_hide_unconfirmed_changed)
self.hide_unconfirmed_label = QLabel("")
layout.addRow(self.hide_unconfirmed_label, self.hide_unconfirmed_checkbox)
self._update_recording_mode_visibility(
RecordingTranscriberMode(self.recording_mode_combo.currentText())
)
@ -153,7 +165,9 @@ class AdvancedSettingsDialog(QDialog):
export_folder_row = QHBoxLayout()
export_folder_row.addWidget(self.export_folder_line_edit)
export_folder_row.addWidget(self.export_folder_browse_button)
layout.addRow(_("Export folder:"), export_folder_row)
self.export_folder_label = QLabel(_("Export folder:"))
self.export_folder_label.setEnabled(self._export_enabled)
layout.addRow(self.export_folder_label, export_folder_row)
# Export file name template
export_file_name = self.settings.value(
@ -162,7 +176,9 @@ class AdvancedSettingsDialog(QDialog):
self.export_file_name_line_edit = LineEdit(export_file_name, self)
self.export_file_name_line_edit.setEnabled(self._export_enabled)
self.export_file_name_line_edit.textChanged.connect(self.on_export_file_name_changed)
layout.addRow(_("Export file name:"), self.export_file_name_line_edit)
self.export_file_name_label = QLabel(_("Export file name:"))
self.export_file_name_label.setEnabled(self._export_enabled)
layout.addRow(self.export_file_name_label, self.export_file_name_line_edit)
# Export file type
self.export_file_type_combo = QComboBox(self)
@ -176,7 +192,9 @@ class AdvancedSettingsDialog(QDialog):
self.export_file_type_combo.setCurrentIndex(type_index)
self.export_file_type_combo.setEnabled(self._export_enabled)
self.export_file_type_combo.currentIndexChanged.connect(self.on_export_file_type_changed)
layout.addRow(_("Export file type:"), self.export_file_type_combo)
self.export_file_type_label = QLabel(_("Export file type:"))
self.export_file_type_label.setEnabled(self._export_enabled)
layout.addRow(self.export_file_type_label, self.export_file_type_combo)
# Max entries
max_entries = self.settings.value(
@ -187,7 +205,9 @@ class AdvancedSettingsDialog(QDialog):
self.export_max_entries_spin.setValue(max_entries)
self.export_max_entries_spin.setEnabled(self._export_enabled)
self.export_max_entries_spin.valueChanged.connect(self.on_export_max_entries_changed)
layout.addRow(_("Limit export entries\n(0 = export all):"), self.export_max_entries_spin)
self.export_max_entries_label = QLabel(_("Limit export entries\n(0 = export all):"))
self.export_max_entries_label.setEnabled(self._export_enabled)
layout.addRow(self.export_max_entries_label, self.export_max_entries_spin)
button_box = QDialogButtonBox(
QDialogButtonBox.StandardButton(QDialogButtonBox.StandardButton.Ok), self
@ -209,8 +229,11 @@ class AdvancedSettingsDialog(QDialog):
self.transcription_options.enable_llm_translation = state == 2
self.transcription_options_changed.emit(self.transcription_options)
self.llm_model_line_edit.setEnabled(self.transcription_options.enable_llm_translation)
self.llm_prompt_text_edit.setEnabled(self.transcription_options.enable_llm_translation)
enabled = self.transcription_options.enable_llm_translation
self.llm_model_label.setEnabled(enabled)
self.llm_model_line_edit.setEnabled(enabled)
self.llm_prompt_label.setEnabled(enabled)
self.llm_prompt_text_edit.setEnabled(enabled)
def on_llm_model_changed(self, text: str):
self.transcription_options.llm_model = text
@ -245,19 +268,33 @@ class AdvancedSettingsDialog(QDialog):
self.line_separator_line_edit.setVisible(not is_append_and_correct)
self.transcription_step_label.setVisible(is_append_and_correct)
self.transcription_step_spin_box.setVisible(is_append_and_correct)
self.hide_unconfirmed_label.setVisible(is_append_and_correct)
self.hide_unconfirmed_checkbox.setVisible(is_append_and_correct)
def on_transcription_step_changed(self, value: float):
self.transcription_options.transcription_step = round(value, 1)
self.transcription_options_changed.emit(self.transcription_options)
def on_hide_unconfirmed_changed(self, state: int):
value = state == 2
self.settings.set_value(Settings.Key.RECORDING_TRANSCRIBER_HIDE_UNCONFIRMED, value)
self.hide_unconfirmed_changed.emit(value)
def on_export_enabled_changed(self, state: int):
self._export_enabled = state == 2
self.settings.set_value(Settings.Key.RECORDING_TRANSCRIBER_EXPORT_ENABLED, self._export_enabled)
self.export_folder_line_edit.setEnabled(self._export_enabled)
self.export_folder_browse_button.setEnabled(self._export_enabled)
self.export_file_name_line_edit.setEnabled(self._export_enabled)
self.export_file_type_combo.setEnabled(self._export_enabled)
self.export_max_entries_spin.setEnabled(self._export_enabled)
for widget in (
self.export_folder_label,
self.export_folder_line_edit,
self.export_folder_browse_button,
self.export_file_name_label,
self.export_file_name_line_edit,
self.export_file_type_label,
self.export_file_type_combo,
self.export_max_entries_label,
self.export_max_entries_spin,
):
widget.setEnabled(self._export_enabled)
def on_export_folder_changed(self, text: str):
self.settings.set_value(Settings.Key.RECORDING_TRANSCRIBER_EXPORT_FOLDER, text)

View file

@ -178,6 +178,7 @@ class TestRecordingTranscriberWidget:
qtbot.add_widget(widget)
widget.transcriber_mode = RecordingTranscriberMode.APPEND_AND_CORRECT
widget.hide_unconfirmed = False
widget.on_next_transcription('Bienvenue dans la transcription en direct de Buzz.')
assert widget.transcription_text_box.toPlainText() == 'Bienvenue dans la transcription en direct de Buzz.'
@ -1102,9 +1103,7 @@ class TestOnNextTranscriptionExport:
widget.transcriber_mode = RecordingTranscriberMode.APPEND_ABOVE
widget.export_enabled = True
widget.transcript_export_file = export_path
widget.settings.set_value(
Settings.Key.RECORDING_TRANSCRIBER_EXPORT_FILE_TYPE, "csv"
)
widget.export_file_type = "csv"
widget.on_next_transcription("first")
widget.on_next_transcription("second")
@ -1128,12 +1127,8 @@ class TestOnNextTranscriptionExport:
widget.transcriber_mode = RecordingTranscriberMode.APPEND_ABOVE
widget.export_enabled = True
widget.transcript_export_file = export_path
widget.settings.set_value(
Settings.Key.RECORDING_TRANSCRIBER_EXPORT_FILE_TYPE, "csv"
)
widget.settings.set_value(
Settings.Key.RECORDING_TRANSCRIBER_EXPORT_MAX_ENTRIES, 2
)
widget.export_file_type = "csv"
widget.export_max_entries = 2
widget.on_next_transcription("first")
widget.on_next_transcription("second")
widget.on_next_transcription("third")
@ -1214,6 +1209,7 @@ class TestOnNextTranslation:
def test_append_and_correct_merges_translation(self, qtbot):
with _widget_ctx(qtbot) as widget:
widget.transcriber_mode = RecordingTranscriberMode.APPEND_AND_CORRECT
widget.hide_unconfirmed = False
widget.on_next_translation("Hello world.")
widget.on_next_translation("world. Goodbye.")
text = widget.translation_text_box.toPlainText()