mirror of
https://github.com/rr-/pq-cli.git
synced 2026-09-29 06:44:00 -06:00
ui: fix mypy warnings
This commit is contained in:
@@ -12,7 +12,7 @@ from pqcli.ui.new_game_view import NewGameView
|
|||||||
from pqcli.ui.roster_view import RosterView
|
from pqcli.ui.roster_view import RosterView
|
||||||
|
|
||||||
|
|
||||||
PALETTE: T.List[T.Tuple[str, str, str]] = [
|
PALETTE: T.List[T.Tuple[str, ...]] = [
|
||||||
("button", "", ""),
|
("button", "", ""),
|
||||||
("button-focus", "light red", "black"),
|
("button-focus", "light red", "black"),
|
||||||
("linebox", "", ""),
|
("linebox", "", ""),
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import urwid
|
|||||||
|
|
||||||
|
|
||||||
class CustomListWalker(urwid.SimpleFocusListWalker):
|
class CustomListWalker(urwid.SimpleFocusListWalker):
|
||||||
def append(self, item) -> None:
|
def append(self, item: T.Any) -> None:
|
||||||
super().append(item)
|
super().append(item)
|
||||||
self.set_focus(len(self) - 1)
|
self.set_focus(len(self) - 1)
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class CustomProgressBar(urwid.Widget):
|
|||||||
percent = min(100, max(0, int(self.position * 100 / self.max_)))
|
percent = min(100, max(0, int(self.position * 100 / self.max_)))
|
||||||
return str(percent) + " %"
|
return str(percent) + " %"
|
||||||
|
|
||||||
def render(self, size: T.Tuple[int, int], focus: bool = False) -> None:
|
def render(self, size: T.Tuple[int, int], focus: bool = False) -> T.Any:
|
||||||
(maxcol,) = size
|
(maxcol,) = size
|
||||||
txt = urwid.Text(self.get_text(), self.text_align, "clip")
|
txt = urwid.Text(self.get_text(), self.text_align, "clip")
|
||||||
c = txt.render((maxcol,))
|
c = txt.render((maxcol,))
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ class EquipmentView(CustomLineBox):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def sync_equipment_change(
|
def sync_equipment_change(
|
||||||
self, equipment_type: EquipmentType, item_name: str
|
self, equipment_type: EquipmentType, item_name: T.Optional[str]
|
||||||
) -> None:
|
) -> None:
|
||||||
self.value_texts[equipment_type].set_text(item_name or "")
|
self.value_texts[equipment_type].set_text(item_name or "")
|
||||||
|
|
||||||
@@ -253,7 +253,7 @@ class PlotView(DoubleLineBox):
|
|||||||
ReadOnlyCheckBox(act_name(self.player.quest_book.act), state=False)
|
ReadOnlyCheckBox(act_name(self.player.quest_book.act), state=False)
|
||||||
)
|
)
|
||||||
|
|
||||||
def sync_act_add(self):
|
def sync_act_add(self) -> None:
|
||||||
del self.list_box.body[: -self.cutoff]
|
del self.list_box.body[: -self.cutoff]
|
||||||
if self.list_box.body:
|
if self.list_box.body:
|
||||||
self.list_box.body[-1].set_state(True)
|
self.list_box.body[-1].set_state(True)
|
||||||
@@ -296,7 +296,7 @@ class QuestBookView(DoubleLineBox):
|
|||||||
if self.list_box.body:
|
if self.list_box.body:
|
||||||
self.list_box.body[-1].set_state(False)
|
self.list_box.body[-1].set_state(False)
|
||||||
|
|
||||||
def sync_quest_add(self):
|
def sync_quest_add(self) -> None:
|
||||||
del self.list_box.body[: -self.cutoff]
|
del self.list_box.body[: -self.cutoff]
|
||||||
if self.list_box.body:
|
if self.list_box.body:
|
||||||
self.list_box.body[-1].set_state(True)
|
self.list_box.body[-1].set_state(True)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import urwid
|
|||||||
|
|
||||||
|
|
||||||
class ReadOnlyCheckBox(urwid.Text):
|
class ReadOnlyCheckBox(urwid.Text):
|
||||||
def __init__(self, text, state: bool = False) -> None:
|
def __init__(self, text: str, state: bool = False) -> None:
|
||||||
self.icons = {
|
self.icons = {
|
||||||
key: widget.text for key, widget in urwid.CheckBox.states.items()
|
key: widget.text for key, widget in urwid.CheckBox.states.items()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user