system/ui: network widget improvements (#35284)

* larger font size for confirmation dialog

* try this

* forget btn color

* text color

* font size

* caps

* Revert "caps"

This reverts commit a3e6cfbf053e46158036728cbcd9d8bd9f99d5e5.

* too much

* fixme

* do that?

* keyboard: reset state on clear
This commit is contained in:
Cameron Clough
2025-05-19 17:31:42 +01:00
committed by GitHub
parent 38c1bd096b
commit 6eecb4f986
4 changed files with 17 additions and 6 deletions
+1
View File
@@ -34,6 +34,7 @@ def confirm_dialog(message: str, confirm_text: str, cancel_text: str = "Cancel")
gui_text_box(
text_rect,
message,
font_size=88,
alignment=rl.GuiTextAlignment.TEXT_ALIGN_CENTER,
alignment_vertical=rl.GuiTextAlignmentVertical.TEXT_ALIGN_MIDDLE,
)
+2
View File
@@ -77,6 +77,8 @@ class Keyboard:
return self._input_box.text
def clear(self):
self._layout_name = "lowercase"
self._caps_lock = False
self._input_box.clear()
def render(self, title: str, sub_title: str):
+4 -4
View File
@@ -3,7 +3,7 @@ from typing import Literal
import pyray as rl
from openpilot.system.ui.lib.application import gui_app
from openpilot.system.ui.lib.button import gui_button
from openpilot.system.ui.lib.button import ButtonStyle, gui_button
from openpilot.system.ui.lib.label import gui_label
from openpilot.system.ui.lib.scroll_panel import GuiScrollPanel
from openpilot.system.ui.lib.wifi_manager import NetworkInfo, WifiManagerCallbacks, WifiManagerWrapper, SecurityType
@@ -134,7 +134,7 @@ class WifiManagerUI:
if status_text:
status_text_rect = rl.Rectangle(security_icon_rect.x - 410, rect.y, 410, ITEM_HEIGHT)
rl.gui_label(status_text_rect, status_text)
gui_label(status_text_rect, status_text, font_size=48, alignment=rl.GuiTextAlignment.TEXT_ALIGN_CENTER)
else:
# If the network is saved, show the "Forget" button
if network.is_saved:
@@ -143,7 +143,7 @@ class WifiManagerUI:
self.btn_width,
80,
)
if isinstance(self.state, StateIdle) and gui_button(forget_btn_rect, "Forget") and clicked:
if isinstance(self.state, StateIdle) and gui_button(forget_btn_rect, "Forget", button_style=ButtonStyle.ACTION) and clicked:
self.state = StateShowForgetConfirm(network)
self._draw_status_icon(security_icon_rect, network)
@@ -152,7 +152,7 @@ class WifiManagerUI:
if isinstance(self.state, StateIdle) and rl.check_collision_point_rec(rl.get_mouse_position(), ssid_rect) and clicked:
if not network.is_saved:
self.state = StateNeedsAuth(network)
else:
elif not network.is_connected:
self.connect_to_network(network)
def _draw_status_icon(self, rect, network: NetworkInfo):