mirror of
https://github.com/rr-/pq-cli.git
synced 2026-09-29 06:44:00 -06:00
ui: correct mypy definitions
This commit is contained in:
@@ -19,7 +19,7 @@ for key, direction in {
|
||||
urwid.command_map["tab"] = f"cursor down"
|
||||
urwid.command_map["shift tab"] = f"cursor up"
|
||||
|
||||
PALETTE: T.List[T.Tuple[str]] = [
|
||||
PALETTE: T.List[T.Tuple[str, str, str]] = [
|
||||
("button", "", ""),
|
||||
("button-focus", "light red", "black"),
|
||||
("linebox", "", ""),
|
||||
|
||||
+3
-1
@@ -1,8 +1,10 @@
|
||||
import typing as T
|
||||
|
||||
import urwid
|
||||
|
||||
|
||||
class MenuButton(urwid.Button):
|
||||
def __init__(self, label, *args, **kwargs):
|
||||
def __init__(self, label: str, *args: T.Any, **kwargs: T.Any) -> None:
|
||||
super().__init__("", *args, **kwargs)
|
||||
self._w = urwid.AttrMap(
|
||||
urwid.SelectableIcon(["\N{BULLET} ", label], 2),
|
||||
|
||||
@@ -25,11 +25,11 @@ class ExitView(urwid.Overlay):
|
||||
|
||||
super().__init__(line_box, parent, "center", 20, "middle", 5)
|
||||
|
||||
def keypress(self, size: T.Any, key: str) -> bool:
|
||||
def keypress(self, size: T.Any, key: str) -> T.Optional[str]:
|
||||
if key in {"y", "Y"}:
|
||||
self.on_exit()
|
||||
return True
|
||||
return None
|
||||
if key in {"n", "N"}:
|
||||
self.on_cancel()
|
||||
return True
|
||||
return super().keypress(size, key)
|
||||
return None
|
||||
return key
|
||||
|
||||
@@ -79,7 +79,7 @@ class StatsBox(urwid.Filler):
|
||||
|
||||
class RaceBox(LineBox):
|
||||
def __init__(self) -> None:
|
||||
race_checkboxes = []
|
||||
race_checkboxes: T.List[urwid.RadioButton] = []
|
||||
self.race = random.choice(RACES)
|
||||
for race in RACES:
|
||||
urwid.RadioButton(
|
||||
@@ -92,7 +92,7 @@ class RaceBox(LineBox):
|
||||
|
||||
class ClassBox(LineBox):
|
||||
def __init__(self) -> None:
|
||||
class_checkboxes = []
|
||||
class_checkboxes: T.List[urwid.RadioButton] = []
|
||||
self.class_ = random.choice(CLASSES)
|
||||
for class_ in CLASSES:
|
||||
urwid.RadioButton(
|
||||
|
||||
Reference in New Issue
Block a user