Skip to content

Commit

Permalink
Check boxes are now iterated and highlighted using 'Tab' key.
Browse files Browse the repository at this point in the history
It is an 'new feature', see commit #4ab20968e2a4a45db8f0dd1535084875f5336113 for activation.
  • Loading branch information
LaChal committed Mar 22, 2018
1 parent 4ab2096 commit 3f5313f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
4 changes: 4 additions & 0 deletions albow/controls.py
Expand Up @@ -366,6 +366,10 @@ class CheckWidget(Widget):
border_width = 1
check_mark_tweak = 2

if __builtins__.get("mcenf_tab_to_next"):
tab_stop = True
highlight_color = ThemeProperty('highlight_color')

smooth = ThemeProperty('smooth')

def __init__(self, **kwds):
Expand Down
6 changes: 6 additions & 0 deletions albow/theme.py
Expand Up @@ -164,6 +164,12 @@ def get_font(self, cls, name):
root.CheckWidget = Theme('CheckWidget')
root.CheckWidget.smooth = False
root.CheckWidget.border_color = root.Field.border_color
root.CheckWidget.highlight_color = (0, 128, 255)

if __builtins__.get("mcenf_tab_to_next"):
root.CheckBox = Theme("CheckBox)")
# Let use the same highlight color as for buttons
root.CheckBox.highlight_color = root.Button.highlight_color

root.Dialog = Theme('Dialog')
root.Dialog.bg_color = (40, 40, 40)
Expand Down
8 changes: 7 additions & 1 deletion albow/widget.py
Expand Up @@ -343,7 +343,13 @@ def draw_all(self, surface):
self.draw(surface)
bw = self.border_width
if bw:
bc = self.border_color or self.fg_color
if __builtins__.get("mcenf_tab_to_next"):
if self.has_focus() and hasattr(self, "highlight_color"):
bc = self.highlight_color
else:
bc = self.border_color or self.fg_color
else:
bc = self.border_color or self.fg_color
frame_rect(surface, bc, surf_rect, bw)
for widget in self.subwidgets:
sub_rect = widget.rect
Expand Down

0 comments on commit 3f5313f

Please sign in to comment.