ui: rename Ui class to UrwidUserInterface

This commit is contained in:
rr-
2018-12-14 00:32:21 +01:00
parent 5545e2324a
commit e27f3470a4
15 changed files with 186 additions and 186 deletions
+31
View File
@@ -0,0 +1,31 @@
import typing as T
import urwid
_MAGIC = 999 # where to display the cursor (high value = don't display it)
class CustomButton(urwid.Button):
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.Columns(
[
(urwid.PACK, urwid.Text("< ")),
urwid.SelectableIcon([label], _MAGIC),
(
urwid.PACK,
urwid.Text(f"[{hint}]" if hint else "", align="right"),
),
(urwid.PACK, urwid.Text(" >")),
]
),
"button",
"button-focus",
)