diff options
Diffstat (limited to 'SoundListItemWidget.py')
| -rw-r--r-- | SoundListItemWidget.py | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/SoundListItemWidget.py b/SoundListItemWidget.py new file mode 100644 index 0000000..92ba827 --- /dev/null +++ b/SoundListItemWidget.py @@ -0,0 +1,60 @@ +# Soundboard Engine - customizable soundboard +# Copyright (C) 2026 Vidhu Kant Sharma <vidhukant@vidhukant.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + +from PySide6.QtCore import Signal +from PySide6.QtWidgets import QFrame, QHBoxLayout, QLabel, QPushButton + +from Soundboard import SoundboardSound + + +class SoundListItemWidget(QFrame): + play_requested = Signal(SoundboardSound) + + def __init__(self, sound: SoundboardSound, parent=None): # noqa: F821 + super().__init__(parent) + + self.sound = sound + + self.setFixedHeight(48) + self.setStyleSheet(""" + SoundListItemWidget { + border: none; + border-bottom: 1px solid palette(shadow); + background-color: palette(window); + } + + SoundListItemWidget:hover { + background-color: palette(mid); + } + """) + + layout = QHBoxLayout(self) + layout.setContentsMargins(12, 6, 12, 6) + layout.setSpacing(10) + + self.title_label = QLabel(sound.title) + font = self.title_label.font() + font.setBold(True) + self.title_label.setFont(font) + layout.addWidget(self.title_label, stretch=1) + + # self.btn_download = QPushButton("Download") + # self.btn_download.clicked.connect(lambda: self.download_requested.emit(self.sound_data)) + # layout.addWidget(self.btn_download) + + self.btn_play = QPushButton("Play") + self.btn_play.clicked.connect(lambda: self.play_requested.emit(self.sound)) + layout.addWidget(self.btn_play) |