mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-18 20:03:53 +08:00
@@ -441,20 +441,19 @@ class WifiManager:
|
||||
settings_iface.on_connection_removed(self._on_connection_removed)
|
||||
|
||||
def _on_properties_changed(self, interface: str, changed: dict, invalidated: list):
|
||||
if 'LastScan' in changed:
|
||||
if interface == NM_WIRELESS_IFACE and 'LastScan' in changed:
|
||||
asyncio.create_task(self._refresh_networks())
|
||||
elif interface == NM_WIRELESS_IFACE and "ActiveAccessPoint" in changed:
|
||||
new_ap_path = changed["ActiveAccessPoint"].value
|
||||
if self.active_ap_path != new_ap_path:
|
||||
self.active_ap_path = new_ap_path
|
||||
asyncio.create_task(self._refresh_networks())
|
||||
|
||||
def _on_state_changed(self, new_state: int, old_state: int, reason: int):
|
||||
if new_state == NMDeviceState.ACTIVATED:
|
||||
if self.callbacks.activated:
|
||||
self.callbacks.activated()
|
||||
asyncio.create_task(self._refresh_networks())
|
||||
self._current_connection_ssid = None
|
||||
asyncio.create_task(self._refresh_networks())
|
||||
elif new_state in (NMDeviceState.DISCONNECTED, NMDeviceState.NEED_AUTH):
|
||||
for network in self.networks:
|
||||
network.is_connected = False
|
||||
@@ -487,9 +486,6 @@ class WifiManager:
|
||||
|
||||
if self.callbacks.forgotten:
|
||||
self.callbacks.forgotten(ssid)
|
||||
|
||||
# Update network list to reflect the removed saved connection
|
||||
asyncio.create_task(self._refresh_networks())
|
||||
break
|
||||
|
||||
async def _add_saved_connection(self, path: str) -> None:
|
||||
@@ -498,7 +494,6 @@ class WifiManager:
|
||||
settings = await self._get_connection_settings(path)
|
||||
if ssid := self._extract_ssid(settings):
|
||||
self.saved_connections[ssid] = path
|
||||
await self._refresh_networks()
|
||||
except DBusError as e:
|
||||
cloudlog.error(f"Failed to add connection {path}: {e}")
|
||||
|
||||
|
||||
@@ -187,8 +187,7 @@ class WifiManagerUI(Widget):
|
||||
|
||||
def _forget_networks_buttons_callback(self, network):
|
||||
if self.scroll_panel.is_touch_valid():
|
||||
if isinstance(self.state, StateIdle):
|
||||
self.state = StateShowForgetConfirm(network)
|
||||
self.state = StateShowForgetConfirm(network)
|
||||
|
||||
def _draw_status_icon(self, rect, network: NetworkInfo):
|
||||
"""Draw the status icon based on network's connection state"""
|
||||
|
||||
Reference in New Issue
Block a user