Replace text buttons with SVG icons, rebrand to Getting To It
This commit is contained in:
+16
-12
@@ -4,10 +4,12 @@ from PySide6.QtWidgets import (
|
||||
QWidget, QVBoxLayout, QHBoxLayout, QLabel,
|
||||
QPushButton, QFrame, QSizePolicy, QGridLayout
|
||||
)
|
||||
from PySide6.QtCore import Qt, QTimer
|
||||
from PySide6.QtCore import Qt, QTimer, QSize
|
||||
from PySide6.QtGui import QFont
|
||||
import os
|
||||
|
||||
from icons import icon_play, icon_pause, icon_eject
|
||||
|
||||
|
||||
class CartSlot(QFrame):
|
||||
def __init__(self, cart_key: str, slot_number: int, engine, parent=None):
|
||||
@@ -15,6 +17,8 @@ class CartSlot(QFrame):
|
||||
self.cart_key = cart_key
|
||||
self.slot_number = slot_number
|
||||
self.engine = engine
|
||||
self._playing_icon = False
|
||||
self._playing_icon = False
|
||||
|
||||
self.setFrameStyle(QFrame.Box | QFrame.Raised)
|
||||
self.setLineWidth(1)
|
||||
@@ -108,13 +112,13 @@ class CartSlot(QFrame):
|
||||
btn_col = QVBoxLayout()
|
||||
btn_col.setSpacing(4)
|
||||
|
||||
self.btn_play = QPushButton("▶")
|
||||
self.btn_play = QPushButton()
|
||||
self.btn_play.setFixedSize(60, 44)
|
||||
self.btn_play.setFont(QFont("Arial", 13, QFont.Bold))
|
||||
self.btn_play.setIconSize(QSize(22, 22))
|
||||
self.btn_play.setIcon(icon_play("#00ff41"))
|
||||
self.btn_play.setStyleSheet("""
|
||||
QPushButton {
|
||||
background-color: #1a6b3a;
|
||||
color: #00ff41;
|
||||
border: 1px solid #555;
|
||||
border-radius: 3px;
|
||||
}
|
||||
@@ -122,13 +126,13 @@ class CartSlot(QFrame):
|
||||
QPushButton:pressed { background-color: #0a5a2a; }
|
||||
""")
|
||||
|
||||
self.btn_eject = QPushButton("⏏")
|
||||
self.btn_eject = QPushButton()
|
||||
self.btn_eject.setFixedSize(60, 30)
|
||||
self.btn_eject.setFont(QFont("Arial", 11, QFont.Bold))
|
||||
self.btn_eject.setIconSize(QSize(18, 18))
|
||||
self.btn_eject.setIcon(icon_eject("#ff4444"))
|
||||
self.btn_eject.setStyleSheet("""
|
||||
QPushButton {
|
||||
background-color: #8a1a1a;
|
||||
color: #ff4444;
|
||||
border: 1px solid #555;
|
||||
border-radius: 3px;
|
||||
}
|
||||
@@ -179,11 +183,11 @@ class CartSlot(QFrame):
|
||||
self._set_ui_playing()
|
||||
|
||||
def _set_ui_playing(self):
|
||||
self.btn_play.setText("⏸")
|
||||
self.btn_play.setIcon(icon_pause("#ffffff"))
|
||||
self._playing_icon = True
|
||||
self.btn_play.setStyleSheet("""
|
||||
QPushButton {
|
||||
background-color: #00aa33;
|
||||
color: white;
|
||||
border: 1px solid #00ff41;
|
||||
border-radius: 3px;
|
||||
}
|
||||
@@ -195,11 +199,11 @@ class CartSlot(QFrame):
|
||||
)
|
||||
|
||||
def _set_ui_stopped(self):
|
||||
self.btn_play.setText("▶")
|
||||
self.btn_play.setIcon(icon_play("#00ff41"))
|
||||
self._playing_icon = False
|
||||
self.btn_play.setStyleSheet("""
|
||||
QPushButton {
|
||||
background-color: #1a6b3a;
|
||||
color: #00ff41;
|
||||
border: 1px solid #555;
|
||||
border-radius: 3px;
|
||||
}
|
||||
@@ -233,7 +237,7 @@ class CartSlot(QFrame):
|
||||
def _refresh_display(self):
|
||||
deck = self.engine.decks[self.cart_key]
|
||||
|
||||
if not deck.playing and self.btn_play.text() == "⏸":
|
||||
if not deck.playing and self._playing_icon:
|
||||
self._set_ui_stopped()
|
||||
self.status_label.setText("STOPPED")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user