diff --git a/abogen/gui.py b/abogen/gui.py index 2131622..23b44ed 100644 --- a/abogen/gui.py +++ b/abogen/gui.py @@ -570,15 +570,9 @@ class abogen(QWidget): ) voice_row.addWidget(self.voice_combo) - # voice formula - text box for now, add a dialog later - 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) - + # Voice formula button 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.setFixedSize(40, 36) self.btn_voice_formula_mixer.setStyleSheet("QPushButton { padding: 6px 12px; }") diff --git a/abogen/voice_formula_gui.py b/abogen/voice_formula_gui.py index 5fc166b..52a468f 100644 --- a/abogen/voice_formula_gui.py +++ b/abogen/voice_formula_gui.py @@ -39,6 +39,7 @@ class VoiceMixer(QWidget): # Checkbox at the top self.checkbox = QCheckBox() self.checkbox.setChecked(initial_status) + self.checkbox.stateChanged.connect(self.toggle_inputs) self.checkbox.stateChanged.connect(self.update_formula_callback) layout.addWidget(self.checkbox, alignment=Qt.AlignCenter) @@ -78,7 +79,15 @@ class VoiceMixer(QWidget): layout.addLayout(slider_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): if self.voice_name in VOICES_INTERNAL: @@ -133,8 +142,8 @@ class VoiceFormulaDialog(QDialog): cancel_button = QPushButton("Cancel") # Connect buttons to appropriate slots - ok_button.clicked.connect(self.accept) # Close dialog and return QDialog.Accepted - cancel_button.clicked.connect(self.reject) # Close dialog and return QDialog.Rejected + ok_button.clicked.connect(self.accept) + cancel_button.clicked.connect(self.reject) button_layout.addStretch() # Push buttons to the right button_layout.addWidget(ok_button)