pull/36039/head
Shane Smiskol 6 days ago
parent 0b2b16da05
commit a96065ce26
  1. 9
      system/ui/widgets/network.py

@ -143,10 +143,12 @@ class WifiManagerUI(Widget):
rl.end_scissor_mode()
def _draw_network_item(self, rect, network: Network, clicked: bool):
t = time.monotonic()
spacing = 50
ssid_rect = rl.Rectangle(rect.x, rect.y, rect.width - self.btn_width * 2, ITEM_HEIGHT)
signal_icon_rect = rl.Rectangle(rect.x + rect.width - ICON_SIZE, rect.y + (ITEM_HEIGHT - ICON_SIZE) / 2, ICON_SIZE, ICON_SIZE)
security_icon_rect = rl.Rectangle(signal_icon_rect.x - spacing - ICON_SIZE, rect.y + (ITEM_HEIGHT - ICON_SIZE) / 2, ICON_SIZE, ICON_SIZE)
print('rects took', time.monotonic() - t)
status_text = ""
# TODO: rm, wtf is this class initialization each time state system
@ -165,8 +167,12 @@ class WifiManagerUI(Widget):
if network.security_type == SecurityType.UNSUPPORTED:
self._networks_buttons[network.ssid].set_enabled(False)
print('state took', time.monotonic() - t)
self._networks_buttons[network.ssid].render(ssid_rect)
print('button render took', time.monotonic() - t)
if status_text:
status_text_rect = rl.Rectangle(security_icon_rect.x - 410, rect.y, 410, ITEM_HEIGHT)
gui_label(status_text_rect, status_text, font_size=48, alignment=rl.GuiTextAlignment.TEXT_ALIGN_CENTER)
@ -181,8 +187,11 @@ class WifiManagerUI(Widget):
)
self._forget_networks_buttons[network.ssid].render(forget_btn_rect)
print('text render took', time.monotonic() - t)
self._draw_status_icon(security_icon_rect, network)
self._draw_signal_strength_icon(signal_icon_rect, network)
print('icons took', time.monotonic() - t)
def _networks_buttons_callback(self, network):
if self.scroll_panel.is_touch_valid():

Loading…
Cancel
Save