From bc7d62ca9a406bc30419e985016c7f4f56e54e76 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Fri, 24 Jul 2026 18:00:52 +0530 Subject: first commit --- SoundListItemWidget.py | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 SoundListItemWidget.py (limited to 'SoundListItemWidget.py') 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 +# +# 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 . + +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) -- cgit v1.2.3