mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-10-13 01:34:02 +08:00
polish
This commit is contained in:
@@ -2338,7 +2338,7 @@ def draw_selectable_chip(rect: rl.Rectangle, text: str, *,
|
||||
draw_text_fit_common(
|
||||
resolved_font,
|
||||
text,
|
||||
rl.Vector2(rect.x + padding_x, rect.y + (rect.height - font_size) / 2),
|
||||
rl.Vector2(rect.x + padding_x, rect.y + (rect.height - font_size * FONT_SCALE) / 2),
|
||||
max(1.0, rect.width - padding_x * 2),
|
||||
font_size,
|
||||
align_center=True,
|
||||
@@ -3889,8 +3889,8 @@ class AetherTile(Widget):
|
||||
|
||||
title_color = rl.WHITE if (enabled and is_active) else rl.Color(236, 242, 250, 255)
|
||||
|
||||
title_y = ry + (rh / 2) - title_size - 2
|
||||
status_y = ry + (rh / 2) + 6
|
||||
title_y = ry + (rh - (title_size + status_size) * FONT_SCALE - 8) / 2
|
||||
status_y = title_y + title_size * FONT_SCALE + 8
|
||||
|
||||
max_text_width = rw - (content_pad * 2) - int(rh * 0.40) - 10
|
||||
font = getattr(self, "_font", gui_app.font(FontWeight.MEDIUM))
|
||||
@@ -5412,7 +5412,7 @@ class AetherSegmentedControl(Widget):
|
||||
draw_text_fit_common(
|
||||
self._font,
|
||||
label,
|
||||
rl.Vector2(face_rect.x + 16, face_rect.y + (face_rect.height - title_size) / 2),
|
||||
rl.Vector2(face_rect.x + 16, face_rect.y + (face_rect.height - title_size * FONT_SCALE) / 2),
|
||||
face_rect.width - 32,
|
||||
title_size,
|
||||
align_center=True,
|
||||
|
||||
@@ -633,7 +633,7 @@ class StarPilotNavigationLayout(_SettingsPage):
|
||||
fill = with_alpha(AetherListColors.PRIMARY, 54 if enabled and (hovered or pressed) else 24 if enabled else 8)
|
||||
border = with_alpha(AetherListColors.PRIMARY, 110 if enabled else 28)
|
||||
text_color = AetherListColors.HEADER if enabled else AetherListColors.MUTED
|
||||
draw_action_pill(rect, label, fill, border, text_color, font_size=24)
|
||||
draw_action_pill(rect, label, fill, border, text_color, font_size=26)
|
||||
return rows * NAV_ACTION_HEIGHT + max(0, rows - 1) * NAV_ACTION_GAP
|
||||
|
||||
def _draw_summary_row(self, rect: rl.Rectangle, manager: NavigationManagerView) -> None:
|
||||
@@ -666,9 +666,6 @@ class StarPilotNavigationLayout(_SettingsPage):
|
||||
action_pill=True,
|
||||
action_pill_height=64,
|
||||
action_pill_width=220,
|
||||
title_size=34,
|
||||
subtitle_size=24,
|
||||
action_text_size=24,
|
||||
action_fill=with_alpha(AetherListColors.DANGER if target_id == "action:cancel" else AetherListColors.SUCCESS, 38 if enabled else 10),
|
||||
action_border=with_alpha(AetherListColors.DANGER if target_id == "action:cancel" else AetherListColors.SUCCESS, 85 if enabled else 25),
|
||||
action_text_color=AetherListColors.HEADER if enabled else AetherListColors.MUTED,
|
||||
@@ -696,9 +693,6 @@ class StarPilotNavigationLayout(_SettingsPage):
|
||||
action_pill=True,
|
||||
action_pill_height=64,
|
||||
action_pill_width=180,
|
||||
title_size=32,
|
||||
subtitle_size=22,
|
||||
action_text_size=24,
|
||||
row_separator=PANEL_STYLE.divider_color,
|
||||
)
|
||||
y += NAV_SEARCH_HEIGHT + NAV_GAP
|
||||
|
||||
@@ -232,10 +232,12 @@ class SoundsManagerView(AdjustorTogglesPanelView):
|
||||
|
||||
current_y = y + GROUP_TOP_INSET
|
||||
|
||||
label_rect = rl.Rectangle(x + 24, current_y, width - 48, 28)
|
||||
label_rect = rl.Rectangle(x + 24, current_y - 4, width - 48, 28)
|
||||
gui_label(label_rect, tr("Reset All"), 28, AetherListColors.SUBTEXT, FontWeight.MEDIUM,
|
||||
alignment=rl.GuiTextAlignment.TEXT_ALIGN_RIGHT)
|
||||
self._reset_rect = rl.Rectangle(label_rect.x + label_rect.width - 140, label_rect.y, 140, 24)
|
||||
reset_width = min(240.0, label_rect.width)
|
||||
self._reset_rect = rl.Rectangle(label_rect.x + label_rect.width - reset_width,
|
||||
current_y - GROUP_TOP_INSET, reset_width, GROUP_TOP_INSET + label_rect.height)
|
||||
self._interactive_rects["action:restore_defaults"] = self._reset_rect
|
||||
current_y += 28
|
||||
for index, key in enumerate(all_keys):
|
||||
|
||||
@@ -12,7 +12,7 @@ from typing import Any
|
||||
import pyray as rl
|
||||
|
||||
from openpilot.system.hardware import HARDWARE
|
||||
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.multilang import tr, tr_noop
|
||||
from openpilot.system.ui.lib.text_measure import measure_text_cached
|
||||
from openpilot.system.ui.widgets import DialogResult, Widget
|
||||
@@ -697,16 +697,18 @@ class AetherBackupsCareDialog(Widget):
|
||||
status_rect = snap_rect(rl.Rectangle(dx + MARGIN, dy + 170, content_w, 80))
|
||||
draw_list_group_shell(status_rect, style=PANEL_STYLE)
|
||||
|
||||
gui_label(rl.Rectangle(status_rect.x + 20, status_rect.y + 10, status_rect.width - 40, 24),
|
||||
tr("System Status"), 22, AetherListColors.MUTED, FontWeight.SEMI_BOLD)
|
||||
gui_label(rl.Rectangle(status_rect.x + 20, status_rect.y + 6, status_rect.width - 40, 30),
|
||||
tr("System Status"), 24, AetherListColors.MUTED, FontWeight.SEMI_BOLD)
|
||||
|
||||
storage_text = tr("Storage: {}").format(self._controller.storage_summary())
|
||||
backup_text = tr("Backups: {} • Snapshots: {}").format(
|
||||
self._controller.backup_count_text(), self._controller.toggle_backup_count_text())
|
||||
gui_label(rl.Rectangle(status_rect.x + 20, status_rect.y + 40, status_rect.width - 40, 24),
|
||||
storage_text, 22, AetherListColors.HEADER, FontWeight.MEDIUM)
|
||||
gui_label(rl.Rectangle(status_rect.x + 300, status_rect.y + 40, status_rect.width - 320, 24),
|
||||
backup_text, 22, AetherListColors.HEADER, FontWeight.MEDIUM)
|
||||
storage_width = min(360.0, (status_rect.width - 64) / 2)
|
||||
backup_x = status_rect.x + 44 + storage_width
|
||||
gui_label(rl.Rectangle(status_rect.x + 20, status_rect.y + 42, storage_width, 34),
|
||||
storage_text, 28, AetherListColors.HEADER, FontWeight.MEDIUM)
|
||||
gui_label(rl.Rectangle(backup_x, status_rect.y + 42, status_rect.width - 64 - storage_width, 34),
|
||||
backup_text, 28, AetherListColors.HEADER, FontWeight.MEDIUM)
|
||||
|
||||
mouse_pos = gui_app.last_mouse_event.pos
|
||||
|
||||
@@ -769,7 +771,7 @@ class AetherBackupsCareDialog(Widget):
|
||||
draw_text_fit_common(
|
||||
self._font_btn,
|
||||
btn["text"],
|
||||
rl.Vector2(btn_rect.x + 16, btn_rect.y + (btn_rect.height - font_size) / 2),
|
||||
rl.Vector2(btn_rect.x + 16, btn_rect.y + (btn_rect.height - font_size * FONT_SCALE) / 2),
|
||||
btn_rect.width - 32,
|
||||
font_size,
|
||||
align_center=True,
|
||||
|
||||
@@ -7,7 +7,7 @@ import time
|
||||
import pyray as rl
|
||||
|
||||
from openpilot.system.hardware import HARDWARE
|
||||
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.multilang import tr, tr_noop
|
||||
from openpilot.system.ui.lib.text_measure import measure_text_cached
|
||||
from openpilot.system.ui.widgets import DialogResult, Widget
|
||||
@@ -199,9 +199,9 @@ class VehicleSettingsManagerView(PanelManagerView):
|
||||
subtitle_size = 26
|
||||
value_size = 28
|
||||
else:
|
||||
title_size = 36
|
||||
title_size = 40
|
||||
subtitle_size = 28
|
||||
value_size = 30
|
||||
value_size = 34
|
||||
|
||||
if row.type == "value" or row.id.startswith("combo:"):
|
||||
value_text = row.get_value() if row.get_value else ""
|
||||
@@ -564,7 +564,7 @@ class ButtonActionComboDialog(Widget):
|
||||
rl.draw_line(int(row_rect.x + 24), sep_y, int(row_rect.x + row_rect.width - 24), sep_y, rl.Color(255, 255, 255, 16))
|
||||
|
||||
title_x = int(row_rect.x + 24)
|
||||
title_y = int(row_rect.y + (row_rect.height - title_fs) / 2)
|
||||
title_y = int(row_rect.y + (row_rect.height - title_fs * FONT_SCALE) / 2)
|
||||
rl.draw_text_ex(self._font_title, self._labels[i], rl.Vector2(title_x, title_y), title_fs, 0, rl.WHITE)
|
||||
|
||||
action_name = self._controller._get_action_name(self._keys[i])
|
||||
@@ -574,12 +574,12 @@ class ButtonActionComboDialog(Widget):
|
||||
text_w = measure_text_cached(font_label, action_name, value_fs).x
|
||||
if text_w <= available_w:
|
||||
val_x = value_right - text_w
|
||||
val_y = int(row_rect.y + (row_rect.height - value_fs) / 2)
|
||||
val_y = int(row_rect.y + (row_rect.height - value_fs * FONT_SCALE) / 2)
|
||||
rl.draw_text_ex(font_value, action_name, rl.Vector2(val_x, val_y), value_fs, 0, rl.WHITE)
|
||||
else:
|
||||
draw_text_fit_common(
|
||||
font_value, action_name,
|
||||
rl.Vector2(value_left, int(row_rect.y + (row_rect.height - value_fs) / 2)),
|
||||
rl.Vector2(value_left, int(row_rect.y + (row_rect.height - value_fs * FONT_SCALE) / 2)),
|
||||
available_w, value_fs, color=rl.WHITE,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user