From a3ab6db7eb7a9664f934b75d78fca665faa77cec Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 3 Jan 2025 17:18:38 -0500 Subject: [PATCH] ui: sunnypilot panel in settings (#513) * ui: sunnypilot panel in settings * add panel to comment * test populate screenshot * Revert "test populate screenshot" This reverts commit 426b6c26c5acefe4ac239a3295aa45d3c5d2d275. --- .github/workflows/ui_preview.yaml | 2 +- selfdrive/ui/sunnypilot/SConscript | 1 + .../qt/offroad/settings/settings.cc | 3 +++ .../qt/offroad/settings/sunnypilot_panel.cc | 14 +++++++++++ .../qt/offroad/settings/sunnypilot_panel.h | 25 +++++++++++++++++++ selfdrive/ui/tests/test_ui/run.py | 12 ++++++--- 6 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 selfdrive/ui/sunnypilot/qt/offroad/settings/sunnypilot_panel.cc create mode 100644 selfdrive/ui/sunnypilot/qt/offroad/settings/sunnypilot_panel.h diff --git a/.github/workflows/ui_preview.yaml b/.github/workflows/ui_preview.yaml index f52101f816..dba6ab8037 100644 --- a/.github/workflows/ui_preview.yaml +++ b/.github/workflows/ui_preview.yaml @@ -86,7 +86,7 @@ jobs: run: >- sudo apt-get install -y imagemagick - scenes="homescreen settings_device settings_software settings_toggles settings_developer offroad_alert update_available prime onroad onroad_disengaged onroad_override onroad_sidebar onroad_wide onroad_wide_sidebar onroad_alert_small onroad_alert_mid onroad_alert_full driver_camera body keyboard" + scenes="homescreen settings_device settings_software settings_toggles settings_sunnypilot settings_developer offroad_alert update_available prime onroad onroad_disengaged onroad_override onroad_sidebar onroad_wide onroad_wide_sidebar onroad_alert_small onroad_alert_mid onroad_alert_full driver_camera body keyboard" A=($scenes) DIFF="" diff --git a/selfdrive/ui/sunnypilot/SConscript b/selfdrive/ui/sunnypilot/SConscript index efbe6a8e4a..5e42d8ae85 100644 --- a/selfdrive/ui/sunnypilot/SConscript +++ b/selfdrive/ui/sunnypilot/SConscript @@ -10,6 +10,7 @@ qt_src = [ "sunnypilot/qt/window.cc", "sunnypilot/qt/home.cc", "sunnypilot/qt/offroad/settings/settings.cc", + "sunnypilot/qt/offroad/settings/sunnypilot_panel.cc", "sunnypilot/qt/onroad/onroad_home.cc", ] diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/settings.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/settings.cc index 3a66101a82..ab1b0e23b7 100644 --- a/selfdrive/ui/sunnypilot/qt/offroad/settings/settings.cc +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/settings.cc @@ -11,6 +11,8 @@ #include "selfdrive/ui/sunnypilot/qt/widgets/scrollview.h" #include "selfdrive/ui/qt/offroad/developer_panel.h" +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/sunnypilot_panel.h" + TogglesPanelSP::TogglesPanelSP(SettingsWindow *parent) : TogglesPanel(parent) { QObject::connect(uiStateSP(), &UIStateSP::uiUpdate, this, &TogglesPanelSP::updateState); } @@ -68,6 +70,7 @@ SettingsWindowSP::SettingsWindowSP(QWidget *parent) : SettingsWindow(parent) { PanelInfo(" " + tr("Network"), networking, "../assets/offroad/icon_network.png"), PanelInfo(" " + tr("Toggles"), toggles, "../../sunnypilot/selfdrive/assets/offroad/icon_toggle.png"), PanelInfo(" " + tr("Software"), new SoftwarePanel(this), "../../sunnypilot/selfdrive/assets/offroad/icon_software.png"), + PanelInfo(" " + tr("sunnypilot"), new SunnypilotPanel(this), "../assets/images/button_home.png"), PanelInfo(" " + tr("Developer"), new DeveloperPanel(this), "../assets/offroad/icon_shell.png"), }; diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/sunnypilot_panel.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/sunnypilot_panel.cc new file mode 100644 index 0000000000..5e0619a09d --- /dev/null +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/sunnypilot_panel.cc @@ -0,0 +1,14 @@ +/** +* 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. + */ + +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/sunnypilot_panel.h" + +#include "common/util.h" +#include "selfdrive/ui/sunnypilot/qt/widgets/controls.h" + +SunnypilotPanel::SunnypilotPanel(SettingsWindowSP *parent) : ListWidget(parent) { +} diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/sunnypilot_panel.h b/selfdrive/ui/sunnypilot/qt/offroad/settings/sunnypilot_panel.h new file mode 100644 index 0000000000..25e5d7389b --- /dev/null +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/sunnypilot_panel.h @@ -0,0 +1,25 @@ +/** +* 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. + */ + +#pragma once + +#include +#include + +#include "selfdrive/ui/sunnypilot/ui.h" +#include "selfdrive/ui/qt/util.h" +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/settings.h" + +class SunnypilotPanel : public ListWidget { + Q_OBJECT + +public: + explicit SunnypilotPanel(SettingsWindowSP *parent = nullptr); + +private: + QStackedLayout* main_layout = nullptr; +}; diff --git a/selfdrive/ui/tests/test_ui/run.py b/selfdrive/ui/tests/test_ui/run.py index 7ffd66ed9a..366d66d108 100644 --- a/selfdrive/ui/tests/test_ui/run.py +++ b/selfdrive/ui/tests/test_ui/run.py @@ -42,17 +42,22 @@ def setup_settings_device(click, pm: PubMaster): def setup_settings_toggles(click, pm: PubMaster): setup_settings_device(click, pm) - click(278, 650) + click(278, 586) time.sleep(UI_DELAY) def setup_settings_software(click, pm: PubMaster): setup_settings_device(click, pm) - click(278, 800) + click(278, 716) + time.sleep(UI_DELAY) + +def setup_settings_sunnypilot(click, pm: PubMaster): + setup_settings_device(click, pm) + click(278, 846) time.sleep(UI_DELAY) def setup_settings_developer(click, pm: PubMaster): setup_settings_device(click, pm) - click(278, 960) + click(278, 976) time.sleep(UI_DELAY) def setup_onroad(click, pm: PubMaster): @@ -183,6 +188,7 @@ CASES = { "settings_device": setup_settings_device, "settings_toggles": setup_settings_toggles, "settings_software": setup_settings_software, + "settings_sunnypilot": setup_settings_sunnypilot, "settings_developer": setup_settings_developer, "onroad": setup_onroad, "onroad_disengaged": setup_onroad_disengaged,