voice mixer enabled based on its checkpoint status

This commit is contained in:
Juraj Borza
2025-04-28 14:25:48 +02:00
parent fe09b2140b
commit 27cdd264b1
2 changed files with 13 additions and 10 deletions
+2 -8
View File
@@ -570,15 +570,9 @@ class abogen(QWidget):
) )
voice_row.addWidget(self.voice_combo) voice_row.addWidget(self.voice_combo)
# voice formula - text box for now, add a dialog later # Voice formula button
self.voice_formula = QTextEdit(self)
self.voice_formula.setAcceptRichText(False)
self.voice_formula.setPlaceholderText("Enter voice formula here...")
self.voice_formula.setText('0.242 * am_michael + 0.758 * bf_isabella')
voice_row.addWidget(self.voice_formula)
self.btn_voice_formula_mixer = QPushButton(self) self.btn_voice_formula_mixer = QPushButton(self)
self.btn_voice_formula_mixer.setText("") # TODO add voice formula icon self.btn_voice_formula_mixer.setText("🛠") # TODO add voice formula icon
self.btn_voice_formula_mixer.setToolTip("Mix and match voices") self.btn_voice_formula_mixer.setToolTip("Mix and match voices")
self.btn_voice_formula_mixer.setFixedSize(40, 36) self.btn_voice_formula_mixer.setFixedSize(40, 36)
self.btn_voice_formula_mixer.setStyleSheet("QPushButton { padding: 6px 12px; }") self.btn_voice_formula_mixer.setStyleSheet("QPushButton { padding: 6px 12px; }")
+11 -2
View File
@@ -39,6 +39,7 @@ class VoiceMixer(QWidget):
# Checkbox at the top # Checkbox at the top
self.checkbox = QCheckBox() self.checkbox = QCheckBox()
self.checkbox.setChecked(initial_status) self.checkbox.setChecked(initial_status)
self.checkbox.stateChanged.connect(self.toggle_inputs)
self.checkbox.stateChanged.connect(self.update_formula_callback) self.checkbox.stateChanged.connect(self.update_formula_callback)
layout.addWidget(self.checkbox, alignment=Qt.AlignCenter) layout.addWidget(self.checkbox, alignment=Qt.AlignCenter)
@@ -79,6 +80,14 @@ class VoiceMixer(QWidget):
layout.addLayout(slider_layout) layout.addLayout(slider_layout)
self.setLayout(layout) self.setLayout(layout)
# Disable inputs initially if the checkbox is unchecked
self.toggle_inputs()
def toggle_inputs(self):
"""Enable or disable inputs based on the checkbox state."""
is_enabled = self.checkbox.isChecked()
self.spin_box.setEnabled(is_enabled)
self.slider.setEnabled(is_enabled)
def get_voice_gender(self): def get_voice_gender(self):
if self.voice_name in VOICES_INTERNAL: if self.voice_name in VOICES_INTERNAL:
@@ -133,8 +142,8 @@ class VoiceFormulaDialog(QDialog):
cancel_button = QPushButton("Cancel") cancel_button = QPushButton("Cancel")
# Connect buttons to appropriate slots # Connect buttons to appropriate slots
ok_button.clicked.connect(self.accept) # Close dialog and return QDialog.Accepted ok_button.clicked.connect(self.accept)
cancel_button.clicked.connect(self.reject) # Close dialog and return QDialog.Rejected cancel_button.clicked.connect(self.reject)
button_layout.addStretch() # Push buttons to the right button_layout.addStretch() # Push buttons to the right
button_layout.addWidget(ok_button) button_layout.addWidget(ok_button)