Merge "Fix urwid > 2.4.2 compatibility"

This commit is contained in:
Zuul 2024-02-27 15:31:59 +00:00 committed by Gerrit Code Review
commit 5b577fd116
1 changed files with 11 additions and 1 deletions

View File

@ -62,6 +62,10 @@ class FixedRadioButton(urwid.RadioButton):
return (len(self.get_label())+4, 1)
class TableColumn(urwid.Pile):
def sizing(self):
"""Explicit declare flow sizing due to the custom pack method."""
return frozenset((urwid.FLOW,))
def pack(self, size, focus=False):
maxcol = size[0]
mx = max([i[0].pack((maxcol,), focus)[0] for i in self.contents])
@ -104,7 +108,6 @@ class MyEdit(urwid.Edit):
super(MyEdit, self).__init__(*args, **kw)
def keypress(self, size, key):
(maxcol,) = size
if self._command_map[key] == keymap.YANK:
text = self.ring.yank()
if text:
@ -349,6 +352,13 @@ class Searchable(object):
class HyperText(urwid.Text):
_selectable = True
def sizing(self):
"""Explicit declare flow sizing due to the custom pack method.
Normal Text can be rendered as FIXED.
"""
return frozenset((urwid.FLOW,))
def __init__(self, markup, align=urwid.LEFT, wrap=urwid.SPACE, layout=None):
self._mouse_press_item = None
self.selectable_items = []