Skip to content

Commit 176b59e

Browse files
focus_direction.py: improve corner case handling
1 parent ad8e487 commit 176b59e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

internal_filesystem/lib/mpos/ui/focus_direction.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,13 +185,15 @@ def move_focus_direction(angle):
185185
print("move_focus_direction: nothing is focused, choosing the next thing")
186186
focus_group.focus_next()
187187
current_focused = focus_group.get_focused()
188+
if not current_focused:
189+
print("move_focus_direction: could not focus on anything, returning...")
190+
return
188191
if isinstance(current_focused, lv.keyboard):
189192
print("focus is on a keyboard, which has its own move_focus_direction: NOT moving")
190193
return
191-
if isinstance(current_focused, lv.dropdown):
192-
if current_focused.is_open():
193-
print("focus is on an open dropdown, which has its own move_focus_direction: NOT moving")
194-
return
194+
if isinstance(current_focused, lv.dropdown) and current_focused.is_open():
195+
print("focus is on an open dropdown, which has its own move_focus_direction: NOT moving")
196+
return
195197
o = find_closest_obj_in_direction(focus_group, current_focused, angle, True)
196198
if o:
197199
print("move_focus_direction: moving focus to:")

0 commit comments

Comments
 (0)