mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-10-04 13:24:13 +08:00
polish
This commit is contained in:
@@ -1008,13 +1008,16 @@ class PanelManagerView(AetherInteractiveMixin, Widget):
|
||||
track_h = 10.0
|
||||
track_w = seg_w * n
|
||||
start_x = rect.x + (rect.width - track_w) / 2
|
||||
track_y = rect.y + rect.height - 16
|
||||
track_y = rect.y + rect.height - 12
|
||||
|
||||
label = f"{self._current_page + 1} / {self._page_count}"
|
||||
lf = gui_app.font(FontWeight.MEDIUM)
|
||||
ls = 16.0
|
||||
lw = measure_text_cached(lf, label, int(ls)).x
|
||||
rl.draw_text_ex(lf, label, rl.Vector2(int(rect.x + (rect.width - lw) / 2), int(track_y - ls - 6)), int(ls), 0, with_alpha(AetherListColors.MUTED, 200))
|
||||
ls = 22.0
|
||||
label_size = measure_text_cached(lf, label, int(ls))
|
||||
rl.draw_text_ex(
|
||||
lf, label, rl.Vector2(int(rect.x + (rect.width - label_size.x) / 2), int(track_y - label_size.y - 4)),
|
||||
int(ls), 0, with_alpha(AetherListColors.MUTED, 200),
|
||||
)
|
||||
|
||||
track_col = with_alpha(AetherListColors.MUTED, 60)
|
||||
rl.draw_rectangle_rounded(rl.Rectangle(start_x, track_y, track_w, track_h), 0.5, 8, track_col)
|
||||
@@ -1026,7 +1029,8 @@ class PanelManagerView(AetherInteractiveMixin, Widget):
|
||||
|
||||
if self._page_count > 8:
|
||||
more_x = int(start_x + track_w + 10)
|
||||
rl.draw_text_ex(lf, "···", rl.Vector2(more_x, int(track_y - 2)), 14, 0, AetherListColors.MUTED)
|
||||
more_h = measure_text_cached(lf, "···", 14).y
|
||||
rl.draw_text_ex(lf, "···", rl.Vector2(more_x, int(track_y + track_h - more_h)), 14, 0, AetherListColors.MUTED)
|
||||
|
||||
# ── lifecycle ──────────────────────────────────────────────
|
||||
|
||||
|
||||
@@ -703,7 +703,6 @@ class StarPilotNavigationLayout(_SettingsPage):
|
||||
tr("Searching…"),
|
||||
tr("Looking up destinations"),
|
||||
title_size=30,
|
||||
body_size=22,
|
||||
border=with_alpha(PANEL_STYLE.surface_border, 14),
|
||||
style=PANEL_STYLE,
|
||||
)
|
||||
@@ -714,7 +713,6 @@ class StarPilotNavigationLayout(_SettingsPage):
|
||||
tr("Search unavailable"),
|
||||
self._search_error,
|
||||
title_size=30,
|
||||
body_size=22,
|
||||
border=with_alpha(AetherListColors.WARNING, 45),
|
||||
style=PANEL_STYLE,
|
||||
)
|
||||
@@ -837,7 +835,6 @@ class StarPilotNavigationLayout(_SettingsPage):
|
||||
empty_title,
|
||||
empty_body,
|
||||
title_size=30,
|
||||
body_size=22,
|
||||
border=with_alpha(PANEL_STYLE.surface_border, 14),
|
||||
style=PANEL_STYLE,
|
||||
)
|
||||
|
||||
@@ -10,6 +10,7 @@ from openpilot.starpilot.common.starpilot_variables import ACTIVE_THEME_PATH
|
||||
from openpilot.system.ui.lib.application import gui_app, FontWeight, MouseEvent, MousePos
|
||||
from openpilot.system.ui.lib.multilang import tr, tr_noop
|
||||
from openpilot.system.ui.widgets import Widget, DialogResult
|
||||
from openpilot.system.ui.widgets.confirm_dialog import ConfirmDialog
|
||||
from openpilot.system.ui.widgets.label import gui_label
|
||||
from openpilot.selfdrive.ui.ui_state import ui_state
|
||||
from openpilot.selfdrive.ui.lib.starpilot_state import starpilot_state
|
||||
@@ -185,7 +186,15 @@ class SoundsManagerView(AdjustorTogglesPanelView):
|
||||
|
||||
def _activate_target(self, target: str):
|
||||
if target == "action:restore_defaults":
|
||||
self._controller._restore_defaults()
|
||||
def on_result(result: DialogResult):
|
||||
if result == DialogResult.CONFIRM:
|
||||
self._controller._restore_defaults()
|
||||
|
||||
gui_app.push_widget(ConfirmDialog(
|
||||
tr("Reset all sound volumes, cooldown, and custom alerts to their defaults?"),
|
||||
tr("Reset All"),
|
||||
callback=on_result,
|
||||
))
|
||||
|
||||
def _measure_content_height(self, content_width: float) -> float:
|
||||
col_width = (content_width - SECTION_GAP) / 2
|
||||
|
||||
Reference in New Issue
Block a user