Drop prehistoric hack for urwid.GridFlow

1. Mentioned PR was merged > 8 years ago.
2. Issue with widget focusing on keypress is invalid:
   arrow keys should point on widgets as it positioned
   (if button at the next row - "right" button is ignored).

Change-Id: I6fecae34576196b63074a4b0db438aab3da3fd65
This commit is contained in:
Aleksei Stepanov 2024-02-26 11:02:27 +01:00 committed by Aleksei Stepanov
parent 346804a832
commit 9846bcacf3
2 changed files with 2 additions and 19 deletions

View File

@ -533,20 +533,3 @@ class Link(urwid.Widget):
if focus:
return self.focused_attr
return self.attr
# A workaround for the issue fixed in
# https://github.com/wardi/urwid/pull/74
# included here until thi fix is released
class MyGridFlow(urwid.GridFlow):
def generate_display_widget(self, size):
p = super(MyGridFlow, self).generate_display_widget(size)
for item in p.contents:
if isinstance(item[0], urwid.Padding):
c = item[0].original_widget
if isinstance(c, urwid.Columns):
if c.focus_position == 0 and not c.contents[0][0].selectable():
for i, w in enumerate(c.contents):
if w[0].selectable():
c.focus_position = i
break
return p

View File

@ -648,8 +648,8 @@ class ChangeView(urwid.WidgetWrap):
self.conflicts_with_rows = {}
self.related_changes = urwid.Pile([self.depends_on, self.needed_by, self.conflicts_with])
self.results = mywid.HyperText(u'') # because it scrolls better than a table
self.grid = mywid.MyGridFlow([change_info, self.commit_message, votes, self.results],
cell_width=80, h_sep=2, v_sep=1, align='left')
self.grid = urwid.GridFlow([change_info, self.commit_message, votes, self.results],
cell_width=80, h_sep=2, v_sep=1, align='left')
self.listbox = urwid.ListBox(urwid.SimpleFocusListWalker([]))
self._w.contents.append((self.app.header, ('pack', 1)))
self._w.contents.append((urwid.Divider(), ('pack', 1)))