diff --git a/openpilot/starpilot/ui/runtime_app.py b/openpilot/starpilot/ui/runtime_app.py index 3eeee95b4f..544618fa11 100644 --- a/openpilot/starpilot/ui/runtime_app.py +++ b/openpilot/starpilot/ui/runtime_app.py @@ -2093,17 +2093,6 @@ class StarMiciMainLayout(MiciMainLayout): self._scroller.scroll_to(self._onroad_layout.rect.x if ui_state.started else self._home_layout.rect.x, smooth=False) def _open_compact_destination(self, destination: Destination) -> None: - if destination == Destination.NETWORK and not self.star.connectivity_allowed(): - from openpilot.selfdrive.ui.mici.widgets.button import GreyBigButton - from openpilot.system.ui.widgets.scroller import NavScroller - page = NavScroller() - current = self.star.snapshot(ShellMode.SETTINGS).home.network - label = {"wifi": "Wi-Fi", "ethernet": "Ethernet", "cell2G": "Cellular 2G", "cell3G": "Cellular 3G", - "cell4G": "Cellular 4G", "cell5G": "Cellular 5G"}.get(current, "No connection shown") - page._scroller.add_widgets([GreyBigButton("network", label), - GreyBigButton("network changes", "Use Offroad mode to change network settings")]) - gui_app.push_widget(page) - return if destination == Destination.BLUETOOTH: from openpilot.starpilot.ui.bluetooth_compact import BluetoothCompact panel = self._compact_panels.get(destination) diff --git a/openpilot/starpilot/ui/tests/test_runtime_panel_actions.py b/openpilot/starpilot/ui/tests/test_runtime_panel_actions.py index a5b9894a1c..9e4d9b7464 100644 --- a/openpilot/starpilot/ui/tests/test_runtime_panel_actions.py +++ b/openpilot/starpilot/ui/tests/test_runtime_panel_actions.py @@ -1,5 +1,5 @@ """Route live large-panel requests into native owners with effects isolated.""" -from unittest.mock import patch +from unittest.mock import patch, call import atexit @@ -868,20 +868,18 @@ class TestRuntimePanelActions(unittest.TestCase): self.assertTrue(state.destination(destination).available, destination) self.assertFalse(state.destination(Destination.PAIR).available) - def test_compact_network_in_drive_shows_status_without_native_network_owner(self): + def test_compact_network_in_drive_uses_native_network_owner(self): layout = runtime_app.StarMiciMainLayout.__new__(runtime_app.StarMiciMainLayout) - self.enterContext(patch.object(layout, 'star', NS(connectivity_allowed=Mock(return_value=False), - snapshot=Mock(return_value=NS(home=NS(network="wifi")))), create=True)) - page = NS(_scroller=NS(add_widgets=Mock())) - with patch("openpilot.system.ui.widgets.scroller.NavScroller", return_value=page), \ - patch("openpilot.selfdrive.ui.mici.widgets.button.GreyBigButton", side_effect=lambda *args: args), \ - patch("openpilot.selfdrive.ui.mici.layouts.settings.network.network_layout.NetworkLayoutMici") as native, \ + self.enterContext(patch.object(layout, 'star', NS(connectivity_allowed=Mock(return_value=False)), create=True)) + self.enterContext(patch.object(layout, '_compact_panels', {}, create=True)) + page = NS() + with patch("openpilot.selfdrive.ui.mici.layouts.settings.network.network_layout.NetworkLayoutMici", return_value=page) as native, \ patch.object(runtime_app.gui_app, "push_widget") as push: layout._open_compact_destination(Destination.NETWORK) - native.assert_not_called() - self.assertEqual(page._scroller.add_widgets.call_args.args[0], [("network", "Wi-Fi"), - ("network changes", "Use Offroad mode to change network settings")]) - push.assert_called_once_with(page) + layout._open_compact_destination(Destination.NETWORK) + native.assert_called_once_with() + self.assertEqual(push.call_args_list, [call(page), call(page)]) + layout.star.connectivity_allowed.assert_not_called() def test_software_check_owner_and_waiting_gate_with_mocked_final_effect(self): self.layout.star.selected = Destination.SOFTWARE