Replace text buttons with SVG icons, rebrand to Getting To It
This commit is contained in:
+33
-26
@@ -4,11 +4,16 @@ from PySide6.QtWidgets import (
|
||||
QWidget, QVBoxLayout, QHBoxLayout, QLabel,
|
||||
QPushButton, QFrame, QSizePolicy
|
||||
)
|
||||
from PySide6.QtCore import Qt, QTimer, Signal
|
||||
from PySide6.QtCore import Qt, QTimer, Signal, QSize
|
||||
from PySide6.QtGui import QFont, QColor, QPainter, QPen
|
||||
import numpy as np
|
||||
import os
|
||||
|
||||
from icons import (
|
||||
icon_play, icon_pause, icon_stop, icon_skip_start,
|
||||
icon_skip_end, icon_skip_back, icon_skip_forward, icon_eject
|
||||
)
|
||||
|
||||
|
||||
class WaveformWidget(QFrame):
|
||||
"""Displays downsampled waveform with playhead position."""
|
||||
@@ -207,18 +212,18 @@ class LCDDisplay(QFrame):
|
||||
)
|
||||
|
||||
|
||||
def make_transport_button(text: str,
|
||||
color: str = "#3a3a3a",
|
||||
text_color: str = "white",
|
||||
width: int = 52,
|
||||
height: int = 48) -> QPushButton:
|
||||
btn = QPushButton(text)
|
||||
def make_icon_button(icon: QIcon,
|
||||
color: str = "#3a3a3a",
|
||||
icon_color: str = "white",
|
||||
width: int = 52,
|
||||
height: int = 48) -> QPushButton:
|
||||
btn = QPushButton()
|
||||
btn.setFixedSize(width, height)
|
||||
btn.setFont(QFont("Arial", 11, QFont.Bold))
|
||||
btn.setIconSize(QSize(22, 22))
|
||||
btn.setIcon(icon)
|
||||
btn.setStyleSheet(f"""
|
||||
QPushButton {{
|
||||
background-color: {color};
|
||||
color: {text_color};
|
||||
border: 1px solid #555;
|
||||
border-radius: 4px;
|
||||
}}
|
||||
@@ -244,6 +249,8 @@ class DeckWidget(QWidget):
|
||||
self.accent_color = accent_color
|
||||
self.current_theme = None
|
||||
self.flash_state = False
|
||||
self._playing_icon = False
|
||||
self._playing_icon = False
|
||||
|
||||
# Convert "DECK 1" to "DECK_001"
|
||||
deck_num = label.split()[-1]
|
||||
@@ -295,12 +302,12 @@ class DeckWidget(QWidget):
|
||||
transport = QHBoxLayout()
|
||||
transport.setSpacing(6)
|
||||
|
||||
self.btn_to_start = make_transport_button("⏮", "#3a3a3a", "white", 52, 48)
|
||||
self.btn_back_15 = make_transport_button("-15", "#3a3a3a", "#aaaaaa", 52, 48)
|
||||
self.btn_play = make_transport_button("▶", "#1a6b3a", "#00ff41", 68, 48)
|
||||
self.btn_fwd_15 = make_transport_button("+15", "#3a3a3a", "#aaaaaa", 52, 48)
|
||||
self.btn_to_end = make_transport_button("⏭", "#3a3a3a", "white", 52, 48)
|
||||
self.btn_stop = make_transport_button("■", "#8a1a1a", "#ff4444", 52, 48)
|
||||
self.btn_to_start = make_icon_button(icon_skip_start())
|
||||
self.btn_back_15 = make_icon_button(icon_skip_back(), icon_color="#aaaaaa")
|
||||
self.btn_play = make_icon_button(icon_play(), "#1a6b3a", "#00ff41", 68, 48)
|
||||
self.btn_fwd_15 = make_icon_button(icon_skip_forward(), icon_color="#aaaaaa")
|
||||
self.btn_to_end = make_icon_button(icon_skip_end())
|
||||
self.btn_stop = make_icon_button(icon_stop(), "#8a1a1a", "#ff4444")
|
||||
|
||||
transport.addWidget(self.btn_to_start)
|
||||
transport.addWidget(self.btn_back_15)
|
||||
@@ -377,11 +384,11 @@ class DeckWidget(QWidget):
|
||||
if deck.playing:
|
||||
deck.pause()
|
||||
deck.go_to_start()
|
||||
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: 4px;
|
||||
}
|
||||
@@ -399,11 +406,11 @@ class DeckWidget(QWidget):
|
||||
return
|
||||
if deck.playing:
|
||||
deck.pause()
|
||||
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: 4px;
|
||||
}
|
||||
@@ -413,11 +420,11 @@ class DeckWidget(QWidget):
|
||||
self.lcd.set_playing(False)
|
||||
else:
|
||||
deck.play()
|
||||
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: 4px;
|
||||
}
|
||||
@@ -431,11 +438,11 @@ class DeckWidget(QWidget):
|
||||
def _stop_eject(self):
|
||||
deck = self.engine.decks[self.deck_key]
|
||||
deck.stop()
|
||||
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: 4px;
|
||||
}
|
||||
@@ -471,12 +478,12 @@ class DeckWidget(QWidget):
|
||||
self.lcd.update_status("LOADED")
|
||||
|
||||
# Sync button if stopped manually
|
||||
if not deck.playing and self.btn_play.text() == "⏸":
|
||||
self.btn_play.setText("▶")
|
||||
if not deck.playing and self._playing_icon:
|
||||
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: 4px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user