Fix urwid > 2.4.2 compatibility

`Columns` cannot make `pack` with FLOW logic
on FIXED-only widgets since no `rows` method is expected.

Render of `FixedButton` and `FixedRadioButton`
previously worked only due to the nonexistent validation
(FIXED-only widgets support was not implemented
and FLOW logic called explicit)

Change-Id: Iaa1cdded7362c95f60d8073c7edc78fdac1ead14
This commit is contained in:
Aleksei Stepanov 2024-02-26 20:49:45 +01:00
parent 5b577fd116
commit d61a6961fa
2 changed files with 9 additions and 3 deletions

View File

@ -48,17 +48,23 @@ class TextButton(urwid.Button):
self._w = urwid.AttrMap(self.text, None, focus_map='focused')
class FixedButton(urwid.Button):
# todo(Aleksei): This class is not needed with urwid 2.5.0+ (WIMP is already Flow/Fixed)
def sizing(self):
return frozenset([urwid.FIXED])
return frozenset((urwid.FLOW, urwid.FIXED))
def pack(self, size, focus=False):
if size:
return super(FixedButton, self).pack(size, focus)
return (len(self.get_label())+4, 1)
class FixedRadioButton(urwid.RadioButton):
# todo(Aleksei): This class is not needed with urwid 2.5.0+ (WIMP is already Flow/Fixed)
def sizing(self):
return frozenset([urwid.FIXED])
return frozenset((urwid.FLOW, urwid.FIXED))
def pack(self, size, focus=False):
if size:
return super(FixedButton, self).pack(size, focus)
return (len(self.get_label())+4, 1)
class TableColumn(urwid.Pile):

View File

@ -1,6 +1,6 @@
pbr>=0.11
urwid>=1.2.1,!=1.3.0
urwid>=2.0.0
SQLAlchemy>=1.4
GitPython>=0.3.7
python-dateutil