You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When a radio button is selected but not focused the wrong pallet color is chosen.
To Reproduce
Override the selected_control and selected_field pallet definition with Screen.COLOUR_YELLOW color for better observation.
When the radiobuttons widget is focused and selected, the color is okay.
When the radiobuttons widget losses the focus, then the selected item does not get colored in accordance with selected_control and selected_field.
Expected behavior
Override the selected_control and selected_field pallet definition with Screen.COLOUR_YELLOW color for better observation.
When the radiobuttons widget is focused and selected, the color is okay.
When the radiobuttons widget losses the focus, then the selected item gets colored in accordance with selected_control and selected_field.
Potential fix to this issue
The bellow patch is based on the master branch.
From c89160b2cb8c2503a745da6f937021bf14f121cd Mon Sep 17 00:00:00 2001
From: Jean-Baptiste FROMENTEAU <jb.fromenteau@gmail.com>
Date: Sat, 4 May 2024 17:11:53 +0200
Subject: [PATCH] Fix radiobuttons pallet selection when item is selected
Signed-off-by: Jean-Baptiste FROMENTEAU <jb.fromenteau@gmail.com>
---
asciimatics/widgets/radiobuttons.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/asciimatics/widgets/radiobuttons.py b/asciimatics/widgets/radiobuttons.py
index 999e8bf..9d6e6e3 100644
--- a/asciimatics/widgets/radiobuttons.py+++ b/asciimatics/widgets/radiobuttons.py@@ -37,8 +37,8 @@ class RadioButtons(Widget):
# Render the list of radio buttons.
for i, (text, _) in enumerate(self._options):
- fg, attr, bg = self._pick_colours("control", self._has_focus and i == self._selection)- fg2, attr2, bg2 = self._pick_colours("field", self._has_focus and i == self._selection)+ fg, attr, bg = self._pick_colours("control", i == self._selection)+ fg2, attr2, bg2 = self._pick_colours("field", i == self._selection)
check = check_char if i == self._selection else " "
self._frame.canvas.print_at(
f"({check}) ",
--
2.25.1
The text was updated successfully, but these errors were encountered:
jbfro
changed the title
Radiobutton does not consider the right pallet when item is selectedRadioButtons does not consider the right pallet when item is selected
May 4, 2024
jbfro
changed the title
RadioButtons does not consider the right pallet when item is selectedRadioButtons does not consider the right pallet when item is selected without focus
May 4, 2024
As per my investigations it only affects the RadioButtons widget. Other widgets call the _pick_colours function with the proper test i == current_entry and it works fine since the focus state is checked by _pick_palette_key.
Describe the bug
When a radio button is selected but not focused the wrong pallet color is chosen.
To Reproduce
selected_control
andselected_field
pallet definition withScreen.COLOUR_YELLOW
color for better observation.selected_control
andselected_field
.Expected behavior
selected_control
andselected_field
pallet definition withScreen.COLOUR_YELLOW
color for better observation.selected_control
andselected_field
.Potential fix to this issue
The bellow patch is based on the
master
branch.The text was updated successfully, but these errors were encountered: