From 6080819f7d582f004819410d2306ee75c1c814e0 Mon Sep 17 00:00:00 2001 From: firestarsdog <229254897+firestarsdog@users.noreply.github.com> Date: Sun, 12 Apr 2026 02:05:17 -0400 Subject: [PATCH] BigUI WIP: Model Manager Alignment + Colors --- selfdrive/ui/layouts/settings/settings.py | 2 +- .../settings/starpilot/driving_model.py | 34 +++++++++++-------- .../layouts/settings/starpilot/utilities.py | 24 ++++++------- 3 files changed, 31 insertions(+), 29 deletions(-) diff --git a/selfdrive/ui/layouts/settings/settings.py b/selfdrive/ui/layouts/settings/settings.py index 4d08395c56..0de7fe1fb4 100644 --- a/selfdrive/ui/layouts/settings/settings.py +++ b/selfdrive/ui/layouts/settings/settings.py @@ -25,7 +25,7 @@ PANEL_MARGIN = 50 # Colors SIDEBAR_COLOR = rl.BLACK -PANEL_COLOR = rl.Color(8, 8, 10, 255) +PANEL_COLOR = rl.BLACK CLOSE_BTN_COLOR = rl.Color(41, 41, 41, 255) CLOSE_BTN_PRESSED = rl.Color(59, 59, 59, 255) TEXT_NORMAL = rl.Color(128, 128, 128, 255) diff --git a/selfdrive/ui/layouts/settings/starpilot/driving_model.py b/selfdrive/ui/layouts/settings/starpilot/driving_model.py index 70b3e6e1ea..537463b9c1 100644 --- a/selfdrive/ui/layouts/settings/starpilot/driving_model.py +++ b/selfdrive/ui/layouts/settings/starpilot/driving_model.py @@ -34,7 +34,7 @@ from openpilot.selfdrive.ui.layouts.settings.starpilot.panel import StarPilotPan from openpilot.selfdrive.ui.layouts.settings.starpilot.aethergrid import AetherSliderDialog, hex_to_color -MODEL_PANEL_BG = hex_to_color("#11151D") +MODEL_PANEL_BG = rl.Color(8, 8, 10, 255) MODEL_PANEL_BORDER = rl.Color(255, 255, 255, 22) MODEL_PANEL_GLOW = rl.Color(92, 116, 151, 34) MODEL_HEADER_TEXT = rl.Color(236, 242, 250, 255) @@ -65,7 +65,7 @@ PANEL_RADIUS = 0.055 PANEL_PADDING_X = 16 PANEL_PADDING_TOP = 28 PANEL_PADDING_BOTTOM = 22 -HEADER_HEIGHT = 156 +HEADER_HEIGHT = 184 SECTION_GAP = 28 SECTION_HEADER_HEIGHT = 34 SECTION_HEADER_GAP = 12 @@ -75,7 +75,7 @@ ROW_RADIUS = 0.12 ACTION_WIDTH = 188 ROW_TEXT_GAP = 8 BUTTON_HEIGHT = 58 -BUTTON_GAP = 12 +BUTTON_GAP = 16 FADE_HEIGHT = 24 CONFIRM_TIMEOUT_SECONDS = 3.0 TRANSITION_SECONDS = 0.24 @@ -336,22 +336,26 @@ class DrivingModelManagerView(Widget): title_rect = rl.Rectangle(rect.x, rect.y + 4, rect.width * 0.55, 40) gui_label(title_rect, tr("Driving Models"), 40, MODEL_HEADER_TEXT, FontWeight.SEMI_BOLD) - subtitle_rect = rl.Rectangle(rect.x, rect.y + 46, rect.width * 0.58, 56) - gui_label(subtitle_rect, self._controller.header_description_text(), 24, MODEL_SUBTEXT, FontWeight.NORMAL) + subtitle_text = self._controller.header_description_text() + if subtitle_text: + subtitle_rect = rl.Rectangle(rect.x, rect.y + 48, rect.width * 0.58, 36) + gui_label(subtitle_rect, subtitle_text, 24, MODEL_SUBTEXT, FontWeight.NORMAL) - current_label_rect = rl.Rectangle(rect.x, rect.y + 84, rect.width * 0.40, 22) - gui_label(current_label_rect, tr("Current model"), 20, MODEL_MUTED, FontWeight.MEDIUM) + current_label_rect = rl.Rectangle(rect.x, rect.y + 96, 150, 22) + gui_label(current_label_rect, tr("Current Model"), 20, MODEL_MUTED, FontWeight.MEDIUM) - current_chip_rect = rl.Rectangle(rect.x, rect.y + 108, rect.width * 0.40, 40) - self._draw_chip(current_chip_rect, self._controller._current_model_name, MODEL_PRIMARY_SOFT, MODEL_PRIMARY, MODEL_HEADER_TEXT, pill=True) + current_value_rect = rl.Rectangle(rect.x + 150, rect.y + 94, rect.width * 0.44, 24) + gui_label(current_value_rect, self._controller._current_model_name, 22, MODEL_HEADER_TEXT, FontWeight.MEDIUM) right_panel_w = min(390, rect.width * 0.35) - right_rect = rl.Rectangle(rect.x + rect.width - right_panel_w, rect.y + 8, right_panel_w, 142) + stack_height = BUTTON_HEIGHT * 2 + BUTTON_GAP + stack_y = rect.y + 24 + right_rect = rl.Rectangle(rect.x + rect.width - right_panel_w, stack_y, right_panel_w, stack_height) primary_label, primary_enabled = self._controller.primary_header_button_state() secondary_label, secondary_enabled = self._controller.secondary_header_button_state() - primary_rect = rl.Rectangle(right_rect.x + 18, right_rect.y + 18, right_rect.width - 36, BUTTON_HEIGHT) - secondary_rect = rl.Rectangle(right_rect.x + 18, primary_rect.y + BUTTON_HEIGHT + BUTTON_GAP, right_rect.width - 36, BUTTON_HEIGHT) + primary_rect = rl.Rectangle(right_rect.x, right_rect.y, right_rect.width, BUTTON_HEIGHT) + secondary_rect = rl.Rectangle(right_rect.x, primary_rect.y + BUTTON_HEIGHT + BUTTON_GAP, right_rect.width, BUTTON_HEIGHT) self._header_rects["header:primary"] = primary_rect if primary_enabled else rl.Rectangle(-1, -1, 0, 0) self._header_rects["header:secondary"] = secondary_rect if secondary_enabled else rl.Rectangle(-1, -1, 0, 0) self._draw_button(primary_rect, primary_label, primary_enabled, emphasized=True) @@ -1021,10 +1025,10 @@ class StarPilotDrivingModelLayout(StarPilotPanel): if self._manifest_fetch_thread is not None and self._manifest_fetch_thread.is_alive(): return tr("Refreshing the driving model catalog in the background.") if ui_state.started: - return tr("Downloads and removals pause while driving. Installed rows still show the active model.") + return tr("Downloads and removals pause while driving.") if self._params.get_bool("ModelRandomizer"): - return tr("Model Randomizer is active. Turn it off below to manually choose an installed model.") - return tr("Tap an installed model to make it active. Use the action rail to download or remove without opening more menus.") + return tr("Model Randomizer is active. Turn it off below to choose a model manually.") + return tr("Tap an installed model to make it active.") def empty_state_title(self) -> str: if self._manifest_fetch_thread is not None and self._manifest_fetch_thread.is_alive(): diff --git a/selfdrive/ui/layouts/settings/starpilot/utilities.py b/selfdrive/ui/layouts/settings/starpilot/utilities.py index 9dcd41a0f3..2436e38d6c 100644 --- a/selfdrive/ui/layouts/settings/starpilot/utilities.py +++ b/selfdrive/ui/layouts/settings/starpilot/utilities.py @@ -74,15 +74,13 @@ class StarPilotUtilitiesLayout(StarPilotPanel): def _do_flash(res): if res == DialogResult.CONFIRM: self._params_memory.put_bool("FlashPanda", True) - gui_app.set_modal_overlay(alert_dialog(tr("Panda flashing started. Device will reboot when finished."))) + gui_app.push_widget(alert_dialog(tr("Panda flashing started. Device will reboot when finished."))) - gui_app.set_modal_overlay(ConfirmDialog(tr("Flash Panda firmware?"), tr("Flash"), on_close=_do_flash)) + gui_app.push_widget(ConfirmDialog(tr("Flash Panda firmware?"), tr("Flash"), callback=_do_flash)) def _on_force_drive_state(self): options = [tr("Offroad"), tr("Onroad"), tr("Default")] current = self._get_force_drive_state() - dialog = MultiOptionDialog(tr("Force Drive State"), options, current) - def on_select(res): if res == DialogResult.CONFIRM and dialog.selection: if dialog.selection == tr("Offroad"): @@ -96,11 +94,10 @@ class StarPilotUtilitiesLayout(StarPilotPanel): self._params.put_bool("ForceOnroad", False) self._rebuild_grid() - gui_app.set_modal_overlay(dialog, callback=on_select) + dialog = MultiOptionDialog(tr("Force Drive State"), options, current, callback=on_select) + gui_app.push_widget(dialog) def _on_report_issue(self): - dialog = MultiOptionDialog(tr("Select Issue"), REPORT_CATEGORIES) - def on_category(res): if res != DialogResult.CONFIRM or not dialog.selection: return @@ -111,7 +108,7 @@ class StarPilotUtilitiesLayout(StarPilotPanel): self._params.put("DiscordUsername", username) report = json.dumps({"DiscordUser": username, "Issue": dialog.selection}) self._params_memory.put("IssueReported", report) - gui_app.set_modal_overlay(alert_dialog(tr("Issue reported. Thank you!"))) + gui_app.push_widget(alert_dialog(tr("Issue reported. Thank you!"))) self._keyboard.reset(min_text_size=1) self._keyboard.set_title(tr("Discord Username"), "") @@ -119,7 +116,8 @@ class StarPilotUtilitiesLayout(StarPilotPanel): self._keyboard.set_callback(lambda result: on_discord(result, self._keyboard.text)) gui_app.push_widget(self._keyboard) - gui_app.set_modal_overlay(dialog, callback=on_category) + dialog = MultiOptionDialog(tr("Select Issue"), REPORT_CATEGORIES, callback=on_category) + gui_app.push_widget(dialog) def _on_reset_defaults(self): def _do_reset(res): @@ -131,10 +129,10 @@ class StarPilotUtilitiesLayout(StarPilotPanel): default = self._params.get_default_value(k) if default is not None: self._params.put(k, default) - gui_app.set_modal_overlay(alert_dialog(tr("Toggles reset to defaults."))) + gui_app.push_widget(alert_dialog(tr("Toggles reset to defaults."))) self._rebuild_grid() - gui_app.set_modal_overlay(ConfirmDialog(tr("Reset all toggles to defaults?"), tr("Reset"), on_close=_do_reset)) + gui_app.push_widget(ConfirmDialog(tr("Reset all toggles to defaults?"), tr("Reset"), callback=_do_reset)) def _on_reset_stock(self): def _do_reset(res): @@ -146,7 +144,7 @@ class StarPilotUtilitiesLayout(StarPilotPanel): stock = self._params.get_stock_value(k) if stock is not None: self._params.put(k, stock) - gui_app.set_modal_overlay(alert_dialog(tr("Toggles reset to stock openpilot."))) + gui_app.push_widget(alert_dialog(tr("Toggles reset to stock openpilot."))) self._rebuild_grid() - gui_app.set_modal_overlay(ConfirmDialog(tr("Reset all toggles to stock openpilot?"), tr("Reset"), on_close=_do_reset)) + gui_app.push_widget(ConfirmDialog(tr("Reset all toggles to stock openpilot?"), tr("Reset"), callback=_do_reset))