mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-23 01:04:01 +08:00
BigUI WIP: Boop
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -22,12 +22,6 @@ from openpilot.selfdrive.ui.layouts.settings.starpilot.aethergrid import (
|
||||
TileGrid,
|
||||
HubTile,
|
||||
draw_list_group_shell,
|
||||
_draw_rounded_fill,
|
||||
_draw_rounded_stroke,
|
||||
_point_hits,
|
||||
_snap_rect,
|
||||
_mix_colors,
|
||||
_with_alpha,
|
||||
hex_to_color,
|
||||
PLATE_TAU,
|
||||
AetherListColors,
|
||||
|
||||
@@ -38,7 +38,7 @@ from openpilot.selfdrive.ui.layouts.settings.starpilot.aethergrid import (
|
||||
AetherListColors,
|
||||
AetherScrollbar,
|
||||
DEFAULT_PANEL_STYLE,
|
||||
_point_hits,
|
||||
point_hits,
|
||||
draw_action_rail,
|
||||
draw_action_pill,
|
||||
draw_busy_ring,
|
||||
@@ -59,13 +59,11 @@ from openpilot.selfdrive.ui.layouts.settings.starpilot.aethergrid import (
|
||||
draw_interactive_rect,
|
||||
resolve_interactive_target,
|
||||
wrap_text,
|
||||
SECTION_GAP,
|
||||
SECTION_HEADER_HEIGHT,
|
||||
SECTION_HEADER_GAP,
|
||||
ROW_HEIGHT,
|
||||
)
|
||||
|
||||
|
||||
SECTION_GAP = AETHER_LIST_METRICS.section_gap
|
||||
SECTION_HEADER_HEIGHT = AETHER_LIST_METRICS.section_header_height
|
||||
SECTION_HEADER_GAP = AETHER_LIST_METRICS.section_header_gap
|
||||
ROW_HEIGHT = AETHER_LIST_METRICS.row_height
|
||||
UTILITY_ROW_HEIGHT = AETHER_LIST_METRICS.utility_row_height
|
||||
ROW_RADIUS = AETHER_LIST_METRICS.row_radius
|
||||
ACTION_WIDTH = AETHER_LIST_METRICS.action_width
|
||||
@@ -199,7 +197,7 @@ class DrivingModelManagerView(AetherInteractiveMixin, Widget):
|
||||
for target_id, rect in self._interactive_rects.items():
|
||||
if target_id.startswith(prefix):
|
||||
pad_y = 6 if prefix == "menu:" else 0
|
||||
if _point_hits(mouse_pos, rect, self._scroll_rect, pad_x=6, pad_y=pad_y):
|
||||
if point_hits(mouse_pos, rect, self._scroll_rect, pad_x=6, pad_y=pad_y):
|
||||
return target_id
|
||||
return None
|
||||
|
||||
@@ -386,7 +384,7 @@ class DrivingModelManagerView(AetherInteractiveMixin, Widget):
|
||||
|
||||
def _draw_model_row(self, rect: rl.Rectangle, entry: ModelCatalogEntry, is_last: bool):
|
||||
mouse_pos = gui_app.last_mouse_event.pos
|
||||
row_hovered = bool(_point_hits(mouse_pos, rect, self._scroll_rect, pad_x=6, pad_y=0))
|
||||
row_hovered = bool(point_hits(mouse_pos, rect, self._scroll_rect, pad_x=6, pad_y=0))
|
||||
target_key = f"row:{entry.key}"
|
||||
pressed = self._pressed_target == target_key
|
||||
current = self._controller.is_current_model(entry.key)
|
||||
@@ -559,7 +557,7 @@ class DrivingModelManagerView(AetherInteractiveMixin, Widget):
|
||||
|
||||
def _draw_utility_row(self, rect: rl.Rectangle, row: dict, is_last: bool):
|
||||
mouse_pos = gui_app.last_mouse_event.pos
|
||||
hovered = bool(_point_hits(mouse_pos, rect, self._scroll_rect, pad_x=6, pad_y=0))
|
||||
hovered = bool(point_hits(mouse_pos, rect, self._scroll_rect, pad_x=6, pad_y=0))
|
||||
pressed = self._pressed_target == f"utility:{row['id']}"
|
||||
self._interactive_rects[f"utility:{row['id']}"] = rect
|
||||
draw_settings_list_row(
|
||||
|
||||
@@ -14,16 +14,11 @@ from openpilot.selfdrive.ui.layouts.settings.starpilot.aethergrid import (
|
||||
AetherListMetrics,
|
||||
AetherSettingsView,
|
||||
AetherSliderDialog,
|
||||
BACK_BTN,
|
||||
DEFAULT_PANEL_STYLE,
|
||||
HubTile,
|
||||
SettingRow,
|
||||
SettingSection,
|
||||
TileGrid,
|
||||
_draw_back_button,
|
||||
_draw_rounded_fill,
|
||||
_draw_rounded_stroke,
|
||||
_point_hits,
|
||||
)
|
||||
|
||||
|
||||
@@ -68,49 +63,6 @@ def _sync_parent(params, parent_key, child_keys):
|
||||
params.put_bool(parent_key, False)
|
||||
|
||||
|
||||
class _BackButtonSettingsView(AetherSettingsView):
|
||||
"""AetherSettingsView with a back button pill drawn in the scroll content header."""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self._back_btn_rect = None
|
||||
self._has_header = False
|
||||
|
||||
def _target_at(self, mouse_pos):
|
||||
if self._back_btn_rect and _point_hits(mouse_pos, self._back_btn_rect, None, pad_x=8, pad_y=8):
|
||||
return BACK_BTN
|
||||
return super()._target_at(mouse_pos)
|
||||
|
||||
def _activate_target(self, target_id):
|
||||
if target_id == BACK_BTN:
|
||||
self._controller._go_back()
|
||||
else:
|
||||
super()._activate_target(target_id)
|
||||
|
||||
def _draw_scroll_content(self, rect, width):
|
||||
pill_h = 52
|
||||
y = rect.y + self._scroll_offset
|
||||
pill_rect = rl.Rectangle(rect.x, y, rect.width, pill_h)
|
||||
center_y = pill_rect.y + pill_h / 2
|
||||
|
||||
_draw_rounded_fill(pill_rect, rl.Color(18, 16, 24, 200), radius_px=14)
|
||||
_draw_rounded_stroke(pill_rect, rl.Color(255, 255, 255, 22), radius_px=14)
|
||||
|
||||
mouse_pos = gui_app.last_mouse_event.pos
|
||||
is_pressed = getattr(self, '_pressed_target', None) == BACK_BTN
|
||||
is_hovered = _point_hits(mouse_pos, pill_rect, None, pad_x=0, pad_y=0) and \
|
||||
self._back_btn_rect and _point_hits(mouse_pos, self._back_btn_rect, None, pad_x=8, pad_y=8)
|
||||
self._back_btn_rect = _draw_back_button(pill_rect, center_y, is_pressed, is_hovered)
|
||||
|
||||
crumb_x = pill_rect.x + 58
|
||||
crumb_w = pill_rect.width - (crumb_x - pill_rect.x) - 20
|
||||
crumb_rect = rl.Rectangle(crumb_x, pill_rect.y, crumb_w, pill_h)
|
||||
self._breadcrumbs.draw(crumb_rect)
|
||||
|
||||
self._scroll_offset += pill_h + 12
|
||||
super()._draw_scroll_content(rect, width)
|
||||
|
||||
|
||||
class SteeringManagerView(AetherSettingsView):
|
||||
"""Hub view with 3 category tiles leading to sub-panels."""
|
||||
|
||||
@@ -385,7 +337,7 @@ class StarPilotLateralLayout(_SettingsPage):
|
||||
]
|
||||
|
||||
# ── Build sub-panels ──
|
||||
self._sub_panels["steering_behavior"] = _BackButtonSettingsView(
|
||||
self._sub_panels["steering_behavior"] = AetherSettingsView(
|
||||
self,
|
||||
[SettingSection(tr("Steering Behavior"), self._steering_behavior_rows, row_height=ROW_HEIGHT)],
|
||||
header_title=tr("Steering Behavior"),
|
||||
@@ -394,7 +346,7 @@ class StarPilotLateralLayout(_SettingsPage):
|
||||
metrics=CUSTOM_METRICS,
|
||||
)
|
||||
|
||||
self._sub_panels["lane_changes"] = _BackButtonSettingsView(
|
||||
self._sub_panels["lane_changes"] = AetherSettingsView(
|
||||
self,
|
||||
[SettingSection(tr("Lane Changes"), self._lane_change_rows, row_height=ROW_HEIGHT)],
|
||||
header_title=tr("Lane Changes"),
|
||||
@@ -403,7 +355,7 @@ class StarPilotLateralLayout(_SettingsPage):
|
||||
metrics=CUSTOM_METRICS,
|
||||
)
|
||||
|
||||
self._sub_panels["tuning"] = _BackButtonSettingsView(
|
||||
self._sub_panels["tuning"] = AetherSettingsView(
|
||||
self,
|
||||
[SettingSection(tr("Advanced Lateral Tuning"), self._tuning_rows, row_height=ROW_HEIGHT)],
|
||||
header_title=tr("Advanced Lateral Tuning"),
|
||||
|
||||
@@ -17,7 +17,7 @@ from openpilot.selfdrive.ui.layouts.settings.starpilot.system_settings import St
|
||||
from openpilot.selfdrive.ui.layouts.settings.starpilot.appearance import StarPilotAppearanceLayout
|
||||
from openpilot.selfdrive.ui.layouts.settings.starpilot.vehicle import StarPilotVehicleSettingsLayout
|
||||
|
||||
from openpilot.selfdrive.ui.layouts.settings.starpilot.aethergrid import TileGrid, HubTile, RadioTileGroup, SPACING, BreadcrumbController
|
||||
from openpilot.selfdrive.ui.layouts.settings.starpilot.aethergrid import TileGrid, HubTile, SPACING, BreadcrumbController, AETHER_LIST_METRICS, draw_rounded_fill, draw_rounded_stroke
|
||||
|
||||
class StarPilotLayout(Widget):
|
||||
CATEGORIES = [
|
||||
@@ -237,14 +237,11 @@ class StarPilotLayout(Widget):
|
||||
self._update_depth()
|
||||
|
||||
def _render(self, rect: rl.Rectangle):
|
||||
import openpilot.selfdrive.ui.layouts.settings.starpilot.aethergrid as aethergrid
|
||||
metrics = aethergrid.AETHER_LIST_METRICS
|
||||
|
||||
TOP_BAR_HEIGHT = 80
|
||||
content_rect = rl.Rectangle(rect.x, rect.y + TOP_BAR_HEIGHT, rect.width, rect.height - TOP_BAR_HEIGHT)
|
||||
|
||||
# Standardize width to perfectly match subpanel shells
|
||||
shell_w = min(rect.width - metrics.outer_margin_x * 2, metrics.max_content_width)
|
||||
shell_w = min(rect.width - AETHER_LIST_METRICS.outer_margin_x * 2, AETHER_LIST_METRICS.max_content_width)
|
||||
shell_x = rect.x + (rect.width - shell_w) / 2
|
||||
|
||||
# 0. Draw top bar with HubTile-style purple glow
|
||||
@@ -255,13 +252,13 @@ class StarPilotLayout(Widget):
|
||||
off = i * 2.5
|
||||
gr = rl.Rectangle(glass_rect.x - off, glass_rect.y - off, glass_rect.width + off * 2, glass_rect.height + off * 2)
|
||||
a = int(25 * (1.0 - i / 5))
|
||||
aethergrid._draw_rounded_fill(gr, rl.Color(139, 92, 246, max(0, min(255, a))), radius_px=100)
|
||||
draw_rounded_fill(gr, rl.Color(139, 92, 246, max(0, min(255, a))), radius_px=100)
|
||||
|
||||
# 0b. Dark fill — strict parity with HubTile _HUD_BG_ON
|
||||
aethergrid._draw_rounded_fill(glass_rect, rl.Color(12, 10, 18, 255), radius_px=100)
|
||||
draw_rounded_fill(glass_rect, rl.Color(12, 10, 18, 255), radius_px=100)
|
||||
|
||||
# 0c. Full bright purple border — strict parity
|
||||
aethergrid._draw_rounded_stroke(glass_rect, rl.Color(139, 92, 246, 255), radius_px=100)
|
||||
draw_rounded_stroke(glass_rect, rl.Color(139, 92, 246, 255), radius_px=100)
|
||||
|
||||
# 1. Draw breadcrumbs in top bar
|
||||
crumb_rect = rl.Rectangle(glass_rect.x, glass_rect.y, glass_rect.width, glass_rect.height)
|
||||
@@ -269,7 +266,7 @@ class StarPilotLayout(Widget):
|
||||
|
||||
# 4. Render active content panel
|
||||
if self._current_panel == StarPilotPanelType.MAIN:
|
||||
grid_rect = rl.Rectangle(shell_x, content_rect.y + metrics.outer_margin_y, shell_w, content_rect.height - metrics.outer_margin_y * 2)
|
||||
grid_rect = rl.Rectangle(shell_x, content_rect.y + AETHER_LIST_METRICS.outer_margin_y, shell_w, content_rect.height - AETHER_LIST_METRICS.outer_margin_y * 2)
|
||||
self._main_grid.render(grid_rect)
|
||||
else:
|
||||
panel = self._panels[self._current_panel]
|
||||
|
||||
@@ -39,7 +39,7 @@ from openpilot.selfdrive.ui.layouts.settings.starpilot.aethergrid import (
|
||||
draw_settings_panel_header,
|
||||
draw_soft_card,
|
||||
init_list_panel,
|
||||
_point_hits,
|
||||
point_hits,
|
||||
wrap_text,
|
||||
)
|
||||
from openpilot.selfdrive.ui.layouts.settings.starpilot.panel import StarPilotPanel
|
||||
@@ -164,13 +164,13 @@ class MapStatusCard(Widget):
|
||||
def _handle_mouse_press(self, mouse_pos: MousePos):
|
||||
if not self._touch_valid():
|
||||
return
|
||||
if _point_hits(mouse_pos, self._remove_rect, pad_x=10, pad_y=6) and self._controller._remove_enabled():
|
||||
if point_hits(mouse_pos, self._remove_rect, pad_x=10, pad_y=6) and self._controller._remove_enabled():
|
||||
self._pressed_remove = True
|
||||
|
||||
def _handle_mouse_release(self, mouse_pos: MousePos):
|
||||
if self._pressed_remove:
|
||||
self._pressed_remove = False
|
||||
if self._touch_valid() and _point_hits(mouse_pos, self._remove_rect, pad_x=10, pad_y=6) and self._controller._remove_enabled():
|
||||
if self._touch_valid() and point_hits(mouse_pos, self._remove_rect, pad_x=10, pad_y=6) and self._controller._remove_enabled():
|
||||
self._controller._on_remove()
|
||||
|
||||
def _render(self, rect: rl.Rectangle):
|
||||
@@ -311,13 +311,13 @@ class MapBrowserCard(Widget):
|
||||
if parent_rect is not None and not rl.check_collision_point_rec(mouse_pos, parent_rect):
|
||||
return None
|
||||
for source_key, rect in self._source_rects.items():
|
||||
if _point_hits(mouse_pos, rect, parent_rect, pad_x=6, pad_y=6):
|
||||
if point_hits(mouse_pos, rect, parent_rect, pad_x=6, pad_y=6):
|
||||
return f"source:{source_key}"
|
||||
for group_key, rect in self._context_tab_rects.items():
|
||||
if _point_hits(mouse_pos, rect, parent_rect, pad_x=4, pad_y=4):
|
||||
if point_hits(mouse_pos, rect, parent_rect, pad_x=4, pad_y=4):
|
||||
return f"group:{group_key}"
|
||||
for token, rect in self._region_row_rects.items():
|
||||
if _point_hits(mouse_pos, rect, parent_rect, pad_x=6, pad_y=0):
|
||||
if point_hits(mouse_pos, rect, parent_rect, pad_x=6, pad_y=0):
|
||||
return f"region:{token}"
|
||||
return None
|
||||
|
||||
@@ -344,7 +344,7 @@ class MapBrowserCard(Widget):
|
||||
for index, (source_key, title) in enumerate(sources):
|
||||
button_rect = rl.Rectangle(rect.x + index * (button_w + BROWSER_TAB_GAP), rect.y, button_w, BROWSER_CONTEXT_TAB_HEIGHT)
|
||||
self._source_rects[source_key] = button_rect
|
||||
hovered = _point_hits(mouse_pos, button_rect, self._parent_rect, pad_x=6, pad_y=6)
|
||||
hovered = point_hits(mouse_pos, button_rect, self._parent_rect, pad_x=6, pad_y=6)
|
||||
pressed = self._pressed_target == f"source:{source_key}"
|
||||
current = self._controller._active_source_key() == source_key
|
||||
|
||||
@@ -383,7 +383,7 @@ class MapBrowserCard(Widget):
|
||||
tab_rect = rl.Rectangle(rect.x + index * (tab_w + tab_gap), rect.y, tab_w, BROWSER_CONTEXT_TAB_HEIGHT)
|
||||
self._context_tab_rects[group["key"]] = tab_rect
|
||||
current = self._controller._active_tab_key() == group["key"]
|
||||
hovered = _point_hits(mouse_pos, tab_rect, self._parent_rect, pad_x=4, pad_y=4)
|
||||
hovered = point_hits(mouse_pos, tab_rect, self._parent_rect, pad_x=4, pad_y=4)
|
||||
pressed = self._pressed_target == f"group:{group['key']}"
|
||||
|
||||
draw_tab_card(
|
||||
@@ -426,7 +426,7 @@ class MapBrowserCard(Widget):
|
||||
selected = self._controller._get_map_state(token)
|
||||
row_rect = rl.Rectangle(rect.x, rect.y + index * BROWSER_REGION_ROW_HEIGHT, rect.width, BROWSER_REGION_ROW_HEIGHT)
|
||||
self._region_row_rects[token] = row_rect
|
||||
hovered = _point_hits(mouse_pos, row_rect, self._parent_rect, pad_x=6, pad_y=0)
|
||||
hovered = point_hits(mouse_pos, row_rect, self._parent_rect, pad_x=6, pad_y=0)
|
||||
target_key = f"region:{token}"
|
||||
action_text = self._controller._region_action_text(token)
|
||||
draw_selection_list_row(
|
||||
|
||||
@@ -23,7 +23,7 @@ from openpilot.selfdrive.ui.layouts.settings.starpilot.aethergrid import (
|
||||
TileGrid,
|
||||
ToggleTile,
|
||||
DEFAULT_PANEL_STYLE,
|
||||
_point_hits,
|
||||
point_hits,
|
||||
draw_action_pill,
|
||||
draw_list_group_shell,
|
||||
draw_section_header,
|
||||
@@ -34,12 +34,12 @@ from openpilot.selfdrive.ui.layouts.settings.starpilot.aethergrid import (
|
||||
GROUP_HAIRLINE_COLOR,
|
||||
GROUP_HEADER_COLOR,
|
||||
draw_group_header,
|
||||
SECTION_GAP,
|
||||
SECTION_HEADER_HEIGHT,
|
||||
SECTION_HEADER_GAP,
|
||||
)
|
||||
|
||||
PANEL_STYLE = DEFAULT_PANEL_STYLE
|
||||
SECTION_GAP = AETHER_LIST_METRICS.section_gap
|
||||
SECTION_HEADER_HEIGHT = AETHER_LIST_METRICS.section_header_height
|
||||
SECTION_HEADER_GAP = AETHER_LIST_METRICS.section_header_gap
|
||||
SOUNDS_PANEL_METRICS = replace(
|
||||
COMPACT_PANEL_METRICS,
|
||||
outer_margin_y=14,
|
||||
@@ -219,7 +219,7 @@ class SoundsManagerView(PanelManagerView):
|
||||
self._toggle_grid._handle_mouse_event(mouse_event)
|
||||
|
||||
def _target_at(self, mouse_pos: MousePos) -> str | None:
|
||||
if _point_hits(mouse_pos, self._reset_rect, None, pad_x=6, pad_y=0):
|
||||
if point_hits(mouse_pos, self._reset_rect, None, pad_x=6, pad_y=0):
|
||||
return "action:restore_defaults"
|
||||
return None
|
||||
|
||||
@@ -305,7 +305,7 @@ class SoundsManagerView(PanelManagerView):
|
||||
|
||||
self._interactive_rects["action:restore_defaults"] = self._reset_rect
|
||||
|
||||
hovered = _point_hits(gui_app.last_mouse_event.pos, self._reset_rect, self._scroll_rect, pad_x=6, pad_y=0)
|
||||
hovered = point_hits(gui_app.last_mouse_event.pos, self._reset_rect, self._scroll_rect, pad_x=6, pad_y=0)
|
||||
pressed = self._pressed_target == "action:restore_defaults"
|
||||
draw_action_pill(
|
||||
self._reset_rect, tr("Reset All"),
|
||||
|
||||
@@ -44,15 +44,17 @@ from openpilot.selfdrive.ui.layouts.settings.starpilot.aethergrid import (
|
||||
draw_group_header,
|
||||
draw_tab_bar,
|
||||
AetherSliderDialog,
|
||||
_mix_colors,
|
||||
_with_alpha,
|
||||
_snap_rect,
|
||||
_draw_rounded_fill,
|
||||
_draw_rounded_stroke,
|
||||
_point_hits,
|
||||
_draw_text_fit_common,
|
||||
mix_colors,
|
||||
snap_rect,
|
||||
draw_rounded_fill,
|
||||
draw_rounded_stroke,
|
||||
point_hits,
|
||||
draw_text_fit_common,
|
||||
wrap_text,
|
||||
|
||||
SECTION_GAP,
|
||||
SECTION_HEADER_HEIGHT,
|
||||
SECTION_HEADER_GAP,
|
||||
ROW_HEIGHT,
|
||||
)
|
||||
from openpilot.starpilot.common.connect_server import prepare_konik_server_switch
|
||||
|
||||
@@ -92,10 +94,6 @@ REPORT_CATEGORIES = [
|
||||
]
|
||||
|
||||
|
||||
SECTION_GAP = AETHER_LIST_METRICS.section_gap
|
||||
SECTION_HEADER_HEIGHT = AETHER_LIST_METRICS.section_header_height
|
||||
SECTION_HEADER_GAP = AETHER_LIST_METRICS.section_header_gap
|
||||
ROW_HEIGHT = AETHER_LIST_METRICS.row_height
|
||||
FADE_HEIGHT = AETHER_LIST_METRICS.fade_height
|
||||
PANEL_STYLE = DEFAULT_PANEL_STYLE
|
||||
|
||||
@@ -414,17 +412,17 @@ class SystemSettingsManagerView(PanelManagerView):
|
||||
def _interactive_state(self, target_id: str, rect: rl.Rectangle, *, pad_y: float = 0) -> tuple[bool, bool]:
|
||||
self._interactive_rects[target_id] = rect
|
||||
parent_rect = None if target_id.startswith("static:") else self._scroll_rect
|
||||
hovered = _point_hits(gui_app.last_mouse_event.pos, rect, parent_rect, pad_x=6, pad_y=pad_y)
|
||||
hovered = point_hits(gui_app.last_mouse_event.pos, rect, parent_rect, pad_x=6, pad_y=pad_y)
|
||||
return hovered, self._pressed_target == target_id
|
||||
|
||||
def _target_at(self, mouse_pos) -> str | None:
|
||||
for target_id, rect in self._interactive_rects.items():
|
||||
if target_id.startswith("static:"):
|
||||
if _point_hits(mouse_pos, rect, None, pad_x=6, pad_y=0):
|
||||
if point_hits(mouse_pos, rect, None, pad_x=6, pad_y=0):
|
||||
return target_id
|
||||
for target_id, rect in self._interactive_rects.items():
|
||||
if not target_id.startswith("static:"):
|
||||
if _point_hits(mouse_pos, rect, self._scroll_rect, pad_x=6, pad_y=0):
|
||||
if point_hits(mouse_pos, rect, self._scroll_rect, pad_x=6, pad_y=0):
|
||||
return target_id
|
||||
return None
|
||||
|
||||
@@ -686,9 +684,9 @@ class AetherBackupsCareDialog(Widget):
|
||||
btn_pad = 12.0
|
||||
col_w = (content_w - btn_pad * 2 - COL_GAP) / 2
|
||||
|
||||
d_rect = _snap_rect(rl.Rectangle(dx, dy, dialog_w, dialog_h))
|
||||
_draw_rounded_fill(d_rect, rl.Color(10, 12, 16, 255), radius_px=24)
|
||||
_draw_rounded_stroke(d_rect, rl.Color(255, 255, 255, 16), radius_px=24)
|
||||
d_rect = snap_rect(rl.Rectangle(dx, dy, dialog_w, dialog_h))
|
||||
draw_rounded_fill(d_rect, rl.Color(10, 12, 16, 255), radius_px=24)
|
||||
draw_rounded_stroke(d_rect, rl.Color(255, 255, 255, 16), radius_px=24)
|
||||
rl.draw_rectangle_rec(rl.Rectangle(d_rect.x, d_rect.y, d_rect.width, 4), self._color)
|
||||
|
||||
title_text = tr("Maintenance")
|
||||
@@ -696,7 +694,7 @@ class AetherBackupsCareDialog(Widget):
|
||||
ts = measure_text_cached(self._font_title, title_text, title_size)
|
||||
rl.draw_text_ex(self._font_title, title_text, rl.Vector2(round(dx + (dialog_w - ts.x) / 2), round(dy + (84 - title_size) / 2)), title_size, 0, rl.WHITE)
|
||||
|
||||
status_rect = _snap_rect(rl.Rectangle(dx + MARGIN, dy + 84, content_w, 90))
|
||||
status_rect = snap_rect(rl.Rectangle(dx + MARGIN, dy + 84, content_w, 90))
|
||||
draw_list_group_shell(status_rect, style=PANEL_STYLE)
|
||||
|
||||
gui_label(rl.Rectangle(status_rect.x + 16, status_rect.y + 8, status_rect.width - 32, 18),
|
||||
@@ -720,12 +718,12 @@ class AetherBackupsCareDialog(Widget):
|
||||
btn_fill = rl.Color(22, 24, 32, 255)
|
||||
btn_border = rl.Color(255, 255, 255, 40)
|
||||
btn_fill_hover = rl.Color(30, 32, 42, 255)
|
||||
btn_fill_pressed = _mix_colors(self._color, rl.Color(0, 0, 0, 255), 0.15)
|
||||
btn_fill_pressed = mix_colors(self._color, rl.Color(0, 0, 0, 255), 0.15)
|
||||
btn_radius = 14.0
|
||||
|
||||
btn_group_y = dy + 192
|
||||
btn_group_h = 4 * 68 + 3 * 14 + btn_pad * 2
|
||||
btn_group_rect = _snap_rect(rl.Rectangle(dx + MARGIN, btn_group_y, content_w, btn_group_h))
|
||||
btn_group_rect = snap_rect(rl.Rectangle(dx + MARGIN, btn_group_y, content_w, btn_group_h))
|
||||
draw_list_group_shell(btn_group_rect, style=PANEL_STYLE)
|
||||
|
||||
self._button_rects.clear()
|
||||
@@ -735,7 +733,7 @@ class AetherBackupsCareDialog(Widget):
|
||||
col = i // 4
|
||||
bx = btn_group_rect.x + btn_pad + col * (col_w + COL_GAP)
|
||||
by = btn_group_rect.y + btn_pad + row * (68 + 14)
|
||||
btn_rect = _snap_rect(rl.Rectangle(bx, by, col_w, 68))
|
||||
btn_rect = snap_rect(rl.Rectangle(bx, by, col_w, 68))
|
||||
self._button_rects[btn_id] = btn_rect
|
||||
|
||||
hovered = rl.check_collision_point_rec(mouse_pos, btn_rect)
|
||||
@@ -764,11 +762,11 @@ class AetherBackupsCareDialog(Widget):
|
||||
border = btn_border
|
||||
text_color = AetherListColors.HEADER
|
||||
|
||||
_draw_rounded_fill(btn_rect, fill, radius_px=btn_radius)
|
||||
_draw_rounded_stroke(btn_rect, border, thickness=2, radius_px=btn_radius)
|
||||
draw_rounded_fill(btn_rect, fill, radius_px=btn_radius)
|
||||
draw_rounded_stroke(btn_rect, border, thickness=2, radius_px=btn_radius)
|
||||
|
||||
font_size = 20
|
||||
_draw_text_fit_common(
|
||||
draw_text_fit_common(
|
||||
self._font_btn,
|
||||
btn["text"],
|
||||
rl.Vector2(btn_rect.x + 12, btn_rect.y + (btn_rect.height - font_size) / 2),
|
||||
@@ -780,13 +778,13 @@ class AetherBackupsCareDialog(Widget):
|
||||
|
||||
cx = dx + (dialog_w - 320) / 2
|
||||
cy = d_rect.y + d_rect.height - 36 - 72
|
||||
self._close_rect = _snap_rect(rl.Rectangle(cx, cy, 320, 72))
|
||||
self._close_rect = snap_rect(rl.Rectangle(cx, cy, 320, 72))
|
||||
|
||||
close_hovered = rl.check_collision_point_rec(mouse_pos, self._close_rect)
|
||||
close_pressed = self._pressed_btn_id == "close"
|
||||
|
||||
if close_pressed:
|
||||
close_fill = _mix_colors(self._color, rl.Color(0, 0, 0, 255), 0.2)
|
||||
close_fill = mix_colors(self._color, rl.Color(0, 0, 0, 255), 0.2)
|
||||
close_border = self._color
|
||||
elif close_hovered:
|
||||
close_fill = self._color
|
||||
|
||||
@@ -28,9 +28,7 @@ from openpilot.selfdrive.ui.layouts.settings.starpilot.aethergrid import (
|
||||
draw_soft_card,
|
||||
TileGrid,
|
||||
ToggleTile,
|
||||
_with_alpha,
|
||||
_draw_rounded_fill,
|
||||
_draw_rounded_stroke,
|
||||
with_alpha,
|
||||
draw_status_badges,
|
||||
wrap_text,
|
||||
)
|
||||
@@ -470,8 +468,8 @@ class VehicleSettingsManagerView(PanelManagerView):
|
||||
action_pill_width=row.get("pill_width", 108), action_pill_height=44,
|
||||
title_size=34, subtitle_size=22, action_text_size=18,
|
||||
row_separator=PANEL_STYLE.divider_color,
|
||||
action_fill=PANEL_STYLE.current_fill if is_enabled else _with_alpha(PANEL_STYLE.current_fill, 120),
|
||||
action_border=PANEL_STYLE.current_border if is_enabled else _with_alpha(PANEL_STYLE.current_border, 100),
|
||||
action_fill=PANEL_STYLE.current_fill if is_enabled else with_alpha(PANEL_STYLE.current_fill, 120),
|
||||
action_border=PANEL_STYLE.current_border if is_enabled else with_alpha(PANEL_STYLE.current_border, 100),
|
||||
action_text_color=AetherListColors.HEADER if is_enabled else AetherListColors.MUTED,
|
||||
)
|
||||
elif row_type == "info":
|
||||
|
||||
Reference in New Issue
Block a user