From c6b7a71fc2dfbf0a228c9a7711f6c3009bb43a01 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 22 Aug 2025 21:31:35 -0700 Subject: [PATCH] fix hide event --- selfdrive/ui/layouts/main.py | 15 +++++++++++++-- selfdrive/ui/layouts/settings/settings.py | 13 ++++++++++--- system/ui/lib/wifi_manager_v2.py | 2 ++ 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/selfdrive/ui/layouts/main.py b/selfdrive/ui/layouts/main.py index 3ab8525d33..cbd03da20c 100644 --- a/selfdrive/ui/layouts/main.py +++ b/selfdrive/ui/layouts/main.py @@ -63,14 +63,25 @@ class MainLayout(Widget): # Don't hide sidebar from interactive timeout if self._current_mode != MainState.ONROAD: self._sidebar.set_visible(False) - self._current_mode = MainState.ONROAD + + # TODO: helper + if self._current_mode != MainState.ONROAD: + self._layouts[self._current_mode].hide_event() + self._current_mode = MainState.ONROAD + self._layouts[self._current_mode].show_event() else: - self._current_mode = MainState.HOME + if self._current_mode != MainState.HOME: + self._layouts[self._current_mode].hide_event() + self._current_mode = MainState.HOME + self._layouts[self._current_mode].show_event() + self._sidebar.set_visible(True) def open_settings(self, panel_type: PanelType): self._layouts[MainState.SETTINGS].set_current_panel(panel_type) + self._layouts[self._current_mode].hide_event() self._current_mode = MainState.SETTINGS + self._layouts[self._current_mode].show_event() self._sidebar.set_visible(False) def _on_settings_clicked(self): diff --git a/selfdrive/ui/layouts/settings/settings.py b/selfdrive/ui/layouts/settings/settings.py index 372185f860..89e39562b5 100644 --- a/selfdrive/ui/layouts/settings/settings.py +++ b/selfdrive/ui/layouts/settings/settings.py @@ -166,6 +166,13 @@ class SettingsLayout(Widget): self._current_panel = panel_type self._panels[self._current_panel].instance.show_event() - def close_settings(self): - if self._close_callback: - self._close_callback() + def hide_event(self): + for panel_info in self._panels.values(): + panel_info.instance.hide_event() + + # def close_settings(self): + # print("Closing settings") + # self.hide_event() + # + # if self._close_callback: + # self._close_callback() diff --git a/system/ui/lib/wifi_manager_v2.py b/system/ui/lib/wifi_manager_v2.py index 5d3993e485..ca00d9a222 100644 --- a/system/ui/lib/wifi_manager_v2.py +++ b/system/ui/lib/wifi_manager_v2.py @@ -205,6 +205,7 @@ class WifiManager: print('we;re acti!!!!!!!!!!!!') # Scan for networks every 5 seconds if i % 5 == 0: + # TODO: should watch when scan is complete, but this is more than good enough for now self._update_networks() self._request_scan() @@ -212,6 +213,7 @@ class WifiManager: time.sleep(1) def set_active(self, active: bool): + print('SETTING ACTIVE', active) self._active = active def _get_wifi_device(self) -> dbus.ObjectPath | None: