mirror of
https://github.com/denizsafak/abogen.git
synced 2026-07-18 13:40:27 +02:00
moved to a vertical mixer component
This commit is contained in:
@@ -42,7 +42,7 @@ class VoiceMixer(QWidget):
|
|||||||
self.spin_box.setDecimals(2)
|
self.spin_box.setDecimals(2)
|
||||||
self.spin_box.valueChanged.connect(self.update_formula_callback)
|
self.spin_box.valueChanged.connect(self.update_formula_callback)
|
||||||
|
|
||||||
self.slider = QSlider(Qt.Horizontal)
|
self.slider = QSlider(Qt.Vertical) # Set slider orientation to vertical
|
||||||
self.slider.setRange(0, 100)
|
self.slider.setRange(0, 100)
|
||||||
self.slider.setValue(50) # Default to 0.5
|
self.slider.setValue(50) # Default to 0.5
|
||||||
self.slider.valueChanged.connect(
|
self.slider.valueChanged.connect(
|
||||||
@@ -52,16 +52,13 @@ class VoiceMixer(QWidget):
|
|||||||
lambda val: self.slider.setValue(int(val * 100))
|
lambda val: self.slider.setValue(int(val * 100))
|
||||||
)
|
)
|
||||||
|
|
||||||
slider_layout = QHBoxLayout()
|
slider_layout = QVBoxLayout()
|
||||||
slider_layout.addWidget(QLabel("0"))
|
slider_layout.addWidget(self.spin_box)
|
||||||
|
slider_layout.addWidget(QLabel("1", alignment=Qt.AlignCenter))
|
||||||
slider_layout.addWidget(self.slider)
|
slider_layout.addWidget(self.slider)
|
||||||
slider_layout.addWidget(QLabel("1"))
|
slider_layout.addWidget(QLabel("0", alignment=Qt.AlignCenter))
|
||||||
|
|
||||||
input_layout = QVBoxLayout()
|
layout.addLayout(slider_layout)
|
||||||
input_layout.addWidget(self.spin_box)
|
|
||||||
input_layout.addLayout(slider_layout)
|
|
||||||
|
|
||||||
layout.addLayout(input_layout)
|
|
||||||
self.setLayout(layout)
|
self.setLayout(layout)
|
||||||
|
|
||||||
def get_formula_component(self):
|
def get_formula_component(self):
|
||||||
@@ -70,6 +67,7 @@ class VoiceMixer(QWidget):
|
|||||||
return f"{weight:.3f} * {self.voice_name.lower().replace(' ', '_')}"
|
return f"{weight:.3f} * {self.voice_name.lower().replace(' ', '_')}"
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
class VoiceFormulaDialog(QDialog):
|
class VoiceFormulaDialog(QDialog):
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
@@ -84,7 +82,7 @@ class VoiceFormulaDialog(QDialog):
|
|||||||
self.scroll_area = QScrollArea()
|
self.scroll_area = QScrollArea()
|
||||||
self.scroll_area.setWidgetResizable(True)
|
self.scroll_area.setWidgetResizable(True)
|
||||||
self.voice_list_widget = QWidget()
|
self.voice_list_widget = QWidget()
|
||||||
self.voice_list_layout = QVBoxLayout()
|
self.voice_list_layout = QHBoxLayout()
|
||||||
self.voice_list_widget.setLayout(self.voice_list_layout)
|
self.voice_list_widget.setLayout(self.voice_list_layout)
|
||||||
self.scroll_area.setWidget(self.voice_list_widget)
|
self.scroll_area.setWidget(self.voice_list_widget)
|
||||||
main_layout.addWidget(self.scroll_area)
|
main_layout.addWidget(self.scroll_area)
|
||||||
@@ -134,48 +132,3 @@ class VoiceFormulaDialog(QDialog):
|
|||||||
]
|
]
|
||||||
formula = " + ".join(filter(None, formula_components))
|
formula = " + ".join(filter(None, formula_components))
|
||||||
self.formula_label.setText(f"Voice Formula: {formula}")
|
self.formula_label.setText(f"Voice Formula: {formula}")
|
||||||
|
|
||||||
# """ Show a dialog to mix the voice formula """
|
|
||||||
# ### todo
|
|
||||||
# # Get application icon for dialog
|
|
||||||
# icon = self.windowIcon()
|
|
||||||
|
|
||||||
# # Create custom dialog
|
|
||||||
# dialog = QDialog(self)
|
|
||||||
# dialog.setWindowTitle(f"Voice Formula Mixer")
|
|
||||||
# dialog.setWindowFlags(dialog.windowFlags() & ~Qt.WindowContextHelpButtonHint)
|
|
||||||
# dialog.setFixedSize(1200, 400) # Increased height for new button
|
|
||||||
|
|
||||||
# layout = QVBoxLayout(dialog)
|
|
||||||
# layout.setSpacing(10)
|
|
||||||
|
|
||||||
# # add a picker for each voice
|
|
||||||
# # TODO add all voices
|
|
||||||
# voices = ['af_bella','af_sarah','am_eric']
|
|
||||||
# language_icon = '🇺🇸'
|
|
||||||
# for voice in voices:
|
|
||||||
# self.add_voice(voice, language_icon)
|
|
||||||
|
|
||||||
# # Scroll Area for Voice Panels
|
|
||||||
# self.scroll_area = QScrollArea()
|
|
||||||
# self.scroll_area.setWidgetResizable(True)
|
|
||||||
# self.voice_list_widget = QWidget()
|
|
||||||
# self.voice_list_layout = QVBoxLayout()
|
|
||||||
# self.voice_list_widget.setLayout(self.voice_list_layout)
|
|
||||||
# self.scroll_area.setWidget(self.voice_list_widget)
|
|
||||||
# layout.addWidget(self.scroll_area)
|
|
||||||
|
|
||||||
# # TODO add all voices
|
|
||||||
# self.add_fixed_voices()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# # Close button
|
|
||||||
# close_btn = QPushButton("Close")
|
|
||||||
# close_btn.clicked.connect(dialog.accept)
|
|
||||||
# close_btn.setFixedHeight(32)
|
|
||||||
# layout.addWidget(close_btn)
|
|
||||||
|
|
||||||
# dialog.exec_()
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user