Handle empty voice list initially

This commit is contained in:
Deniz Şafak
2026-01-09 01:19:39 +03:00
parent 7677f5a1e2
commit fc0af420c6
+5 -3
View File
@@ -554,9 +554,6 @@ class VoiceFormulaDialog(QDialog):
ok_button.setDefault(True) ok_button.setDefault(True)
ok_button.setFocus() ok_button.setFocus()
# Connect buttons
clear_all_button.clicked.connect(self.clear_all_voices)
ok_button.clicked.connect(self.accept)
# Connect buttons # Connect buttons
clear_all_button.clicked.connect(self.clear_all_voices) clear_all_button.clicked.connect(self.clear_all_voices)
ok_button.clicked.connect(self.accept) ok_button.clicked.connect(self.accept)
@@ -591,6 +588,9 @@ class VoiceFormulaDialog(QDialog):
vm.spin_box.valueChanged.connect(self.mark_profile_modified) vm.spin_box.valueChanged.connect(self.mark_profile_modified)
vm.checkbox.stateChanged.connect(lambda *_: self.mark_profile_modified()) vm.checkbox.stateChanged.connect(lambda *_: self.mark_profile_modified())
# Update profile colors on initialization to show status
self.update_profile_list_colors()
def keyPressEvent(self, event): def keyPressEvent(self, event):
# Bind Delete key to delete_profile when a profile is selected # Bind Delete key to delete_profile when a profile is selected
if event.key() == Qt.Key.Key_Delete and self.profile_list.hasFocus(): if event.key() == Qt.Key.Key_Delete and self.profile_list.hasFocus():
@@ -877,6 +877,8 @@ class VoiceFormulaDialog(QDialog):
else: else:
state = profiles.get(name, {}) state = profiles.get(name, {})
voices = state.get("voices") if isinstance(state, dict) else state voices = state.get("voices") if isinstance(state, dict) else state
if voices is None:
voices = []
lang = state.get("language") if isinstance(state, dict) else None lang = state.get("language") if isinstance(state, dict) else None
# apply language selection # apply language selection
if lang: if lang: