WifiUi: fix up wrong password dialog (#37195)
* debug why so slow * forget after * i'm not sure why this is a thing * better forget connecting reset * ???? * has lag * fix * clean up * should be fine
This commit is contained in:
@@ -445,14 +445,21 @@ class WifiUIMici(BigMultiOptionDialog):
|
||||
hint = "wrong password..." if incorrect_password else "enter password..."
|
||||
dlg = BigInputDialog(hint, "", minimum_length=8,
|
||||
confirm_callback=lambda _password: self._connect_with_password(ssid, _password))
|
||||
# go back to the manage network page
|
||||
gui_app.set_modal_overlay(dlg, self._open_network_manage_page)
|
||||
|
||||
def on_close(result=None):
|
||||
gui_app.set_modal_overlay_tick(None)
|
||||
self._open_network_manage_page(result)
|
||||
|
||||
# Process wifi callbacks while the keyboard is shown so forgotten clears connecting state
|
||||
gui_app.set_modal_overlay_tick(self._wifi_manager.process_callbacks)
|
||||
gui_app.set_modal_overlay(dlg, on_close)
|
||||
|
||||
def _on_activated(self):
|
||||
self._connecting = None
|
||||
|
||||
def _on_forgotten(self):
|
||||
self._connecting = None
|
||||
def _on_forgotten(self, ssid):
|
||||
if self._connecting == ssid:
|
||||
self._connecting = None
|
||||
|
||||
def _on_disconnected(self):
|
||||
self._connecting = None
|
||||
|
||||
@@ -183,7 +183,7 @@ class WifiManager:
|
||||
# Callbacks
|
||||
self._need_auth: list[Callable[[str], None]] = []
|
||||
self._activated: list[Callable[[], None]] = []
|
||||
self._forgotten: list[Callable[[], None]] = []
|
||||
self._forgotten: list[Callable[[str], None]] = []
|
||||
self._networks_updated: list[Callable[[list[Network]], None]] = []
|
||||
self._disconnected: list[Callable[[], None]] = []
|
||||
|
||||
@@ -211,7 +211,7 @@ class WifiManager:
|
||||
|
||||
def add_callbacks(self, need_auth: Callable[[str], None] | None = None,
|
||||
activated: Callable[[], None] | None = None,
|
||||
forgotten: Callable[[], None] | None = None,
|
||||
forgotten: Callable[[str], None] | None = None,
|
||||
networks_updated: Callable[[list[Network]], None] | None = None,
|
||||
disconnected: Callable[[], None] | None = None):
|
||||
if need_auth is not None:
|
||||
@@ -316,8 +316,8 @@ class WifiManager:
|
||||
|
||||
# BAD PASSWORD
|
||||
if new_state == NMDeviceState.NEED_AUTH and change_reason == NM_DEVICE_STATE_REASON_SUPPLICANT_DISCONNECT and len(self._connecting_to_ssid):
|
||||
self.forget_connection(self._connecting_to_ssid, block=True)
|
||||
self._enqueue_callbacks(self._need_auth, self._connecting_to_ssid)
|
||||
self.forget_connection(self._connecting_to_ssid, block=True)
|
||||
self._connecting_to_ssid = ""
|
||||
|
||||
elif new_state == NMDeviceState.ACTIVATED:
|
||||
@@ -327,8 +327,8 @@ class WifiManager:
|
||||
self._connecting_to_ssid = ""
|
||||
|
||||
elif new_state == NMDeviceState.DISCONNECTED and change_reason != NM_DEVICE_STATE_REASON_NEW_ACTIVATION:
|
||||
self._enqueue_callbacks(self._forgotten, self._connecting_to_ssid)
|
||||
self._connecting_to_ssid = ""
|
||||
self._enqueue_callbacks(self._forgotten)
|
||||
|
||||
def _network_scanner(self):
|
||||
while not self._exit:
|
||||
@@ -484,7 +484,7 @@ class WifiManager:
|
||||
|
||||
if len(self._forgotten):
|
||||
self._update_networks()
|
||||
self._enqueue_callbacks(self._forgotten)
|
||||
self._enqueue_callbacks(self._forgotten, ssid)
|
||||
|
||||
if block:
|
||||
worker()
|
||||
|
||||
@@ -463,7 +463,7 @@ class WifiManagerUI(Widget):
|
||||
if self.state == UIState.CONNECTING:
|
||||
self.state = UIState.IDLE
|
||||
|
||||
def _on_forgotten(self):
|
||||
def _on_forgotten(self, _):
|
||||
if self.state == UIState.FORGETTING:
|
||||
self.state = UIState.IDLE
|
||||
|
||||
|
||||
Reference in New Issue
Block a user