mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-04-06 16:53:58 +08:00
ui: move connected wifi buttons to front independent of scan results (#37417)
* move items * clean up * wtf * debg
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import math
|
||||
import time
|
||||
|
||||
import numpy as np
|
||||
import pyray as rl
|
||||
from collections.abc import Callable
|
||||
@@ -326,8 +328,6 @@ class WifiUIMici(NavWidget):
|
||||
if isinstance(btn, WifiButton) and btn.network.ssid not in self._networks:
|
||||
btn.set_network_missing(True)
|
||||
|
||||
self._move_network_to_front(self._wifi_manager.wifi_state.ssid)
|
||||
|
||||
def _connect_with_password(self, ssid: str, password: str):
|
||||
self._wifi_manager.connect_to_network(ssid, password)
|
||||
self._move_network_to_front(ssid, scroll=True)
|
||||
@@ -382,6 +382,10 @@ class WifiUIMici(NavWidget):
|
||||
def _update_state(self):
|
||||
super()._update_state()
|
||||
|
||||
t = time.monotonic()
|
||||
self._move_network_to_front(self._wifi_manager.wifi_state.ssid)
|
||||
print('took', (time.monotonic() - t) * 1000, 'ms to move network to front')
|
||||
|
||||
# Show loading animation near end
|
||||
max_scroll = max(self._scroller.content_size - self._scroller.rect.width, 1)
|
||||
progress = -self._scroller.scroll_panel.get_offset() / max_scroll
|
||||
|
||||
Reference in New Issue
Block a user