mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-12-02 06:23:40 +08:00
sort remembered wifi networks first as they're found
This commit is contained in:
@@ -316,6 +316,12 @@ class WifiUIMici(NavScroller):
|
||||
btn = WifiButton(network, self._wifi_manager)
|
||||
btn.set_click_callback(lambda ssid=network.ssid: self._connect_to_network(ssid))
|
||||
self._scroller.add_widget(btn)
|
||||
if self._wifi_manager.is_connection_saved(network.ssid):
|
||||
items = self._scroller.items
|
||||
first_unsaved = next((i for i, b in enumerate(items) if isinstance(b, WifiButton) and b is not btn and
|
||||
not self._wifi_manager.is_connection_saved(b.network.ssid)), None)
|
||||
if first_unsaved is not None:
|
||||
items.insert(first_unsaved, items.pop())
|
||||
|
||||
if re_sort:
|
||||
# Remove stale buttons and sort to match scan order, preserving eager state
|
||||
|
||||
Reference in New Issue
Block a user