update design bl
This commit is contained in:
parent
5a420b5031
commit
848a9e464c
@ -17,6 +17,7 @@ def build_dev_screen(on_exit) -> QWidget:
|
||||
|
||||
layout.addWidget(_build_persist_toggle())
|
||||
layout.addWidget(_build_sound_toggles())
|
||||
layout.addWidget(_build_mock_devices_toggle())
|
||||
|
||||
hdr = QHBoxLayout()
|
||||
hdr.setContentsMargins(0, 0, 0, 0)
|
||||
@ -164,6 +165,48 @@ def _dev_flag_path() -> Path:
|
||||
return Path(build_info.__file__).resolve().parent / "dev_mode_enable"
|
||||
|
||||
|
||||
def _mock_devices_flag_path() -> Path:
|
||||
return Path(build_info.__file__).resolve().parent / "mock_devices_enable"
|
||||
|
||||
|
||||
def _build_mock_devices_toggle() -> QWidget:
|
||||
row = QWidget()
|
||||
layout = QHBoxLayout(row)
|
||||
layout.setContentsMargins(12, 6, 12, 6)
|
||||
layout.setSpacing(12)
|
||||
|
||||
lbl = QLabel("Mock Bluetooth устройства (debug)")
|
||||
lbl.setFont(QFont("", 14, 600))
|
||||
|
||||
btn = QPushButton("Выкл")
|
||||
btn.setObjectName("SoundToggle")
|
||||
btn.setCheckable(True)
|
||||
btn.setChecked(_mock_devices_flag_path().exists())
|
||||
btn.setMinimumHeight(40)
|
||||
btn.setMinimumWidth(110)
|
||||
btn.setFont(QFont("", 12, 700))
|
||||
|
||||
def _sync_text(is_checked: bool):
|
||||
btn.setText("Вкл" if is_checked else "Выкл")
|
||||
|
||||
def _persist_flag(is_checked: bool):
|
||||
flag_path = _mock_devices_flag_path()
|
||||
if is_checked:
|
||||
flag_path.touch(exist_ok=True)
|
||||
else:
|
||||
if flag_path.exists():
|
||||
flag_path.unlink()
|
||||
|
||||
btn.toggled.connect(_sync_text)
|
||||
btn.toggled.connect(_persist_flag)
|
||||
_sync_text(btn.isChecked())
|
||||
|
||||
layout.addWidget(lbl)
|
||||
layout.addStretch(1)
|
||||
layout.addWidget(btn)
|
||||
return row
|
||||
|
||||
|
||||
def _confirm_exit(on_exit):
|
||||
dialog = ConfirmDialog(
|
||||
"Подтверждение",
|
||||
|
||||
@ -11,7 +11,11 @@ from PySide6.QtCore import QObject, Signal
|
||||
|
||||
import build_info
|
||||
|
||||
MOCK_PAIRED_DEVICED = True
|
||||
|
||||
def _is_mock_devices_enabled() -> bool:
|
||||
"""Проверить, включён ли режим мок-устройств."""
|
||||
flag_path = Path(build_info.__file__).resolve().parent / "mock_devices_enable"
|
||||
return flag_path.exists()
|
||||
|
||||
|
||||
@dataclass
|
||||
@ -50,7 +54,7 @@ class BluetoothService(QObject):
|
||||
devices.append(BluetoothDevice(mac=mac, name=name))
|
||||
|
||||
# DEBUG: мок устройств для тестирования лимита
|
||||
if MOCK_PAIRED_DEVICED:
|
||||
if _is_mock_devices_enabled():
|
||||
real_count = len(devices)
|
||||
missing = build_info.BLUETOOTH_MAX_PAIRED_DEVICES - real_count
|
||||
for i in range(missing):
|
||||
|
||||
@ -150,6 +150,9 @@ QScrollArea > QWidget > QWidget { background: transparent; }
|
||||
#BluetoothList::item:hover { background: transparent; border: 0; outline: 0; }
|
||||
#BluetoothList::item:selected { background: transparent; border: 0; outline: 0; }
|
||||
#BluetoothList::item:focus { background: transparent; border: 0; outline: 0; }
|
||||
#BluetoothList::scroll-bar { width: 0px; background: transparent; }
|
||||
#BluetoothList::scroll-bar:vertical { width: 0px; }
|
||||
#BluetoothList::scroll-bar:horizontal { height: 0px; }
|
||||
#BluetoothDeviceCard {
|
||||
background: #FFFFFF;
|
||||
border-radius: 14px;
|
||||
|
||||
@ -140,6 +140,9 @@ QScrollArea > QWidget > QWidget { background: transparent; }
|
||||
#BluetoothList::item:hover { background: transparent; border: 0; outline: 0; }
|
||||
#BluetoothList::item:selected { background: transparent; border: 0; outline: 0; }
|
||||
#BluetoothList::item:focus { background: transparent; border: 0; outline: 0; }
|
||||
#BluetoothList::scroll-bar { width: 0px; background: transparent; }
|
||||
#BluetoothList::scroll-bar:vertical { width: 0px; }
|
||||
#BluetoothList::scroll-bar:horizontal { height: 0px; }
|
||||
#BluetoothDeviceCard {
|
||||
background: #141A22;
|
||||
border-radius: 14px;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user