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