Skip to content

Commit

Permalink
ui: use ListBox.focus instead accessing the ListWalker object
Browse files Browse the repository at this point in the history
Although ListBox.get_focus() is deprecated, using ListWalker.get_focus()
through ListBox.body.get_focus() is not.

However, the ListBox.focus property exists and makes it easy to access
the underlying focused widget ; so use it instead of dereferencing the
ListWalker object.

Signed-off-by: Olivier Gayot <[email protected]>
  • Loading branch information
ogayot committed Aug 27, 2024
1 parent 337f784 commit 38315ad
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions subiquitycore/ui/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,12 +465,11 @@ def render(self, size, focus=False):

seen_focus = False
height = height_before_focus = 0
focus_widget, focus_pos = lb.body.get_focus()
# Scan through the rows calculating total height and the
# height of the rows before the focus widget.
for widget in lb.body:
rows = widget.rows((maxcol - 1,))
if widget is focus_widget:
if widget is lb.focus:
seen_focus = True
elif not seen_focus:
height_before_focus += rows
Expand Down

0 comments on commit 38315ad

Please sign in to comment.