BigUI WIP: Pushpop Wires

This commit is contained in:
firestarsdog
2026-06-05 18:31:50 -04:00
parent 2847d0fd8a
commit 2880189713
8 changed files with 40 additions and 40 deletions
+2 -2
View File
@@ -194,11 +194,11 @@ class OnboardingWindow(Widget):
ui_state.params.put("HasAcceptedTerms", terms_version)
self._state = OnboardingState.ONBOARDING
if self._training_done:
gui_app.set_modal_overlay(None)
gui_app.pop_widget()
def _on_completed_training(self):
ui_state.params.put("CompletedTrainingVersion", training_version)
gui_app.set_modal_overlay(None)
gui_app.pop_widget()
def _render(self, _):
if self._training_guide is None:
+19 -19
View File
@@ -92,18 +92,18 @@ class DeviceLayout(Widget):
self._select_language_dialog = None
self._select_language_dialog = MultiOptionDialog(tr("Select a language"), multilang.languages, multilang.codes[multilang.language],
option_font_weight=FontWeight.UNIFONT)
gui_app.set_modal_overlay(self._select_language_dialog, callback=handle_language_selection)
option_font_weight=FontWeight.UNIFONT, callback=handle_language_selection)
gui_app.push_widget(self._select_language_dialog)
def _show_driver_camera(self):
if not self._driver_camera:
self._driver_camera = DriverCameraDialog()
gui_app.set_modal_overlay(self._driver_camera, callback=lambda result: setattr(self, '_driver_camera', None))
gui_app.push_widget(self._driver_camera)
def _reset_calibration_prompt(self):
if ui_state.engaged:
gui_app.set_modal_overlay(alert_dialog(tr("Disengage to Reset Calibration")))
gui_app.push_widget(alert_dialog(tr("Disengage to Reset Calibration")))
return
def reset_calibration(result: int):
@@ -119,12 +119,12 @@ class DeviceLayout(Widget):
self._params.put_bool("OnroadCycleRequested", True)
self._update_calib_description()
dialog = ConfirmDialog(tr("Are you sure you want to reset calibration?"), tr("Reset"))
gui_app.set_modal_overlay(dialog, callback=reset_calibration)
dialog = ConfirmDialog(tr("Are you sure you want to reset calibration?"), tr("Reset"), callback=reset_calibration)
gui_app.push_widget(dialog)
def _reset_driver_monitoring_prompt(self):
if ui_state.engaged:
gui_app.set_modal_overlay(alert_dialog(tr("Disengage to Reset Driver Monitoring")))
gui_app.push_widget(alert_dialog(tr("Disengage to Reset Driver Monitoring")))
return
def reset_driver_monitoring(result: int):
@@ -136,8 +136,8 @@ class DeviceLayout(Widget):
self._params.remove("IsRHDOverride")
self._params.put_bool("OnroadCycleRequested", True)
dialog = ConfirmDialog(tr("Are you sure you want to reset driver monitoring calibration?"), tr("Reset"))
gui_app.set_modal_overlay(dialog, callback=reset_driver_monitoring)
dialog = ConfirmDialog(tr("Are you sure you want to reset driver monitoring calibration?"), tr("Reset"), callback=reset_driver_monitoring)
gui_app.push_widget(dialog)
def _update_calib_description(self):
desc = tr(DESCRIPTIONS['reset_calibration'])
@@ -189,11 +189,11 @@ class DeviceLayout(Widget):
def _reboot_prompt(self):
if ui_state.engaged:
gui_app.set_modal_overlay(alert_dialog(tr("Disengage to Reboot")))
gui_app.push_widget(alert_dialog(tr("Disengage to Reboot")))
return
dialog = ConfirmDialog(tr("Are you sure you want to reboot?"), tr("Reboot"))
gui_app.set_modal_overlay(dialog, callback=self._perform_reboot)
dialog = ConfirmDialog(tr("Are you sure you want to reboot?"), tr("Reboot"), callback=self._perform_reboot)
gui_app.push_widget(dialog)
def _perform_reboot(self, result: int):
if not ui_state.engaged and result == DialogResult.CONFIRM:
@@ -201,11 +201,11 @@ class DeviceLayout(Widget):
def _power_off_prompt(self):
if ui_state.engaged:
gui_app.set_modal_overlay(alert_dialog(tr("Disengage to Power Off")))
gui_app.push_widget(alert_dialog(tr("Disengage to Power Off")))
return
dialog = ConfirmDialog(tr("Are you sure you want to power off?"), tr("Power Off"))
gui_app.set_modal_overlay(dialog, callback=self._perform_power_off)
dialog = ConfirmDialog(tr("Are you sure you want to power off?"), tr("Power Off"), callback=self._perform_power_off)
gui_app.push_widget(dialog)
def _perform_power_off(self, result: int):
if not ui_state.engaged and result == DialogResult.CONFIRM:
@@ -214,17 +214,17 @@ class DeviceLayout(Widget):
def _pair_device(self):
if not self._pair_device_dialog:
self._pair_device_dialog = PairingDialog()
gui_app.set_modal_overlay(self._pair_device_dialog, callback=lambda result: setattr(self, '_pair_device_dialog', None))
gui_app.push_widget(self._pair_device_dialog)
def _on_regulatory(self):
if not self._fcc_dialog:
self._fcc_dialog = HtmlModal(os.path.join(BASEDIR, "selfdrive/assets/offroad/fcc.html"))
gui_app.set_modal_overlay(self._fcc_dialog)
gui_app.push_widget(self._fcc_dialog)
def _on_review_training_guide(self):
if not self._training_guide:
def completed_callback():
gui_app.set_modal_overlay(None)
gui_app.pop_widget()
self._training_guide = TrainingGuide(completed_callback=completed_callback)
gui_app.set_modal_overlay(self._training_guide)
gui_app.push_widget(self._training_guide)
+9 -9
View File
@@ -194,25 +194,25 @@ class SoftwareLayout(Widget):
ui_state.params.clear_all()
ui_state.params.put_bool("DoUninstall", True)
dialog = ConfirmDialog(tr("This is a complete factory reset and cannot be undone. Are you absolutely sure?"), tr("Reset"))
gui_app.set_modal_overlay(dialog, callback=handle_step3)
dialog = ConfirmDialog(tr("This is a complete factory reset and cannot be undone. Are you absolutely sure?"), tr("Reset"), callback=handle_step3)
gui_app.push_widget(dialog)
else:
ui_state.params.put_bool("DoUninstall", True)
dialog = ConfirmDialog(
tr("Do you want to perform a full factory reset? All saved assets and settings will be permanently deleted!"), tr("Factory Reset"), tr("Skip")
tr("Do you want to perform a full factory reset? All saved assets and settings will be permanently deleted!"), tr("Factory Reset"), tr("Skip"), callback=handle_step2
)
gui_app.set_modal_overlay(dialog, callback=handle_step2)
gui_app.push_widget(dialog)
dialog = ConfirmDialog(tr("Are you sure you want to uninstall?"), tr("Uninstall"))
gui_app.set_modal_overlay(dialog, callback=handle_step1)
dialog = ConfirmDialog(tr("Are you sure you want to uninstall?"), tr("Uninstall"), callback=handle_step1)
gui_app.push_widget(dialog)
def _on_error_log(self):
try:
txt = Path("/data/error_logs/error.txt").read_text(encoding='utf-8', errors='replace')
except Exception:
txt = tr("No error log found.")
gui_app.set_modal_overlay(ConfirmDialog(txt, tr("OK"), on_close=lambda r: None, rich=True))
gui_app.push_widget(ConfirmDialog(txt, tr("OK"), rich=True))
def _on_install_update(self):
# Trigger reboot to install update
@@ -231,7 +231,6 @@ class SoftwareLayout(Widget):
branches.insert(0, b)
current_target = ui_state.params.get("UpdaterTargetBranch") or ""
self._branch_dialog = MultiOptionDialog(tr("Select a branch"), branches, current_target)
def handle_selection(result):
# Confirmed selection
@@ -242,4 +241,5 @@ class SoftwareLayout(Widget):
os.system("pkill -SIGUSR1 -f system.updated.updated")
self._branch_dialog = None
gui_app.set_modal_overlay(self._branch_dialog, callback=handle_selection)
self._branch_dialog = MultiOptionDialog(tr("Select a branch"), branches, current_target, callback=handle_selection)
gui_app.push_widget(self._branch_dialog)
@@ -269,4 +269,4 @@ class StarPilotLateralLayout(_SettingsPage):
if res == DialogResult.CONFIRM:
self._params.put_int("LaneChangeSmoothing", int(val))
current = self._params.get_int("LaneChangeSmoothing") if self._params.get_int("LaneChangeSmoothing") > 0 else 10
gui_app.set_modal_overlay(AetherSliderDialog(tr("Lane Change Smoothing"), 1, 10, 1, current, on_close, color=PANEL_STYLE.accent))
gui_app.push_widget(AetherSliderDialog(tr("Lane Change Smoothing"), 1, 10, 1, current, on_close, color=PANEL_STYLE.accent))
+2 -2
View File
@@ -243,8 +243,8 @@ class TogglesLayout(Widget):
# show confirmation dialog
content = (f"<h1>{self._toggles['ExperimentalMode'].title}</h1><br>" +
f"<p>{self._toggles['ExperimentalMode'].description}</p>")
dlg = ConfirmDialog(content, tr("Enable"), rich=True)
gui_app.set_modal_overlay(dlg, callback=confirm_callback)
dlg = ConfirmDialog(content, tr("Enable"), rich=True, callback=confirm_callback)
gui_app.push_widget(dlg)
else:
self._update_experimental_mode_icon()
self._params.put_bool("ExperimentalMode", state)
+2 -2
View File
@@ -26,7 +26,7 @@ class PairingDialog(Widget):
self.qr_texture: rl.Texture | None = None
self.last_qr_generation = float('-inf')
self._close_btn = IconButton(gui_app.texture("icons/close.png", 80, 80))
self._close_btn.set_click_callback(lambda: gui_app.set_modal_overlay(None))
self._close_btn.set_click_callback(lambda: gui_app.pop_widget())
def _get_pairing_url(self) -> str:
try:
@@ -69,7 +69,7 @@ class PairingDialog(Widget):
def _update_state(self):
if ui_state.prime_state.is_paired():
gui_app.set_modal_overlay(None)
gui_app.pop_widget()
def _render(self, rect: rl.Rectangle) -> int:
rl.clear_background(rl.Color(224, 224, 224, 255))
+2 -2
View File
@@ -62,12 +62,12 @@ class SetupWidget(Widget):
def _show_pairing(self):
if not system_time_valid():
dlg = alert_dialog(tr("Please connect to Wi-Fi to complete initial pairing"))
gui_app.set_modal_overlay(dlg)
gui_app.push_widget(dlg)
return
if not self._pairing_dialog:
self._pairing_dialog = PairingDialog()
gui_app.set_modal_overlay(self._pairing_dialog, lambda result: setattr(self, '_pairing_dialog', None))
gui_app.push_widget(self._pairing_dialog)
def __del__(self):
if self._pairing_dialog:
+3 -3
View File
@@ -84,7 +84,7 @@ class SshKeyAction(ItemAction):
def __init__(self):
super().__init__(self.MAX_WIDTH, True)
self._keyboard = Keyboard(min_text_size=1)
self._keyboard = Keyboard(min_text_size=1, callback=self._on_username_submit)
self._params = Params()
self._error_message: str = ""
self._text_font = gui_app.font(FontWeight.NORMAL)
@@ -105,7 +105,7 @@ class SshKeyAction(ItemAction):
# Show error dialog if there's an error
if self._error_message:
message = copy.copy(self._error_message)
gui_app.set_modal_overlay(alert_dialog(message))
gui_app.push_widget(alert_dialog(message))
self._username = ""
self._error_message = ""
@@ -133,7 +133,7 @@ class SshKeyAction(ItemAction):
if self._state == SshKeyActionState.ADD:
self._keyboard.reset()
self._keyboard.set_title(tr("Enter your GitHub username"))
gui_app.set_modal_overlay(self._keyboard, callback=self._on_username_submit)
gui_app.push_widget(self._keyboard)
elif self._state == SshKeyActionState.REMOVE:
self._params.remove("GithubUsername")
self._params.remove("GithubSshKeys")