Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tui: address urwid deprecation warnings #5991

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions cylc/flow/tui/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def keypress(self, size, key):
but which we think should be used for collapsing.

"""
ret = self.__super.keypress(size, key)
ret = super().keypress(size, key)
if ret in ('left',):
self.expanded = False
self.update_expanded_icon()
Expand All @@ -143,7 +143,7 @@ def get_indented_widget(self):
],
dividechars=1
)
return self.__super.get_indented_widget()
return super().get_indented_widget()

def update_expanded_icon(self, subscribe=True):
"""Update the +/- icon.
Expand Down Expand Up @@ -276,10 +276,10 @@ def __init__(self, screen=None):
topnode = TuiNode(self, dummy_flow({'id': 'Loading...'}))
self.listbox = urwid.TreeListBox(urwid.TreeWalker(topnode))
header = urwid.Text('\n')
footer = urwid.AttrWrap(urwid.Text(list_bindings()), 'foot')
footer = urwid.AttrMap(urwid.Text(list_bindings()), 'foot')
self.view = urwid.Frame(
urwid.AttrWrap(self.listbox, 'body'),
header=urwid.AttrWrap(header, 'head'),
urwid.AttrMap(self.listbox, 'body'),
header=urwid.AttrMap(header, 'head'),
footer=footer
)
self.filters = get_default_filters()
Expand Down Expand Up @@ -509,18 +509,18 @@ def update(self, *_):
# preserve the focus and collapse status of tree nodes

# record the old focus
_, old_node = self.listbox._body.get_focus()
_, old_node = self.listbox.body.get_focus()

# nuke the tree
self.tree_walker = urwid.TreeWalker(topnode)
self.listbox._set_body(self.tree_walker)
self.listbox.body = self.tree_walker

# get the new focus
_, new_node = self.listbox._body.get_focus()
_, new_node = self.listbox.body.get_focus()

# preserve the focus or walk to the nearest parent
closest_focus = find_closest_focus(self, old_node, new_node)
self.listbox._body.set_focus(closest_focus)
self.listbox.body.set_focus(closest_focus)

# preserve the collapse/expand status of all nodes
translate_collapsing(self, old_node, new_node)
Expand Down
Loading