diff --git a/selfdrive/ui/mici/layouts/settings/developer.py b/selfdrive/ui/mici/layouts/settings/developer.py index 4d6bdfc3bb..4e7796814e 100644 --- a/selfdrive/ui/mici/layouts/settings/developer.py +++ b/selfdrive/ui/mici/layouts/settings/developer.py @@ -11,7 +11,6 @@ from openpilot.selfdrive.ui.widgets.ssh_key import SshKeyAction class DeveloperLayoutMici(NavScroller): def __init__(self): super().__init__() - self.set_back_callback(gui_app.pop_widget) def github_username_callback(username: str): if username: diff --git a/selfdrive/ui/mici/layouts/settings/device.py b/selfdrive/ui/mici/layouts/settings/device.py index 077411c95a..d754b9f980 100644 --- a/selfdrive/ui/mici/layouts/settings/device.py +++ b/selfdrive/ui/mici/layouts/settings/device.py @@ -29,7 +29,6 @@ class MiciFccModal(NavWidget): def __init__(self, file_path: str | None = None, text: str | None = None): super().__init__() - self.set_back_callback(gui_app.pop_widget) self._content = HtmlRenderer(file_path=file_path, text=text) self._scroll_panel = GuiScrollPanel2(horizontal=False) self._scroll_panel.set_enabled(lambda: self.enabled and not self._swiping_away) @@ -328,10 +327,6 @@ class DeviceLayoutMici(NavScroller): self._power_off_btn, ]) - # Set up back navigation - # TODO: can this somehow be generic in widgets/__init__.py or application.py? - self.set_back_callback(gui_app.pop_widget) - def _on_regulatory(self): if not self._fcc_dialog: self._fcc_dialog = MiciFccModal(os.path.join(BASEDIR, "selfdrive/assets/offroad/mici_fcc.html")) diff --git a/selfdrive/ui/mici/layouts/settings/firehose.py b/selfdrive/ui/mici/layouts/settings/firehose.py index b2c06d7299..d16a04019f 100644 --- a/selfdrive/ui/mici/layouts/settings/firehose.py +++ b/selfdrive/ui/mici/layouts/settings/firehose.py @@ -223,5 +223,4 @@ class FirehoseLayout(FirehoseLayoutBase, NavWidget): def __init__(self): super().__init__() - self.set_back_callback(gui_app.pop_widget) self._scroll_panel.set_enabled(lambda: self.enabled and not self._swiping_away) diff --git a/selfdrive/ui/mici/layouts/settings/network/__init__.py b/selfdrive/ui/mici/layouts/settings/network/__init__.py index ae7d085e01..553a74fc60 100644 --- a/selfdrive/ui/mici/layouts/settings/network/__init__.py +++ b/selfdrive/ui/mici/layouts/settings/network/__init__.py @@ -148,9 +148,6 @@ class NetworkLayoutMici(NavScroller): metered = ui_state.params.get_bool("GsmMetered") self._wifi_manager.update_gsm_settings(roaming_enabled, ui_state.params.get("GsmApn") or "", metered) - # Set up back navigation - self.set_back_callback(gui_app.pop_widget) - def _update_state(self): super()._update_state() diff --git a/selfdrive/ui/mici/layouts/settings/network/wifi_ui.py b/selfdrive/ui/mici/layouts/settings/network/wifi_ui.py index a73a397d1a..cc45daf24b 100644 --- a/selfdrive/ui/mici/layouts/settings/network/wifi_ui.py +++ b/selfdrive/ui/mici/layouts/settings/network/wifi_ui.py @@ -272,9 +272,6 @@ class WifiUIMici(NavScroller): def __init__(self, wifi_manager: WifiManager): super().__init__() - # Set up back navigation - self.set_back_callback(gui_app.pop_widget) - self._loading_animation = LoadingAnimation() self._wifi_manager = wifi_manager diff --git a/selfdrive/ui/mici/layouts/settings/settings.py b/selfdrive/ui/mici/layouts/settings/settings.py index d996e01fed..c7fb3201f5 100644 --- a/selfdrive/ui/mici/layouts/settings/settings.py +++ b/selfdrive/ui/mici/layouts/settings/settings.py @@ -49,7 +49,4 @@ class SettingsLayout(NavScroller): developer_btn, ]) - # Set up back navigation - self.set_back_callback(gui_app.pop_widget) - self._font_medium = gui_app.font(FontWeight.MEDIUM) diff --git a/selfdrive/ui/mici/layouts/settings/toggles.py b/selfdrive/ui/mici/layouts/settings/toggles.py index a7a7bff6e2..acb502fda0 100644 --- a/selfdrive/ui/mici/layouts/settings/toggles.py +++ b/selfdrive/ui/mici/layouts/settings/toggles.py @@ -12,7 +12,6 @@ PERSONALITY_TO_INT = log.LongitudinalPersonality.schema.enumerants class TogglesLayoutMici(NavScroller): def __init__(self): super().__init__() - self.set_back_callback(gui_app.pop_widget) self._personality_toggle = BigMultiParamToggle("driving personality", "LongitudinalPersonality", ["aggressive", "standard", "relaxed"]) self._experimental_btn = BigParamControl("experimental mode", "ExperimentalMode") diff --git a/selfdrive/ui/mici/onroad/driver_camera_dialog.py b/selfdrive/ui/mici/onroad/driver_camera_dialog.py index 4fddc88f6d..dfa8beeb77 100644 --- a/selfdrive/ui/mici/onroad/driver_camera_dialog.py +++ b/selfdrive/ui/mici/onroad/driver_camera_dialog.py @@ -35,7 +35,6 @@ class DriverCameraDialog(NavWidget): if not no_escape: # TODO: this can grow unbounded, should be given some thought device.add_interactive_timeout_callback(gui_app.pop_widget) - self.set_back_callback(gui_app.pop_widget) self.set_back_enabled(not no_escape) # Load eye icons diff --git a/selfdrive/ui/mici/widgets/dialog.py b/selfdrive/ui/mici/widgets/dialog.py index 8e978066c6..dbd3ae0d75 100644 --- a/selfdrive/ui/mici/widgets/dialog.py +++ b/selfdrive/ui/mici/widgets/dialog.py @@ -22,7 +22,6 @@ class BigDialogBase(NavWidget, abc.ABC): def __init__(self): super().__init__() self.set_rect(rl.Rectangle(0, 0, gui_app.width, gui_app.height)) - self.set_back_callback(gui_app.pop_widget) class BigDialog(BigDialogBase): diff --git a/selfdrive/ui/mici/widgets/pairing_dialog.py b/selfdrive/ui/mici/widgets/pairing_dialog.py index 64b2c9a063..7476a3b659 100644 --- a/selfdrive/ui/mici/widgets/pairing_dialog.py +++ b/selfdrive/ui/mici/widgets/pairing_dialog.py @@ -19,7 +19,6 @@ class PairingDialog(NavWidget): def __init__(self): super().__init__() - self.set_back_callback(gui_app.pop_widget) self._params = Params() self._qr_texture: rl.Texture | None = None self._last_qr_generation = float("-inf") diff --git a/system/ui/widgets/nav_widget.py b/system/ui/widgets/nav_widget.py index 02afc911b2..fdbea275af 100644 --- a/system/ui/widgets/nav_widget.py +++ b/system/ui/widgets/nav_widget.py @@ -55,7 +55,6 @@ class NavWidget(Widget, abc.ABC): def __init__(self): super().__init__() - self._back_callback: Callable[[], None] | None = None self._back_button_start_pos: MousePos | None = None self._swiping_away = False # currently swiping away self._can_swipe_away = True # swipe away is blocked after certain horizontal movement @@ -76,9 +75,6 @@ class NavWidget(Widget, abc.ABC): def set_back_enabled(self, enabled: bool | Callable[[], bool]) -> None: self._back_enabled = enabled - def set_back_callback(self, callback: Callable[[], None]) -> None: - self._back_callback = callback - def _handle_mouse_event(self, mouse_event: MouseEvent) -> None: # FIXME: disabling this widget on new push_widget still causes this widget to track mouse events without mouse down super()._handle_mouse_event(mouse_event) @@ -167,8 +163,7 @@ class NavWidget(Widget, abc.ABC): new_y = self._pos_filter.x = 0.0 if new_y > self._rect.height + DISMISS_PUSH_OFFSET - 10: - if self._back_callback is not None: - self._back_callback() + gui_app.pop_widget() self._playing_dismiss_animation = False self._back_button_start_pos = None