settings
This commit is contained in:
parent
18b7178fe6
commit
f17cee52fe
105
screens/settings.py
Normal file
105
screens/settings.py
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
from PySide6.QtWidgets import QWidget, QLabel, QVBoxLayout, QHBoxLayout, QPushButton, QSizePolicy, QScrollArea
|
||||||
|
from PySide6.QtCore import Qt
|
||||||
|
from PySide6.QtGui import QFont
|
||||||
|
|
||||||
|
|
||||||
|
class SettingsRow(QPushButton):
|
||||||
|
def __init__(self, title: str, subtitle: str):
|
||||||
|
super().__init__()
|
||||||
|
self.setObjectName("SettingsRow")
|
||||||
|
self.setCursor(Qt.PointingHandCursor)
|
||||||
|
self.setCheckable(False)
|
||||||
|
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
|
||||||
|
self.setMinimumHeight(70)
|
||||||
|
|
||||||
|
row = QHBoxLayout(self)
|
||||||
|
row.setContentsMargins(16, 10, 16, 10)
|
||||||
|
row.setSpacing(12)
|
||||||
|
|
||||||
|
text_col = QVBoxLayout()
|
||||||
|
text_col.setContentsMargins(0, 0, 0, 0)
|
||||||
|
text_col.setSpacing(2)
|
||||||
|
|
||||||
|
lbl_title = QLabel(title)
|
||||||
|
lbl_title.setObjectName("SettingsRowTitle")
|
||||||
|
lbl_title.setFont(QFont("", 16, 600))
|
||||||
|
|
||||||
|
lbl_sub = QLabel(subtitle)
|
||||||
|
lbl_sub.setObjectName("SettingsRowSub")
|
||||||
|
lbl_sub.setFont(QFont("", 12))
|
||||||
|
lbl_sub.setWordWrap(True)
|
||||||
|
|
||||||
|
text_col.addWidget(lbl_title)
|
||||||
|
text_col.addWidget(lbl_sub)
|
||||||
|
|
||||||
|
chevron = QLabel("›")
|
||||||
|
chevron.setObjectName("SettingsChevron")
|
||||||
|
chevron.setFont(QFont("", 20, 600))
|
||||||
|
chevron.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
|
||||||
|
|
||||||
|
row.addLayout(text_col)
|
||||||
|
row.addStretch(1)
|
||||||
|
row.addWidget(chevron)
|
||||||
|
|
||||||
|
|
||||||
|
class SettingsScreen(QWidget):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
root = QVBoxLayout(self)
|
||||||
|
root.setContentsMargins(18, 16, 18, 16)
|
||||||
|
root.setSpacing(12)
|
||||||
|
|
||||||
|
title = QLabel("Настройки")
|
||||||
|
title.setFont(QFont("", 24, 700))
|
||||||
|
root.addWidget(title)
|
||||||
|
|
||||||
|
scroll = QScrollArea()
|
||||||
|
scroll.setWidgetResizable(True)
|
||||||
|
scroll.setFrameShape(QScrollArea.NoFrame)
|
||||||
|
scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
|
||||||
|
|
||||||
|
content = QWidget()
|
||||||
|
content_layout = QVBoxLayout(content)
|
||||||
|
content_layout.setContentsMargins(0, 0, 0, 0)
|
||||||
|
content_layout.setSpacing(12)
|
||||||
|
|
||||||
|
self._add_section(
|
||||||
|
content_layout,
|
||||||
|
"Сеть",
|
||||||
|
[
|
||||||
|
("Wi-Fi", "Доступные сети и подключение"),
|
||||||
|
("Bluetooth", "Сопряжение и устройства"),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
self._add_section(
|
||||||
|
content_layout,
|
||||||
|
"Система",
|
||||||
|
[
|
||||||
|
("Об устройстве", "Версия, память, серийный номер"),
|
||||||
|
("Параметры разработчика", "Отладка и логирование"),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
self._add_section(
|
||||||
|
content_layout,
|
||||||
|
"Дисплей и звук",
|
||||||
|
[
|
||||||
|
("Экран", "Яркость, сон, тема"),
|
||||||
|
("Звук", "Громкость, эквалайзер"),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
content_layout.addStretch(1)
|
||||||
|
scroll.setWidget(content)
|
||||||
|
root.addWidget(scroll, 1)
|
||||||
|
|
||||||
|
def _add_section(self, root: QVBoxLayout, title: str, items: list[tuple[str, str]]):
|
||||||
|
section = QLabel(title)
|
||||||
|
section.setObjectName("SettingsSection")
|
||||||
|
section.setFont(QFont("", 14, 700))
|
||||||
|
section.setContentsMargins(2, 8, 2, 0)
|
||||||
|
root.addWidget(section)
|
||||||
|
|
||||||
|
for row_title, row_subtitle in items:
|
||||||
|
root.addWidget(SettingsRow(row_title, row_subtitle))
|
||||||
@ -2,4 +2,15 @@ THEME_DAY = """
|
|||||||
QWidget { background: #F4F6F8; color: #111827; }
|
QWidget { background: #F4F6F8; color: #111827; }
|
||||||
#TopBar, #BottomBar { background: #FFFFFF; }
|
#TopBar, #BottomBar { background: #FFFFFF; }
|
||||||
#Divider { background: #E5E7EB; }
|
#Divider { background: #E5E7EB; }
|
||||||
|
|
||||||
|
#SettingsSection { color: rgba(55,65,81,0.9); letter-spacing: 0.5px; }
|
||||||
|
#SettingsRow {
|
||||||
|
background: #FFFFFF;
|
||||||
|
border-radius: 14px;
|
||||||
|
border: 1px solid #E5E7EB;
|
||||||
|
}
|
||||||
|
#SettingsRow:hover { background: #F9FAFB; }
|
||||||
|
#SettingsRowTitle { color: #111827; }
|
||||||
|
#SettingsRowSub { color: rgba(107,114,128,0.95); }
|
||||||
|
#SettingsChevron { color: rgba(107,114,128,0.95); }
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -2,4 +2,14 @@ THEME_NIGHT = """
|
|||||||
QWidget { background: #0B0E11; color: #E6EAF0; }
|
QWidget { background: #0B0E11; color: #E6EAF0; }
|
||||||
#TopBar, #BottomBar { background: #0F1318; }
|
#TopBar, #BottomBar { background: #0F1318; }
|
||||||
#Divider { background: #1B2330; }
|
#Divider { background: #1B2330; }
|
||||||
|
|
||||||
|
#SettingsSection { color: rgba(138,147,166,0.95); letter-spacing: 0.5px; }
|
||||||
|
#SettingsRow {
|
||||||
|
background: #141A22;
|
||||||
|
border-radius: 14px;
|
||||||
|
}
|
||||||
|
#SettingsRow:hover { background: #1B2330; }
|
||||||
|
#SettingsRowTitle { color: #E6EAF0; }
|
||||||
|
#SettingsRowSub { color: rgba(138,147,166,0.95); }
|
||||||
|
#SettingsChevron { color: rgba(138,147,166,0.95); }
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -5,6 +5,7 @@ from ui.components.divider import divider
|
|||||||
from ui.components.nav_button import NavButton
|
from ui.components.nav_button import NavButton
|
||||||
from screens.home import HomeScreen
|
from screens.home import HomeScreen
|
||||||
from screens.stub import StubScreen
|
from screens.stub import StubScreen
|
||||||
|
from screens.settings import SettingsScreen
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from PySide6.QtWidgets import (
|
from PySide6.QtWidgets import (
|
||||||
QApplication, QMainWindow, QWidget, QLabel, QPushButton,
|
QApplication, QMainWindow, QWidget, QLabel, QPushButton,
|
||||||
@ -73,7 +74,7 @@ class MainWindow(QMainWindow):
|
|||||||
self.stack.addWidget(StubScreen("Media")) # 1
|
self.stack.addWidget(StubScreen("Media")) # 1
|
||||||
self.stack.addWidget(StubScreen("Car")) # 2
|
self.stack.addWidget(StubScreen("Car")) # 2
|
||||||
self.stack.addWidget(StubScreen("Maps")) # 3
|
self.stack.addWidget(StubScreen("Maps")) # 3
|
||||||
self.stack.addWidget(StubScreen("Settings")) # 4
|
self.stack.addWidget(SettingsScreen()) # 4
|
||||||
|
|
||||||
# Bottom bar (nav)
|
# Bottom bar (nav)
|
||||||
self.bottombar = QWidget()
|
self.bottombar = QWidget()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user