aboutsummaryrefslogtreecommitdiffstats
path: root/StatusbarWidget.py
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.com>2026-07-24 18:00:52 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.com>2026-07-24 18:00:52 +0530
commitbc7d62ca9a406bc30419e985016c7f4f56e54e76 (patch)
treeb4f1091e7f008df31d20039f0fa4c683d05785e5 /StatusbarWidget.py
first commit
Diffstat (limited to 'StatusbarWidget.py')
-rw-r--r--StatusbarWidget.py60
1 files changed, 60 insertions, 0 deletions
diff --git a/StatusbarWidget.py b/StatusbarWidget.py
new file mode 100644
index 0000000..6325767
--- /dev/null
+++ b/StatusbarWidget.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 QHBoxLayout, QLabel, QPushButton, QWidget
+
+from AudioPlayer import PlayerStatus
+from Soundboard import SoundboardSound
+
+
+class StatusbarWidget(QWidget):
+ play_requested = Signal(SoundboardSound)
+ stop_requested = Signal()
+
+ def __init__(self, parent=None):
+ super().__init__(parent)
+
+ layout = QHBoxLayout(self)
+ layout.setContentsMargins(12, 16, 12, 8)
+
+ self.now_playing_label = QLabel("Welcome to soundboard")
+ layout.addWidget(self.now_playing_label, stretch=1)
+
+ self.btn_replay = QPushButton("Play Again")
+ self.btn_replay.clicked.connect(
+ lambda: self.play_requested.emit(self.status.sound)
+ )
+ self.btn_replay.setEnabled(False)
+ layout.addWidget(self.btn_replay)
+
+ self.btn_stop = QPushButton("Stop")
+ self.btn_stop.clicked.connect(lambda: self.stop_requested.emit())
+ self.btn_stop.setEnabled(False)
+ layout.addWidget(self.btn_stop)
+
+ def set_status(self, status: PlayerStatus):
+ self.status = status
+ self.now_playing_label.setText(
+ f"[{self.status.status}] {self.status.sound.title}"
+ )
+
+ if self.status.status == "PLAYING":
+ self.btn_stop.setEnabled(True)
+ else:
+ self.btn_stop.setEnabled(False)
+
+ self.btn_replay.setEnabled(True)