mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-06-27 17:42:04 +08:00
mici ui: disable forget on tethering and show full strength (#37344)
* disable forget for tethering * nets * put in wifiman * batch * Revert "batch" This reverts commit 9af20c1c7513c22bf9283b2f02514373fa981f50. * clean up * more * more
This commit is contained in:
@@ -152,6 +152,9 @@ class WifiButton(BigButton):
|
||||
|
||||
@property
|
||||
def _show_forget_btn(self):
|
||||
if self._network.is_tethering:
|
||||
return False
|
||||
|
||||
return (self._is_saved and not self._wrong_password) or self._is_connecting
|
||||
|
||||
def _handle_mouse_release(self, mouse_pos: MousePos):
|
||||
|
||||
@@ -93,17 +93,19 @@ class Network:
|
||||
ssid: str
|
||||
strength: int
|
||||
security_type: SecurityType
|
||||
is_tethering: bool
|
||||
|
||||
@classmethod
|
||||
def from_dbus(cls, ssid: str, aps: list["AccessPoint"]) -> "Network":
|
||||
def from_dbus(cls, ssid: str, aps: list["AccessPoint"], is_tethering: bool) -> "Network":
|
||||
# we only want to show the strongest AP for each Network/SSID
|
||||
strongest_ap = max(aps, key=lambda ap: ap.strength)
|
||||
security_type = get_security_type(strongest_ap.flags, strongest_ap.wpa_flags, strongest_ap.rsn_flags)
|
||||
|
||||
return cls(
|
||||
ssid=ssid,
|
||||
strength=strongest_ap.strength,
|
||||
strength=100 if is_tethering else strongest_ap.strength,
|
||||
security_type=security_type,
|
||||
is_tethering=is_tethering,
|
||||
)
|
||||
|
||||
|
||||
@@ -820,7 +822,7 @@ class WifiManager:
|
||||
# catch all for parsing errors
|
||||
cloudlog.exception(f"Failed to parse AP properties for {ap_path}")
|
||||
|
||||
networks = [Network.from_dbus(ssid, ap_list) for ssid, ap_list in aps.items()]
|
||||
networks = [Network.from_dbus(ssid, ap_list, ssid == self._tethering_ssid) for ssid, ap_list in aps.items()]
|
||||
networks.sort(key=lambda n: (n.ssid != self._wifi_state.ssid, not self.is_connection_saved(n.ssid), -n.strength, n.ssid.lower()))
|
||||
self._networks = networks
|
||||
|
||||
|
||||
Reference in New Issue
Block a user