Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Developer Panel in Settings #33828

Merged
merged 14 commits into from
Oct 26, 2024
2 changes: 1 addition & 1 deletion .github/workflows/ui_preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
run: >-
sudo apt-get install -y imagemagick

scenes="homescreen settings_device settings_toggles 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_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"
A=($scenes)

DIFF=""
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/ui/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ qt_libs = [widgets, qt_util] + base_libs

qt_src = ["main.cc", "ui.cc", "qt/sidebar.cc", "qt/body.cc",
"qt/window.cc", "qt/home.cc", "qt/offroad/settings.cc",
"qt/offroad/software_settings.cc", "qt/offroad/onboarding.cc",
"qt/offroad/software_settings.cc", "qt/offroad/developer_panel.cc", "qt/offroad/onboarding.cc",
"qt/offroad/driverview.cc", "qt/offroad/experimental_mode.cc",
"qt/onroad/onroad_home.cc", "qt/onroad/annotated_camera.cc", "qt/onroad/model.cc",
"qt/onroad/buttons.cc", "qt/onroad/alerts.cc", "qt/onroad/driver_monitoring.cc", "qt/onroad/hud.cc"]
Expand Down
4 changes: 0 additions & 4 deletions selfdrive/ui/qt/network/networking.cc
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,6 @@ AdvancedNetworking::AdvancedNetworking(QWidget* parent, WifiManager* wifi): QWid
ipLabel = new LabelControl(tr("IP Address"), wifi->ipv4_address);
list->addItem(ipLabel);

// SSH keys
list->addItem(new SshToggle());
list->addItem(new SshControl());

// Roaming toggle
const bool roamingEnabled = params.getBool("GsmRoaming");
roamingToggle = new ToggleControl(tr("Enable Roaming"), "", "", roamingEnabled);
Expand Down
41 changes: 41 additions & 0 deletions selfdrive/ui/qt/offroad/developer_panel.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#include <QDebug>

#include "selfdrive/ui/qt/offroad/settings.h"
#include "selfdrive/ui/qt/offroad/developer_panel.h"
#include "selfdrive/ui/qt/widgets/ssh_keys.h"

DeveloperPanel::DeveloperPanel(SettingsWindow *parent) : ListWidget(parent) {
// SSH keys
addItem(new SshToggle());
sshControlButton = new SshControl();
addItem(sshControlButton);

joystickDebugModeButton = new ButtonControl(tr("Joystick Debug Mode"), tr("JOYSTICK"));
connect(joystickDebugModeButton, &ButtonControl::clicked, [=]() {
if (ConfirmationDialog::confirm(tr("Are you sure you want to openpilot in JoystickDebugMode?"), tr("Joystick"), this)) {
params.putBool("JoystickDebugMode", true);
}
});
addItem(joystickDebugModeButton);

LongitudinalManeuverModeButton = new ButtonControl(tr("Longitudinal Maneuver Mode"), tr("MANEUVER"));
connect(LongitudinalManeuverModeButton, &ButtonControl::clicked, [=]() {
if (ConfirmationDialog::confirm(tr("Are you sure you want to openpilot in LongitudinalManeuverMode?"), tr("Maneuver"), this)) {
params.putBool("LongitudinalManeuverMode", true);
}
});
addItem(LongitudinalManeuverModeButton);

// Joystick and longitudinal maneuvers should be hidden on release branches
// also the buttons should be not available to push in onroad state
const bool is_release = params.getBool("IsReleaseBranch");
QObject::connect(uiState(), &UIState::offroadTransition, [=](bool offroad) {
for (auto btn : findChildren<ButtonControl *>()) {
if (btn != sshControlButton) {
btn->setVisible(!is_release);
}
btn->setEnabled(offroad);
}
});

}
15 changes: 15 additions & 0 deletions selfdrive/ui/qt/offroad/developer_panel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once

#include "selfdrive/ui/qt/offroad/settings.h"

class DeveloperPanel : public ListWidget {
Q_OBJECT
public:
explicit DeveloperPanel(SettingsWindow *parent);

private:
Params params;
ButtonControl *sshControlButton;
ButtonControl *joystickDebugModeButton;
ButtonControl *LongitudinalManeuverModeButton;
};
2 changes: 2 additions & 0 deletions selfdrive/ui/qt/offroad/settings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "selfdrive/ui/qt/qt_window.h"
#include "selfdrive/ui/qt/widgets/prime.h"
#include "selfdrive/ui/qt/widgets/scrollview.h"
#include "selfdrive/ui/qt/offroad/developer_panel.h"

TogglesPanel::TogglesPanel(SettingsWindow *parent) : ListWidget(parent) {
// param, title, desc, icon
Expand Down Expand Up @@ -388,6 +389,7 @@ SettingsWindow::SettingsWindow(QWidget *parent) : QFrame(parent) {
{tr("Network"), networking},
{tr("Toggles"), toggles},
{tr("Software"), new SoftwarePanel(this)},
{tr("Developer"), new DeveloperPanel(this)},
};

nav_btns = new QButtonGroup(this);
Expand Down
8 changes: 7 additions & 1 deletion selfdrive/ui/tests/test_ui/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ def setup_settings_device(click, pm: PubMaster):

def setup_settings_toggles(click, pm: PubMaster):
setup_settings_device(click, pm)
click(278, 760)
click(278, 650)
time.sleep(UI_DELAY)

def setup_settings_developer(click, pm: PubMaster):
setup_settings_device(click, pm)
click(278, 960)
time.sleep(UI_DELAY)

def setup_onroad(click, pm: PubMaster):
Expand Down Expand Up @@ -175,6 +180,7 @@ def setup_pair_device(click, pm: PubMaster):
"pair_device": setup_pair_device,
"settings_device": setup_settings_device,
"settings_toggles": setup_settings_toggles,
"settings_developer": setup_settings_developer,
AlexandreSato marked this conversation as resolved.
Show resolved Hide resolved
"onroad": setup_onroad,
"onroad_disengaged": setup_onroad_disengaged,
"onroad_override": setup_onroad_override,
Expand Down
39 changes: 39 additions & 0 deletions selfdrive/ui/translations/main_ar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,41 @@
<translation>رفض، إلغاء التثبيت %1</translation>
</message>
</context>
<context>
<name>DeveloperPanel</name>
<message>
<source>Joystick Debug Mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>JOYSTICK</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Longitudinal Maneuver Mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MANEUVER</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Are you sure you want to openpilot in JoystickDebugMode?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Joystick</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Are you sure you want to openpilot in LongitudinalManeuverMode?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Maneuver</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DevicePanel</name>
<message>
Expand Down Expand Up @@ -618,6 +653,10 @@ This may take up to a minute.</source>
<source>Software</source>
<translation>البرنامج</translation>
</message>
<message>
<source>Developer</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Setup</name>
Expand Down
39 changes: 39 additions & 0 deletions selfdrive/ui/translations/main_de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,41 @@
<translation>Ablehnen, deinstallieren %1</translation>
</message>
</context>
<context>
<name>DeveloperPanel</name>
<message>
<source>Joystick Debug Mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>JOYSTICK</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Longitudinal Maneuver Mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MANEUVER</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Are you sure you want to openpilot in JoystickDebugMode?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Joystick</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Are you sure you want to openpilot in LongitudinalManeuverMode?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Maneuver</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DevicePanel</name>
<message>
Expand Down Expand Up @@ -600,6 +635,10 @@ This may take up to a minute.</source>
<source>Software</source>
<translation>Software</translation>
</message>
<message>
<source>Developer</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Setup</name>
Expand Down
39 changes: 39 additions & 0 deletions selfdrive/ui/translations/main_es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,41 @@
<translation>Rechazar, desinstalar %1</translation>
</message>
</context>
<context>
<name>DeveloperPanel</name>
<message>
<source>Joystick Debug Mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>JOYSTICK</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Longitudinal Maneuver Mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MANEUVER</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Are you sure you want to openpilot in JoystickDebugMode?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Joystick</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Are you sure you want to openpilot in LongitudinalManeuverMode?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Maneuver</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DevicePanel</name>
<message>
Expand Down Expand Up @@ -602,6 +637,10 @@ Esto puede tardar un minuto.</translation>
<source>Software</source>
<translation>Software</translation>
</message>
<message>
<source>Developer</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Setup</name>
Expand Down
39 changes: 39 additions & 0 deletions selfdrive/ui/translations/main_fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,41 @@
<translation>Refuser, désinstaller %1</translation>
</message>
</context>
<context>
<name>DeveloperPanel</name>
<message>
<source>Joystick Debug Mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>JOYSTICK</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Longitudinal Maneuver Mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MANEUVER</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Are you sure you want to openpilot in JoystickDebugMode?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Joystick</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Are you sure you want to openpilot in LongitudinalManeuverMode?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Maneuver</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DevicePanel</name>
<message>
Expand Down Expand Up @@ -602,6 +637,10 @@ Cela peut prendre jusqu&apos;à une minute.</translation>
<source>Software</source>
<translation>Logiciel</translation>
</message>
<message>
<source>Developer</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Setup</name>
Expand Down
39 changes: 39 additions & 0 deletions selfdrive/ui/translations/main_ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,41 @@
<translation>拒否して %1 をアンインストール</translation>
</message>
</context>
<context>
<name>DeveloperPanel</name>
<message>
<source>Joystick Debug Mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>JOYSTICK</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Longitudinal Maneuver Mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MANEUVER</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Are you sure you want to openpilot in JoystickDebugMode?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Joystick</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Are you sure you want to openpilot in LongitudinalManeuverMode?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Maneuver</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DevicePanel</name>
<message>
Expand Down Expand Up @@ -596,6 +631,10 @@ This may take up to a minute.</source>
<source>Software</source>
<translation>ソフトウェア</translation>
</message>
<message>
<source>Developer</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Setup</name>
Expand Down
Loading
Loading