mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-12 12:52:13 +08:00
BigUI WIP: Grow up
This commit is contained in:
@@ -19,7 +19,7 @@ SIDEBAR_WIDTH = 500
|
||||
CLOSE_BTN_SIZE = 200
|
||||
CLOSE_ICON_SIZE = 70
|
||||
NAV_BTN_HEIGHT = 110
|
||||
PANEL_MARGIN = 50
|
||||
PANEL_MARGIN = 10
|
||||
|
||||
# Colors
|
||||
SIDEBAR_COLOR = rl.BLACK
|
||||
@@ -158,7 +158,7 @@ class SettingsLayout(Widget):
|
||||
|
||||
def _draw_current_panel(self, rect: rl.Rectangle):
|
||||
rl.draw_rectangle_rounded(rl.Rectangle(rect.x + 10, rect.y + 10, rect.width - 20, rect.height - 20), 0.04, 30, PANEL_COLOR)
|
||||
content_rect = rl.Rectangle(rect.x + PANEL_MARGIN, rect.y + 25, rect.width - (PANEL_MARGIN * 2), rect.height - 50)
|
||||
content_rect = rl.Rectangle(rect.x + PANEL_MARGIN, rect.y + 10, rect.width - (PANEL_MARGIN * 2), rect.height - 20)
|
||||
# rl.draw_rectangle_rounded(content_rect, 0.03, 30, PANEL_COLOR)
|
||||
panel = self._panels[self._current_panel]
|
||||
if panel.instance:
|
||||
|
||||
@@ -294,12 +294,12 @@ class AetherListColors:
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class AetherListMetrics:
|
||||
max_content_width: int = 1560
|
||||
outer_margin_x: int = 18
|
||||
outer_margin_y: int = 24
|
||||
panel_padding_x: int = 16
|
||||
panel_padding_top: int = 28
|
||||
panel_padding_bottom: int = 22
|
||||
max_content_width: int = 100000
|
||||
outer_margin_x: int = 10
|
||||
outer_margin_y: int = 10
|
||||
panel_padding_x: int = 0
|
||||
panel_padding_top: int = 0
|
||||
panel_padding_bottom: int = 0
|
||||
header_height: int = 0
|
||||
section_gap: int = 28
|
||||
section_header_height: int = 87
|
||||
@@ -311,7 +311,7 @@ class AetherListMetrics:
|
||||
header_button_height: int = 84
|
||||
header_button_gap: int = 14 # noqa: used implicitly by driving_model
|
||||
fade_height: int = 24
|
||||
content_right_gutter: int = 18
|
||||
content_right_gutter: int = 0
|
||||
toggle_width: int = 113
|
||||
toggle_height: int = 61
|
||||
toggle_right_inset: int = 49
|
||||
|
||||
@@ -148,8 +148,8 @@ class AppearanceManagerView(AetherSettingsView):
|
||||
self.set_rect(rect)
|
||||
self._interactive_rects.clear()
|
||||
|
||||
margin_x = 18.0
|
||||
margin_y = 24.0
|
||||
margin_x = 10.0
|
||||
margin_y = 10.0
|
||||
|
||||
grid_x = rect.x + margin_x
|
||||
grid_y = rect.y + margin_y
|
||||
|
||||
@@ -104,8 +104,8 @@ class SteeringManagerView(AetherSettingsView):
|
||||
self.set_rect(rect)
|
||||
self._interactive_rects.clear()
|
||||
|
||||
margin_x = 18.0
|
||||
margin_y = 24.0
|
||||
margin_x = 10.0
|
||||
margin_y = 10.0
|
||||
|
||||
grid_x = rect.x + margin_x
|
||||
grid_y = rect.y + margin_y
|
||||
|
||||
@@ -93,8 +93,8 @@ class AdaptiveSpeedView(Widget):
|
||||
))
|
||||
|
||||
def _render(self, rect: rl.Rectangle):
|
||||
margin_x = 18.0
|
||||
margin_y = 24.0
|
||||
margin_x = 10.0
|
||||
margin_y = 10.0
|
||||
grid_x = rect.x + margin_x
|
||||
grid_y = rect.y + margin_y
|
||||
grid_w = rect.width - margin_x * 2
|
||||
@@ -185,8 +185,8 @@ class LongitudinalManagerView(AetherSettingsView):
|
||||
self.set_rect(rect)
|
||||
self._interactive_rects.clear()
|
||||
|
||||
margin_x = 18.0
|
||||
margin_y = 24.0
|
||||
margin_x = 10.0
|
||||
margin_y = 10.0
|
||||
|
||||
grid_x = rect.x + margin_x
|
||||
grid_y = rect.y + margin_y
|
||||
@@ -213,13 +213,7 @@ class LongitudinalManagerView(AetherSettingsView):
|
||||
|
||||
|
||||
class ConditionalDriveModeView(PanelManagerView):
|
||||
METRICS = replace(
|
||||
COMPACT_PANEL_METRICS,
|
||||
outer_margin_y=14,
|
||||
panel_padding_top=16,
|
||||
panel_padding_bottom=14,
|
||||
header_height=0,
|
||||
)
|
||||
METRICS = COMPACT_PANEL_METRICS
|
||||
TAB_HEIGHT = 98
|
||||
TAB_BOTTOM_GAP = 26
|
||||
|
||||
@@ -469,7 +463,7 @@ class ConditionalDriveModeView(PanelManagerView):
|
||||
def _draw_scroll_content(self, rect: rl.Rectangle, content_width: float):
|
||||
y = rect.y + self._scroll_offset
|
||||
|
||||
header_w = content_width - AETHER_LIST_METRICS.content_right_gutter
|
||||
header_w = content_width
|
||||
bar_rect = rl.Rectangle(rect.x, y, header_w, self.TAB_HEIGHT)
|
||||
draw_list_group_shell(bar_rect, style=PANEL_STYLE)
|
||||
self._drive_mode_control.render(bar_rect)
|
||||
|
||||
@@ -274,7 +274,8 @@ class StarPilotLayout(Widget):
|
||||
|
||||
def _render(self, rect: rl.Rectangle):
|
||||
TOP_BAR_HEIGHT = 72
|
||||
content_rect = rl.Rectangle(rect.x, rect.y + TOP_BAR_HEIGHT, rect.width, rect.height - TOP_BAR_HEIGHT)
|
||||
BOTTOM_BAR_HEIGHT = 10
|
||||
content_rect = rl.Rectangle(rect.x, rect.y + TOP_BAR_HEIGHT, rect.width, rect.height - TOP_BAR_HEIGHT + BOTTOM_BAR_HEIGHT)
|
||||
|
||||
# Standardize width to perfectly match subpanel shells
|
||||
shell_w = min(rect.width - AETHER_LIST_METRICS.outer_margin_x * 2, AETHER_LIST_METRICS.max_content_width)
|
||||
|
||||
@@ -79,7 +79,7 @@ HEADER_SUBTITLE_HEIGHT = 24
|
||||
HEADER_BOTTOM_GAP = 12
|
||||
BROWSER_SECTION_HEADER_HEIGHT = AETHER_LIST_METRICS.section_header_height
|
||||
BROWSER_SECTION_HEADER_GAP = AETHER_LIST_METRICS.section_header_gap
|
||||
BROWSER_INSET = AETHER_LIST_METRICS.content_right_gutter
|
||||
BROWSER_INSET = 10
|
||||
BROWSER_TAB_GAP = AETHER_LIST_METRICS.section_header_gap
|
||||
BROWSER_CONTEXT_TAB_HEIGHT = 68
|
||||
BROWSER_REGION_ROW_HEIGHT = AETHER_LIST_METRICS.row_height
|
||||
|
||||
@@ -23,7 +23,7 @@ class TileSection:
|
||||
class SectionedTileLayout(Widget):
|
||||
def __init__(self, section_gap: int = 28, title_height: int = 49, title_gap: int = 17,
|
||||
min_row_height: int = 218, max_row_height: int = 406, top_padding: int = 0,
|
||||
horizontal_padding: int = SPACING.xl, max_content_width: int | None = 1560):
|
||||
horizontal_padding: int = 10, max_content_width: int | None = None):
|
||||
super().__init__()
|
||||
self._sections: list[TileSection] = []
|
||||
self._section_gap = section_gap
|
||||
|
||||
@@ -37,9 +37,6 @@ from openpilot.selfdrive.ui.layouts.settings.starpilot.aethergrid import (
|
||||
PANEL_STYLE = DEFAULT_PANEL_STYLE
|
||||
SOUNDS_PANEL_METRICS = replace(
|
||||
COMPACT_PANEL_METRICS,
|
||||
outer_margin_y=10,
|
||||
panel_padding_top=12,
|
||||
panel_padding_bottom=14,
|
||||
header_height=0,
|
||||
)
|
||||
|
||||
|
||||
@@ -95,11 +95,7 @@ REPORT_CATEGORIES = [
|
||||
FADE_HEIGHT = AETHER_LIST_METRICS.fade_height
|
||||
PANEL_STYLE = DEFAULT_PANEL_STYLE
|
||||
|
||||
SYSTEM_PANEL_METRICS = replace(
|
||||
AETHER_LIST_METRICS,
|
||||
outer_margin_y=14,
|
||||
panel_padding_bottom=14,
|
||||
)
|
||||
SYSTEM_PANEL_METRICS = AETHER_LIST_METRICS
|
||||
|
||||
|
||||
class SystemSettingsManagerView(PanelManagerView):
|
||||
|
||||
@@ -71,12 +71,7 @@ PANEL_STYLE = DEFAULT_PANEL_STYLE
|
||||
|
||||
|
||||
class VehicleSettingsManagerView(PanelManagerView):
|
||||
METRICS = replace(COMPACT_PANEL_METRICS,
|
||||
header_height=0,
|
||||
outer_margin_y=14,
|
||||
panel_padding_top=16,
|
||||
panel_padding_bottom=14,
|
||||
)
|
||||
METRICS = COMPACT_PANEL_METRICS
|
||||
|
||||
def __init__(self, controller: "StarPilotVehicleSettingsLayout"):
|
||||
super().__init__()
|
||||
|
||||
Reference in New Issue
Block a user