mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-21 00:03:45 +08:00
raylib: minor tweaks (#36507)
* try * generic * check * why was this here?!
This commit is contained in:
@@ -11,21 +11,10 @@ from openpilot.system.ui.lib.application import FontWeight, gui_app
|
||||
from openpilot.system.ui.lib.multilang import tr
|
||||
from openpilot.system.ui.lib.wrap_text import wrap_text
|
||||
from openpilot.system.ui.lib.text_measure import measure_text_cached
|
||||
from openpilot.system.ui.widgets.button import IconButton
|
||||
from openpilot.selfdrive.ui.ui_state import ui_state
|
||||
|
||||
|
||||
class IconButton(Widget):
|
||||
def __init__(self, texture: rl.Texture):
|
||||
super().__init__()
|
||||
self._texture = texture
|
||||
|
||||
def _render(self, rect: rl.Rectangle):
|
||||
color = rl.Color(180, 180, 180, 150) if self.is_pressed else rl.WHITE
|
||||
draw_x = rect.x + (rect.width - self._texture.width) / 2
|
||||
draw_y = rect.y + (rect.height - self._texture.height) / 2
|
||||
rl.draw_texture(self._texture, int(draw_x), int(draw_y), color)
|
||||
|
||||
|
||||
class PairingDialog(Widget):
|
||||
"""Dialog for device pairing with QR code."""
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class PrimeWidget(Widget):
|
||||
|
||||
# Description with wrapping
|
||||
desc_y = y + 140
|
||||
font = gui_app.font(FontWeight.LIGHT)
|
||||
font = gui_app.font(FontWeight.NORMAL)
|
||||
wrapped_text = "\n".join(wrap_text(font, tr("Become a comma prime member at connect.comma.ai"), 56, int(w)))
|
||||
text_size = measure_text_cached(font, wrapped_text, 56)
|
||||
rl.draw_text_ex(font, wrapped_text, rl.Vector2(x, desc_y), 56, 0, rl.WHITE)
|
||||
|
||||
@@ -46,7 +46,7 @@ class SetupWidget(Widget):
|
||||
|
||||
# Description
|
||||
desc = tr("Pair your device with comma connect (connect.comma.ai) and claim your comma prime offer.")
|
||||
light_font = gui_app.font(FontWeight.LIGHT)
|
||||
light_font = gui_app.font(FontWeight.NORMAL)
|
||||
wrapped = wrap_text(light_font, desc, 50, int(w))
|
||||
for line in wrapped:
|
||||
rl.draw_text_ex(light_font, line, rl.Vector2(x, y), 50, 0, rl.WHITE)
|
||||
|
||||
Reference in New Issue
Block a user