|
|
@ -150,21 +150,24 @@ class WifiManagerUI: |
|
|
|
self._draw_signal_strength_icon(signal_icon_rect, network) |
|
|
|
self._draw_signal_strength_icon(signal_icon_rect, network) |
|
|
|
|
|
|
|
|
|
|
|
if isinstance(self.state, StateIdle) and rl.check_collision_point_rec(rl.get_mouse_position(), ssid_rect) and clicked: |
|
|
|
if isinstance(self.state, StateIdle) and rl.check_collision_point_rec(rl.get_mouse_position(), ssid_rect) and clicked: |
|
|
|
if not network.is_saved: |
|
|
|
if not network.is_saved and network.security_type != SecurityType.OPEN: |
|
|
|
self.state = StateNeedsAuth(network) |
|
|
|
self.state = StateNeedsAuth(network) |
|
|
|
elif not network.is_connected: |
|
|
|
elif not network.is_connected: |
|
|
|
self.connect_to_network(network) |
|
|
|
self.connect_to_network(network) |
|
|
|
|
|
|
|
|
|
|
|
def _draw_status_icon(self, rect, network: NetworkInfo): |
|
|
|
def _draw_status_icon(self, rect, network: NetworkInfo): |
|
|
|
"""Draw the status icon based on network's connection state""" |
|
|
|
"""Draw the status icon based on network's connection state""" |
|
|
|
icon_file = "" |
|
|
|
icon_file = None |
|
|
|
if network.is_connected: |
|
|
|
if network.is_connected: |
|
|
|
icon_file = "icons/checkmark.png" |
|
|
|
icon_file = "icons/checkmark.png" |
|
|
|
elif network.security_type == SecurityType.UNSUPPORTED: |
|
|
|
elif network.security_type == SecurityType.UNSUPPORTED: |
|
|
|
icon_file = "icons/circled_slash.png" |
|
|
|
icon_file = "icons/circled_slash.png" |
|
|
|
else: |
|
|
|
elif network.security_type != SecurityType.OPEN: |
|
|
|
icon_file = "icons/lock_closed.png" |
|
|
|
icon_file = "icons/lock_closed.png" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not icon_file: |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
texture = gui_app.texture(icon_file, ICON_SIZE, ICON_SIZE) |
|
|
|
texture = gui_app.texture(icon_file, ICON_SIZE, ICON_SIZE) |
|
|
|
icon_rect = rl.Vector2(rect.x, rect.y + (ICON_SIZE - texture.height) / 2) |
|
|
|
icon_rect = rl.Vector2(rect.x, rect.y + (ICON_SIZE - texture.height) / 2) |
|
|
|
rl.draw_texture_v(texture, icon_rect, rl.WHITE) |
|
|
|
rl.draw_texture_v(texture, icon_rect, rl.WHITE) |
|
|
|