|
|
@ -1,10 +1,11 @@ |
|
|
|
import pyray as rl |
|
|
|
import pyray as rl |
|
|
|
from openpilot.selfdrive.ui.ui_state import ui_state |
|
|
|
from openpilot.selfdrive.ui.ui_state import ui_state |
|
|
|
from openpilot.selfdrive.ui.widgets.pairing_dialog import PairingDialog |
|
|
|
from openpilot.selfdrive.ui.widgets.pairing_dialog import PairingDialog |
|
|
|
from openpilot.system.ui.lib.application import gui_app, FontWeight |
|
|
|
from openpilot.system.ui.lib.application import gui_app, FontWeight, FONT_SCALE |
|
|
|
from openpilot.system.ui.lib.wrap_text import wrap_text |
|
|
|
from openpilot.system.ui.lib.wrap_text import wrap_text |
|
|
|
from openpilot.system.ui.widgets import Widget |
|
|
|
from openpilot.system.ui.widgets import Widget |
|
|
|
from openpilot.system.ui.widgets.button import Button, ButtonStyle |
|
|
|
from openpilot.system.ui.widgets.button import Button, ButtonStyle |
|
|
|
|
|
|
|
from openpilot.system.ui.widgets.label import Label |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SetupWidget(Widget): |
|
|
|
class SetupWidget(Widget): |
|
|
@ -15,6 +16,7 @@ class SetupWidget(Widget): |
|
|
|
self._pair_device_btn = Button("Pair device", self._show_pairing, button_style=ButtonStyle.PRIMARY) |
|
|
|
self._pair_device_btn = Button("Pair device", self._show_pairing, button_style=ButtonStyle.PRIMARY) |
|
|
|
self._open_settings_btn = Button("Open", lambda: self._open_settings_callback() if self._open_settings_callback else None, |
|
|
|
self._open_settings_btn = Button("Open", lambda: self._open_settings_callback() if self._open_settings_callback else None, |
|
|
|
button_style=ButtonStyle.PRIMARY) |
|
|
|
button_style=ButtonStyle.PRIMARY) |
|
|
|
|
|
|
|
self._firehose_label = Label("🔥Firehose Mode 🔥", font_weight=FontWeight.MEDIUM, font_size=64) |
|
|
|
|
|
|
|
|
|
|
|
def set_open_settings_callback(self, callback): |
|
|
|
def set_open_settings_callback(self, callback): |
|
|
|
self._open_settings_callback = callback |
|
|
|
self._open_settings_callback = callback |
|
|
@ -53,7 +55,7 @@ class SetupWidget(Widget): |
|
|
|
def _render_firehose_prompt(self, rect: rl.Rectangle): |
|
|
|
def _render_firehose_prompt(self, rect: rl.Rectangle): |
|
|
|
"""Render firehose prompt widget.""" |
|
|
|
"""Render firehose prompt widget.""" |
|
|
|
|
|
|
|
|
|
|
|
rl.draw_rectangle_rounded(rl.Rectangle(rect.x, rect.y, rect.width, 450), 0.02, 20, rl.Color(51, 51, 51, 255)) |
|
|
|
rl.draw_rectangle_rounded(rl.Rectangle(rect.x, rect.y, rect.width, 500), 0.02, 20, rl.Color(51, 51, 51, 255)) |
|
|
|
|
|
|
|
|
|
|
|
# Content margins (56, 40, 56, 40) |
|
|
|
# Content margins (56, 40, 56, 40) |
|
|
|
x = rect.x + 56 |
|
|
|
x = rect.x + 56 |
|
|
@ -62,9 +64,8 @@ class SetupWidget(Widget): |
|
|
|
spacing = 42 |
|
|
|
spacing = 42 |
|
|
|
|
|
|
|
|
|
|
|
# Title with fire emojis |
|
|
|
# Title with fire emojis |
|
|
|
title_font = gui_app.font(FontWeight.MEDIUM) |
|
|
|
# TODO: fix Label centering with emojis |
|
|
|
title_text = "Firehose Mode" |
|
|
|
self._firehose_label.render(rl.Rectangle(x - 40, y, w, 64)) |
|
|
|
rl.draw_text_ex(title_font, title_text, rl.Vector2(x, y), 64, 0, rl.WHITE) |
|
|
|
|
|
|
|
y += 64 + spacing |
|
|
|
y += 64 + spacing |
|
|
|
|
|
|
|
|
|
|
|
# Description |
|
|
|
# Description |
|
|
@ -74,7 +75,7 @@ class SetupWidget(Widget): |
|
|
|
|
|
|
|
|
|
|
|
for line in wrapped_desc: |
|
|
|
for line in wrapped_desc: |
|
|
|
rl.draw_text_ex(desc_font, line, rl.Vector2(x, y), 40, 0, rl.WHITE) |
|
|
|
rl.draw_text_ex(desc_font, line, rl.Vector2(x, y), 40, 0, rl.WHITE) |
|
|
|
y += 40 |
|
|
|
y += 40 * FONT_SCALE |
|
|
|
|
|
|
|
|
|
|
|
y += spacing |
|
|
|
y += spacing |
|
|
|
|
|
|
|
|
|
|
|