add player
This commit is contained in:
parent
b90adfd155
commit
4760a92942
118
screens/media.py
Normal file
118
screens/media.py
Normal file
@ -0,0 +1,118 @@
|
||||
from PySide6.QtWidgets import (
|
||||
QWidget,
|
||||
QLabel,
|
||||
QVBoxLayout,
|
||||
QHBoxLayout,
|
||||
QPushButton,
|
||||
QSlider,
|
||||
QSizePolicy,
|
||||
)
|
||||
from PySide6.QtCore import Qt, QSize
|
||||
from PySide6.QtGui import QFont
|
||||
|
||||
|
||||
class MediaScreen(QWidget):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
root = QVBoxLayout(self)
|
||||
root.setContentsMargins(18, 16, 18, 16)
|
||||
root.setSpacing(14)
|
||||
|
||||
header = QHBoxLayout()
|
||||
header.setContentsMargins(0, 0, 0, 0)
|
||||
header.setSpacing(12)
|
||||
|
||||
info_col = QVBoxLayout()
|
||||
info_col.setContentsMargins(0, 0, 0, 0)
|
||||
info_col.setSpacing(6)
|
||||
|
||||
source = QLabel("Источник: Bluetooth")
|
||||
source.setObjectName("MediaSource")
|
||||
source.setFont(QFont("", 14, 600))
|
||||
|
||||
title = QLabel("Название трека")
|
||||
title.setObjectName("MediaTitle")
|
||||
title.setFont(QFont("", 22, 700))
|
||||
|
||||
artist = QLabel("Исполнитель")
|
||||
artist.setObjectName("MediaArtist")
|
||||
artist.setFont(QFont("", 16, 600))
|
||||
|
||||
info_col.addWidget(source)
|
||||
info_col.addWidget(title)
|
||||
info_col.addWidget(artist)
|
||||
info_col.addStretch(1)
|
||||
|
||||
cover = QLabel("COVER")
|
||||
cover.setObjectName("MediaCover")
|
||||
cover.setAlignment(Qt.AlignCenter)
|
||||
cover.setFixedSize(QSize(240, 240))
|
||||
|
||||
header.addLayout(info_col, 1)
|
||||
header.addWidget(cover, 0, Qt.AlignRight | Qt.AlignTop)
|
||||
|
||||
controls = QVBoxLayout()
|
||||
controls.setContentsMargins(0, 0, 0, 0)
|
||||
controls.setSpacing(12)
|
||||
|
||||
progress = QSlider(Qt.Horizontal)
|
||||
progress.setObjectName("MediaProgress")
|
||||
progress.setRange(0, 100)
|
||||
progress.setValue(35)
|
||||
|
||||
transport = QHBoxLayout()
|
||||
transport.setContentsMargins(0, 0, 0, 0)
|
||||
transport.setSpacing(16)
|
||||
|
||||
btn_prev = QPushButton("⏮")
|
||||
btn_prev.setObjectName("MediaTransportBtn")
|
||||
btn_prev.setFixedSize(QSize(72, 72))
|
||||
|
||||
btn_play = QPushButton("▶")
|
||||
btn_play.setObjectName("MediaTransportBtnPrimary")
|
||||
btn_play.setFixedSize(QSize(96, 72))
|
||||
|
||||
btn_next = QPushButton("⏭")
|
||||
btn_next.setObjectName("MediaTransportBtn")
|
||||
btn_next.setFixedSize(QSize(72, 72))
|
||||
|
||||
transport.addStretch(1)
|
||||
transport.addWidget(btn_prev)
|
||||
transport.addWidget(btn_play)
|
||||
transport.addWidget(btn_next)
|
||||
transport.addStretch(1)
|
||||
|
||||
volume_row = QHBoxLayout()
|
||||
volume_row.setContentsMargins(0, 0, 0, 0)
|
||||
volume_row.setSpacing(10)
|
||||
|
||||
volume_lbl = QLabel("Громкость")
|
||||
volume_lbl.setObjectName("MediaVolumeLabel")
|
||||
volume_lbl.setFont(QFont("", 14, 600))
|
||||
|
||||
volume = QSlider(Qt.Horizontal)
|
||||
volume.setObjectName("MediaVolume")
|
||||
volume.setRange(0, 100)
|
||||
volume.setValue(55)
|
||||
volume.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
|
||||
|
||||
volume_row.addWidget(volume_lbl)
|
||||
volume_row.addWidget(volume, 1)
|
||||
|
||||
controls.addWidget(progress)
|
||||
controls.addLayout(transport)
|
||||
controls.addLayout(volume_row)
|
||||
|
||||
soft_keys = QHBoxLayout()
|
||||
soft_keys.setContentsMargins(0, 0, 0, 0)
|
||||
soft_keys.setSpacing(10)
|
||||
|
||||
for label in ["SOURCE", "EQ", "FOLDER", "RANDOM", "REPEAT"]:
|
||||
btn = QPushButton(label)
|
||||
btn.setObjectName("MediaSoftBtn")
|
||||
btn.setMinimumHeight(52)
|
||||
soft_keys.addWidget(btn, 1)
|
||||
|
||||
root.addLayout(header)
|
||||
root.addLayout(controls)
|
||||
root.addLayout(soft_keys)
|
||||
@ -58,4 +58,39 @@ QWidget { background: #F4F6F8; color: #111827; }
|
||||
font-weight: 600;
|
||||
}
|
||||
#BluetoothActionBtnPrimary:hover { background: #D1D5DB; }
|
||||
|
||||
#MediaSource { color: rgba(107,114,128,0.95); }
|
||||
#MediaTitle { color: #111827; }
|
||||
#MediaArtist { color: rgba(55,65,81,0.95); }
|
||||
#MediaCover {
|
||||
background: #FFFFFF;
|
||||
border: 1px solid #E5E7EB;
|
||||
border-radius: 16px;
|
||||
color: rgba(107,114,128,0.9);
|
||||
}
|
||||
#MediaProgress::groove:horizontal { height: 8px; background: #E5E7EB; border-radius: 4px; }
|
||||
#MediaProgress::handle:horizontal { width: 18px; margin: -6px 0; background: #111827; border-radius: 9px; }
|
||||
#MediaVolume::groove:horizontal { height: 8px; background: #E5E7EB; border-radius: 4px; }
|
||||
#MediaVolume::handle:horizontal { width: 18px; margin: -6px 0; background: #111827; border-radius: 9px; }
|
||||
#MediaTransportBtn {
|
||||
background: #FFFFFF;
|
||||
border-radius: 14px;
|
||||
border: 1px solid #E5E7EB;
|
||||
font-size: 22px;
|
||||
font-weight: 700;
|
||||
}
|
||||
#MediaTransportBtnPrimary {
|
||||
background: #E5E7EB;
|
||||
border-radius: 14px;
|
||||
border: 1px solid #D1D5DB;
|
||||
font-size: 22px;
|
||||
font-weight: 700;
|
||||
}
|
||||
#MediaSoftBtn {
|
||||
background: #FFFFFF;
|
||||
border-radius: 12px;
|
||||
border: 1px solid #E5E7EB;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
}
|
||||
"""
|
||||
|
||||
@ -53,4 +53,36 @@ QWidget { background: #0B0E11; color: #E6EAF0; }
|
||||
font-weight: 600;
|
||||
}
|
||||
#BluetoothActionBtnPrimary:hover { background: #344968; }
|
||||
|
||||
#MediaSource { color: rgba(138,147,166,0.95); }
|
||||
#MediaTitle { color: #E6EAF0; }
|
||||
#MediaArtist { color: rgba(200,208,222,0.95); }
|
||||
#MediaCover {
|
||||
background: #141A22;
|
||||
border: 1px solid #1B2330;
|
||||
border-radius: 16px;
|
||||
color: rgba(138,147,166,0.9);
|
||||
}
|
||||
#MediaProgress::groove:horizontal { height: 8px; background: #1B2330; border-radius: 4px; }
|
||||
#MediaProgress::handle:horizontal { width: 18px; margin: -6px 0; background: #E6EAF0; border-radius: 9px; }
|
||||
#MediaVolume::groove:horizontal { height: 8px; background: #1B2330; border-radius: 4px; }
|
||||
#MediaVolume::handle:horizontal { width: 18px; margin: -6px 0; background: #E6EAF0; border-radius: 9px; }
|
||||
#MediaTransportBtn {
|
||||
background: #141A22;
|
||||
border-radius: 14px;
|
||||
font-size: 22px;
|
||||
font-weight: 700;
|
||||
}
|
||||
#MediaTransportBtnPrimary {
|
||||
background: #2A3A52;
|
||||
border-radius: 14px;
|
||||
font-size: 22px;
|
||||
font-weight: 700;
|
||||
}
|
||||
#MediaSoftBtn {
|
||||
background: #141A22;
|
||||
border-radius: 12px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
}
|
||||
"""
|
||||
|
||||
@ -6,6 +6,7 @@ from ui.components.nav_button import NavButton
|
||||
from screens.home import HomeScreen
|
||||
from screens.stub import StubScreen
|
||||
from screens.settings import SettingsScreen
|
||||
from screens.media import MediaScreen
|
||||
from datetime import datetime
|
||||
from PySide6.QtWidgets import (
|
||||
QApplication, QMainWindow, QWidget, QLabel, QPushButton,
|
||||
@ -71,7 +72,7 @@ class MainWindow(QMainWindow):
|
||||
# Content stack
|
||||
self.stack = QStackedWidget()
|
||||
self.stack.addWidget(HomeScreen()) # 0
|
||||
self.stack.addWidget(StubScreen("Media")) # 1
|
||||
self.stack.addWidget(MediaScreen()) # 1
|
||||
self.stack.addWidget(StubScreen("Car")) # 2
|
||||
self.stack.addWidget(StubScreen("Maps")) # 3
|
||||
self.stack.addWidget(SettingsScreen()) # 4
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user