Skip to content

Commit

Permalink
tui: address urwid deprecation warnings
Browse files Browse the repository at this point in the history
* AttrWrap -> AttrMap
* __super -> super()
* _body -> body
  • Loading branch information
oliver-sanders committed Feb 22, 2024
1 parent d04cd73 commit 3e770bc
Showing 1 changed file with 9 additions and 9 deletions.
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

0 comments on commit 3e770bc

Please sign in to comment.