Tired and Poor and Old - Radio Panel v0.1.1
This commit is contained in:
+22
-24
@@ -9,10 +9,6 @@ from PySide6.QtGui import QFont
|
||||
import os
|
||||
|
||||
|
||||
# ─────────────────────────────────────────
|
||||
# SINGLE CART SLOT
|
||||
# ─────────────────────────────────────────
|
||||
|
||||
class CartSlot(QFrame):
|
||||
def __init__(self, cart_key: str, slot_number: int, engine, parent=None):
|
||||
super().__init__(parent)
|
||||
@@ -57,17 +53,17 @@ class CartSlot(QFrame):
|
||||
""")
|
||||
root.addWidget(badge, alignment=Qt.AlignVCenter)
|
||||
|
||||
lcd_frame = QFrame()
|
||||
lcd_frame.setStyleSheet("""
|
||||
self.lcd_frame = QFrame()
|
||||
self.lcd_frame.setStyleSheet("""
|
||||
QFrame {
|
||||
background-color: #0a1a0a;
|
||||
border: 1px solid #1a2a1a;
|
||||
border-radius: 3px;
|
||||
}
|
||||
""")
|
||||
lcd_frame.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
|
||||
self.lcd_frame.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
|
||||
|
||||
lcd_layout = QVBoxLayout(lcd_frame)
|
||||
lcd_layout = QVBoxLayout(self.lcd_frame)
|
||||
lcd_layout.setContentsMargins(6, 4, 6, 4)
|
||||
lcd_layout.setSpacing(2)
|
||||
|
||||
@@ -107,7 +103,7 @@ class CartSlot(QFrame):
|
||||
lcd_layout.addLayout(time_row)
|
||||
lcd_layout.addWidget(self.status_label)
|
||||
|
||||
root.addWidget(lcd_frame)
|
||||
root.addWidget(self.lcd_frame)
|
||||
|
||||
btn_col = QVBoxLayout()
|
||||
btn_col.setSpacing(4)
|
||||
@@ -145,6 +141,16 @@ class CartSlot(QFrame):
|
||||
|
||||
root.addLayout(btn_col)
|
||||
|
||||
def apply_theme(self, theme: dict):
|
||||
"""Apply theme to cart slot LCD."""
|
||||
self.lcd_frame.setStyleSheet(f"""
|
||||
QFrame {{
|
||||
background-color: {theme['bg']};
|
||||
border: 1px solid {theme['border']};
|
||||
border-radius: 3px;
|
||||
}}
|
||||
""")
|
||||
|
||||
def _connect_signals(self):
|
||||
self.btn_play.clicked.connect(self._toggle_play)
|
||||
self.btn_eject.clicked.connect(self._eject)
|
||||
@@ -158,13 +164,7 @@ class CartSlot(QFrame):
|
||||
self.elapsed_label.setText("00:00")
|
||||
self.remaining_label.setText("-00:00")
|
||||
|
||||
# ── PUBLIC MIDI METHOD ────────────────────────────────────────────────
|
||||
|
||||
def toggle(self):
|
||||
"""
|
||||
MIDI toggle - playing → stop and reset to start.
|
||||
Stopped/paused → play.
|
||||
"""
|
||||
deck = self.engine.decks[self.cart_key]
|
||||
if deck.track is None:
|
||||
return
|
||||
@@ -178,8 +178,6 @@ class CartSlot(QFrame):
|
||||
deck.play()
|
||||
self._set_ui_playing()
|
||||
|
||||
# ── SHARED UI STATE HELPERS ───────────────────────────────────────────
|
||||
|
||||
def _set_ui_playing(self):
|
||||
self.btn_play.setText("⏸")
|
||||
self.btn_play.setStyleSheet("""
|
||||
@@ -213,8 +211,6 @@ class CartSlot(QFrame):
|
||||
"color: #00aa2a; background: transparent; border: none;"
|
||||
)
|
||||
|
||||
# ── ACTIONS ───────────────────────────────────────────────────────────
|
||||
|
||||
def _toggle_play(self):
|
||||
deck = self.engine.decks[self.cart_key]
|
||||
if deck.track is None:
|
||||
@@ -246,10 +242,6 @@ class CartSlot(QFrame):
|
||||
self.remaining_label.setText(deck.get_remaining())
|
||||
|
||||
|
||||
# ─────────────────────────────────────────
|
||||
# CART BANK
|
||||
# ─────────────────────────────────────────
|
||||
|
||||
class CartBankWidget(QWidget):
|
||||
def __init__(self, engine, parent=None):
|
||||
super().__init__(parent)
|
||||
@@ -292,4 +284,10 @@ class CartBankWidget(QWidget):
|
||||
grid.addWidget(slot, row, col)
|
||||
self.slots.append(slot)
|
||||
|
||||
root.addLayout(grid)
|
||||
root.addLayout(grid)
|
||||
|
||||
def apply_theme(self, theme: dict):
|
||||
"""Propagate theme to all cart slots."""
|
||||
for slot in self.slots:
|
||||
slot.apply_theme(theme)
|
||||
|
||||
Reference in New Issue
Block a user