ui: make wifi selection usable (#35895)

* start

* wrong

* more

* more

* better

* better

* more better
This commit is contained in:
Maxime Desroches
2025-08-03 00:14:36 -07:00
committed by GitHub
parent 181ea39a83
commit cccd60a28b
3 changed files with 37 additions and 16 deletions
+5 -1
View File
@@ -17,6 +17,7 @@ class ButtonStyle(IntEnum):
LIST_ACTION = 5 # For list items with action buttons
NO_EFFECT = 6
KEYBOARD = 7
FORGET_WIFI = 8
class TextAlignment(IntEnum):
@@ -40,6 +41,7 @@ BUTTON_TEXT_COLOR = {
ButtonStyle.LIST_ACTION: rl.Color(228, 228, 228, 255),
ButtonStyle.NO_EFFECT: rl.Color(228, 228, 228, 255),
ButtonStyle.KEYBOARD: rl.Color(221, 221, 221, 255),
ButtonStyle.FORGET_WIFI: rl.Color(51, 51, 51, 255),
}
BUTTON_BACKGROUND_COLORS = {
@@ -51,6 +53,7 @@ BUTTON_BACKGROUND_COLORS = {
ButtonStyle.LIST_ACTION: rl.Color(57, 57, 57, 255),
ButtonStyle.NO_EFFECT: rl.Color(51, 51, 51, 255),
ButtonStyle.KEYBOARD: rl.Color(68, 68, 68, 255),
ButtonStyle.FORGET_WIFI: rl.Color(189, 189, 189, 255),
}
BUTTON_PRESSED_BACKGROUND_COLORS = {
@@ -62,6 +65,7 @@ BUTTON_PRESSED_BACKGROUND_COLORS = {
ButtonStyle.LIST_ACTION: rl.Color(74, 74, 74, 74),
ButtonStyle.NO_EFFECT: rl.Color(51, 51, 51, 255),
ButtonStyle.KEYBOARD: rl.Color(51, 51, 51, 255),
ButtonStyle.FORGET_WIFI: rl.Color(130, 130, 130, 255),
}
_pressed_buttons: set[str] = set() # Track mouse press state globally
@@ -208,7 +212,7 @@ class Button(Widget):
self._background_color = BUTTON_PRESSED_BACKGROUND_COLORS[self._button_style]
else:
self._background_color = BUTTON_BACKGROUND_COLORS[self._button_style]
else:
elif self._button_style != ButtonStyle.NO_EFFECT:
self._background_color = BUTTON_DISABLED_BACKGROUND_COLOR
self._text_color = BUTTON_DISABLED_TEXT_COLOR