diff --git a/selfdrive/ui/sunnypilot/layouts/settings/device.py b/selfdrive/ui/sunnypilot/layouts/settings/device.py index 85aa79c8e8..081969cf10 100644 --- a/selfdrive/ui/sunnypilot/layouts/settings/device.py +++ b/selfdrive/ui/sunnypilot/layouts/settings/device.py @@ -1,5 +1,12 @@ +""" +Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. + +This file is part of sunnypilot and is licensed under the MIT License. +See the LICENSE.md file in the root directory for more details. +""" from openpilot.selfdrive.ui.layouts.settings.device import DeviceLayout + class DeviceLayoutSP(DeviceLayout): def __init__(self): DeviceLayout.__init__(self) diff --git a/selfdrive/ui/sunnypilot/layouts/settings/settings.py b/selfdrive/ui/sunnypilot/layouts/settings/settings.py index 21f39b3b46..d894b57270 100644 --- a/selfdrive/ui/sunnypilot/layouts/settings/settings.py +++ b/selfdrive/ui/sunnypilot/layouts/settings/settings.py @@ -1,13 +1,20 @@ -import pyray as rl +""" +Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. + +This file is part of sunnypilot and is licensed under the MIT License. +See the LICENSE.md file in the root directory for more details. +""" from dataclasses import dataclass from enum import IntEnum + +import pyray as rl from openpilot.selfdrive.ui.layouts.settings import settings as OP from openpilot.selfdrive.ui.layouts.settings.developer import DeveloperLayout from openpilot.selfdrive.ui.sunnypilot.layouts.settings.device import DeviceLayoutSP from openpilot.selfdrive.ui.layouts.settings.firehose import FirehoseLayout from openpilot.selfdrive.ui.layouts.settings.software import SoftwareLayout from openpilot.selfdrive.ui.layouts.settings.toggles import TogglesLayout -from openpilot.system.ui.lib.application import gui_app,MousePos +from openpilot.system.ui.lib.application import gui_app, MousePos from openpilot.system.ui.lib.multilang import tr_noop from openpilot.system.ui.sunnypilot.lib.styles import style from openpilot.system.ui.widgets.scroller_tici import Scroller @@ -24,12 +31,13 @@ from openpilot.selfdrive.ui.sunnypilot.layouts.settings.steering import Steering from openpilot.selfdrive.ui.sunnypilot.layouts.settings.cruise import CruiseLayout from openpilot.selfdrive.ui.sunnypilot.layouts.settings.visuals import VisualsLayout from openpilot.selfdrive.ui.sunnypilot.layouts.settings.display import DisplayLayout -#from openpilot.selfdrive.ui.sunnypilot.layouts.settings.navigation import NavigationLayout + +# from openpilot.selfdrive.ui.sunnypilot.layouts.settings.navigation import NavigationLayout OP.PANEL_COLOR = rl.Color(10, 10, 10, 255) ICON_SIZE = 70 -OP.PanelType = IntEnum( # type: ignore +OP.PanelType = IntEnum( # type: ignore "PanelType", [es.name for es in OP.PanelType] + [ "SUNNYLINK", @@ -44,7 +52,8 @@ OP.PanelType = IntEnum( # type: ignore "VEHICLE", ], start=0, - ) +) + @dataclass class PanelInfo(OP.PanelInfo): @@ -57,7 +66,7 @@ class SettingsLayoutSP(OP.SettingsLayout): self._nav_items: list[Widget] = [] # Create sidebar scroller - self._sidebar_scroller = Scroller([], spacing=0, line_separator = False, pad_end=False) + self._sidebar_scroller = Scroller([], spacing=0, line_separator=False, pad_end=False) # Panel configuration wifi_manager = WifiManager() @@ -75,7 +84,7 @@ class SettingsLayoutSP(OP.SettingsLayout): OP.PanelType.VISUALS: PanelInfo(tr_noop("Visuals"), VisualsLayout(), icon="../../sunnypilot/selfdrive/assets/offroad/icon_visuals.png"), OP.PanelType.DISPLAY: PanelInfo(tr_noop("Display"), DisplayLayout(), icon="../../sunnypilot/selfdrive/assets/offroad/icon_display.png"), OP.PanelType.OSM: PanelInfo(tr_noop("OSM"), OSMLayout(), icon="../../sunnypilot/selfdrive/assets/offroad/icon_map.png"), - #OP.PanelType.NAVIGATION: PanelInfo(tr_noop("Navigation"), NavigationLayout(), icon="../../sunnypilot/selfdrive/assets/offroad/icon_map.png"), + # OP.PanelType.NAVIGATION: PanelInfo(tr_noop("Navigation"), NavigationLayout(), icon="../../sunnypilot/selfdrive/assets/offroad/icon_map.png"), OP.PanelType.TRIPS: PanelInfo(tr_noop("Trips"), TripsLayout(), icon="../../sunnypilot/selfdrive/assets/offroad/icon_trips.png"), OP.PanelType.VEHICLE: PanelInfo(tr_noop("Vehicle"), VehicleLayout(), icon="../../sunnypilot/selfdrive/assets/offroad/icon_vehicle.png"), OP.PanelType.FIREHOSE: PanelInfo(tr_noop("Firehose"), FirehoseLayout(), icon="../../sunnypilot/selfdrive/assets/offroad/icon_firehose.png"), @@ -139,7 +148,7 @@ class SettingsLayoutSP(OP.SettingsLayout): close_btn_rect.y + (close_btn_rect.height - self._close_icon.height) / 2, self._close_icon.width, self._close_icon.height, - ) + ) rl.draw_texture_pro( self._close_icon, rl.Rectangle(0, 0, self._close_icon.width, self._close_icon.height), @@ -173,7 +182,6 @@ class SettingsLayoutSP(OP.SettingsLayout): self._sidebar_scroller.render(nav_rect) return - def _handle_mouse_release(self, mouse_pos: MousePos) -> bool: # Check close button if rl.check_collision_point_rec(mouse_pos, self._close_btn_rect): diff --git a/system/ui/sunnypilot/lib/styles.py b/system/ui/sunnypilot/lib/styles.py index f87894a6b1..4880ad58de 100644 --- a/system/ui/sunnypilot/lib/styles.py +++ b/system/ui/sunnypilot/lib/styles.py @@ -30,7 +30,7 @@ class DefaultStyleSP(Base): # Base Colors BASE_BG_COLOR = rl.Color(57, 57, 57, 255) # Grey ON_BG_COLOR = rl.Color(28, 101, 186, 255) # Blue - OFF_BG_COLOR = rl.Color(70, 70, 70, 255) # Lighter Grey + OFF_BG_COLOR = BASE_BG_COLOR ON_HOVER_BG_COLOR = rl.Color(17, 78, 150, 255) # Dark Blue OFF_HOVER_BG_COLOR = rl.Color(21, 21, 21, 255) # Dark gray DISABLED_ON_BG_COLOR = rl.Color(37, 70, 107, 255) # Dull Blue