From c9391afad509e4ae9e0579da612d60ea5325332d Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Wed, 5 Aug 2026 22:02:29 -0400 Subject: [PATCH] [mici] ui: fix swipe-down in sunnylink and models panels --- openpilot/selfdrive/ui/sunnypilot/mici/layouts/models.py | 6 ++---- openpilot/selfdrive/ui/sunnypilot/mici/layouts/settings.py | 4 ++-- openpilot/selfdrive/ui/sunnypilot/mici/layouts/sunnylink.py | 4 +--- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/openpilot/selfdrive/ui/sunnypilot/mici/layouts/models.py b/openpilot/selfdrive/ui/sunnypilot/mici/layouts/models.py index 8999281430..0e079041c7 100644 --- a/openpilot/selfdrive/ui/sunnypilot/mici/layouts/models.py +++ b/openpilot/selfdrive/ui/sunnypilot/mici/layouts/models.py @@ -48,10 +48,8 @@ class CurrentModelInfo(Widget): self.info_text.render() class ModelsLayoutMici(NavScroller): - def __init__(self, back_callback: Callable): + def __init__(self): super().__init__() - self.set_back_callback(back_callback) - self.original_back_callback = back_callback self.focused_widget = None self.current_model_info = CurrentModelInfo() @@ -139,7 +137,7 @@ class ModelsLayoutMici(NavScroller): def _reset_main_view(self): self._scroller._items = self.main_items # type: ignore[assignment] # ty: ignore[invalid-assignment] - self.set_back_callback(self.original_back_callback) + self.set_back_callback(None) self._scroller.scroll_panel.set_offset(0) self._scroller.scroll_to(0) diff --git a/openpilot/selfdrive/ui/sunnypilot/mici/layouts/settings.py b/openpilot/selfdrive/ui/sunnypilot/mici/layouts/settings.py index 96a4c789c1..f14efe51a3 100644 --- a/openpilot/selfdrive/ui/sunnypilot/mici/layouts/settings.py +++ b/openpilot/selfdrive/ui/sunnypilot/mici/layouts/settings.py @@ -32,11 +32,11 @@ class SettingsLayoutSP(OP.SettingsLayout): BIG_ICON_SIZE) self.icon_offroad_slider = gui_app.texture("icons_mici/settings/device/lkas.png", BIG_ICON_SIZE, BIG_ICON_SIZE) - sunnylink_panel = SunnylinkLayoutMici(back_callback=gui_app.pop_widget) + sunnylink_panel = SunnylinkLayoutMici() sunnylink_btn = SettingsBigButton(tr("sunnylink"), "", gui_app.texture("icons_mici/settings/developer/ssh.png", 55, 55)) sunnylink_btn.set_click_callback(lambda: gui_app.push_widget(sunnylink_panel)) - models_panel = ModelsLayoutMici(back_callback=gui_app.pop_widget) + models_panel = ModelsLayoutMici() models_btn = SettingsBigButton(tr("models"), "", gui_app.texture("../../sunnypilot/selfdrive/assets/offroad/icon_models.png", ICON_SIZE, ICON_SIZE)) models_btn.set_click_callback(lambda: gui_app.push_widget(models_panel)) diff --git a/openpilot/selfdrive/ui/sunnypilot/mici/layouts/sunnylink.py b/openpilot/selfdrive/ui/sunnypilot/mici/layouts/sunnylink.py index e804c78035..7c42f99f83 100644 --- a/openpilot/selfdrive/ui/sunnypilot/mici/layouts/sunnylink.py +++ b/openpilot/selfdrive/ui/sunnypilot/mici/layouts/sunnylink.py @@ -6,7 +6,6 @@ See the LICENSE.md file in the root directory for more details. """ import pyray as rl -from collections.abc import Callable from openpilot.cereal import custom from openpilot.selfdrive.ui.mici.widgets.button import BigButton, BigToggle @@ -54,9 +53,8 @@ class SunnylinkInfo(Widget): self.sponsor_text.render() class SunnylinkLayoutMici(NavScroller): - def __init__(self, back_callback: Callable): + def __init__(self): super().__init__() - self.set_back_callback(back_callback) self._restore_in_progress = False self._backup_in_progress = False self._sunnylink_enabled = ui_state.params.get("SunnylinkEnabled")