ui: add shortcuts

This commit is contained in:
rr-
2018-11-05 21:04:39 +01:00
parent b66b3fca18
commit a265dc6d9d
4 changed files with 80 additions and 19 deletions
+13 -2
View File
@@ -4,10 +4,21 @@ import urwid
class MenuButton(urwid.Button):
def __init__(self, label: str, *args: T.Any, **kwargs: T.Any) -> None:
def __init__(
self,
label: str,
*args: T.Any,
hint: T.Optional[str] = None,
**kwargs: T.Any
) -> None:
super().__init__("", *args, **kwargs)
self._w = urwid.AttrMap(
urwid.SelectableIcon(["\N{BULLET} ", label], 2),
urwid.Columns(
[
urwid.SelectableIcon(["\N{BULLET} ", label], 2),
("pack", urwid.Text(hint or "", align="right")),
]
),
"button",
"button-focus",
)