mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-11-13 07:53:45 +08:00
48 lines
2.6 KiB
Diff
48 lines
2.6 KiB
Diff
diff --git a/selfdrive/ui/layouts/settings/settings.py b/selfdrive/ui/layouts/settings/settings.py
|
|
--- a/selfdrive/ui/layouts/settings/settings.py
|
|
+++ b/selfdrive/ui/layouts/settings/settings.py
|
|
@@ -16,6 +16,7 @@
|
|
from openpilot.system.ui.widgets import Widget
|
|
from openpilot.system.ui.widgets.bluetooth import BluetoothManagerUI
|
|
from openpilot.system.ui.widgets.network import NetworkUI
|
|
+from openpilot.tools.galaxy_bluetooth.comma_pairing_tici import pair_phone_item
|
|
|
|
# Constants
|
|
COLLAPSED_WIDTH = 0
|
|
@@ -80,7 +81,7 @@
|
|
PanelType.STARPILOT: PanelInfo(tr_noop("StarPilot"), StarPilotLayout()),
|
|
PanelType.DEVICE: PanelInfo(tr_noop("Device"), DeviceLayout()),
|
|
PanelType.NETWORK: PanelInfo(tr_noop("Network"), NetworkUI(wifi_manager)),
|
|
- PanelType.BLUETOOTH: PanelInfo(tr_noop("Bluetooth"), BluetoothManagerUI(bluetooth_manager)),
|
|
+ PanelType.BLUETOOTH: PanelInfo(tr_noop("Bluetooth"), BluetoothManagerUI(bluetooth_manager, phone_pairing=pair_phone_item())),
|
|
PanelType.TOGGLES: PanelInfo(tr_noop("Toggles"), TogglesLayout()),
|
|
PanelType.SOFTWARE: PanelInfo(tr_noop("Software"), SoftwareLayout()),
|
|
PanelType.DEVELOPER: PanelInfo(tr_noop("Developer"), DeveloperLayout()),
|
|
diff --git a/system/ui/widgets/bluetooth.py b/system/ui/widgets/bluetooth.py
|
|
--- a/system/ui/widgets/bluetooth.py
|
|
+++ b/system/ui/widgets/bluetooth.py
|
|
@@ -177,8 +177,9 @@
|
|
|
|
class BluetoothManagerUI(Widget):
|
|
"""Big UI Bluetooth settings panel backed by the existing Bluetooth manager daemon."""
|
|
- def __init__(self, manager: BluetoothManager):
|
|
+ def __init__(self, manager: BluetoothManager, phone_pairing: Widget | None = None):
|
|
super().__init__()
|
|
+ self._phone_pairing = phone_pairing
|
|
self._manager = manager
|
|
self._scroll_panel = GuiScrollPanel()
|
|
self._power_toggle = Toggle(initial_state=False, callback=self._toggle_power)
|
|
@@ -378,7 +379,11 @@
|
|
header_rect = rl.Rectangle(rect.x, rect.y, rect.width, HEADER_HEIGHT)
|
|
self._render_header(header_rect, status)
|
|
|
|
- content_rect = rl.Rectangle(rect.x, rect.y + HEADER_HEIGHT, rect.width, rect.height - HEADER_HEIGHT)
|
|
+ content_y = rect.y + HEADER_HEIGHT
|
|
+ if self._phone_pairing is not None:
|
|
+ self._phone_pairing.render(rl.Rectangle(rect.x + HEADER_PADDING, content_y, rect.width - 2 * HEADER_PADDING, ITEM_HEIGHT))
|
|
+ content_y += ITEM_HEIGHT
|
|
+ content_rect = rl.Rectangle(rect.x, content_y, rect.width, rect.y + rect.height - content_y)
|
|
if not status.available:
|
|
gui_label(content_rect, tr("Bluetooth is not available on this device."), font_size=62,
|
|
color=TEXT_SECONDARY, alignment=rl.GuiTextAlignment.TEXT_ALIGN_CENTER)
|