mirror of
https://github.com/rr-/pq-cli.git
synced 2026-09-28 22:33:59 -06:00
ui: address pylint complaints
This commit is contained in:
+2
-2
@@ -2,8 +2,8 @@ import random
|
||||
import typing as T
|
||||
|
||||
|
||||
def seed(seed: T.Any) -> None:
|
||||
random.seed(seed)
|
||||
def seed(source: T.Any) -> None:
|
||||
random.seed(source)
|
||||
|
||||
|
||||
def choice(source: T.Iterable[T.Any]) -> T.Any:
|
||||
|
||||
+16
-13
@@ -8,17 +8,6 @@ from pqcli.ui.new_game_view import NewGameView
|
||||
from pqcli.ui.roster_view import RosterView
|
||||
|
||||
|
||||
for key, direction in {
|
||||
"k": "up",
|
||||
"j": "down",
|
||||
"h": "left",
|
||||
"l": "right",
|
||||
}.items():
|
||||
for key_variant in {key, key.upper()}:
|
||||
urwid.command_map[key_variant] = f"cursor {direction}"
|
||||
urwid.command_map["tab"] = f"cursor down"
|
||||
urwid.command_map["shift tab"] = f"cursor up"
|
||||
|
||||
PALETTE: T.List[T.Tuple[str, str, str]] = [
|
||||
("button", "", ""),
|
||||
("button-focus", "light red", "black"),
|
||||
@@ -29,8 +18,23 @@ PALETTE: T.List[T.Tuple[str, str, str]] = [
|
||||
]
|
||||
|
||||
|
||||
def bind_commands() -> None:
|
||||
for key, direction in {
|
||||
"k": "up",
|
||||
"j": "down",
|
||||
"h": "left",
|
||||
"l": "right",
|
||||
}.items():
|
||||
for key_variant in {key, key.upper()}:
|
||||
urwid.command_map[key_variant] = f"cursor {direction}"
|
||||
urwid.command_map["tab"] = f"cursor down"
|
||||
urwid.command_map["shift tab"] = f"cursor up"
|
||||
|
||||
|
||||
class Ui:
|
||||
def __init__(self, roster: Roster) -> None:
|
||||
bind_commands()
|
||||
|
||||
self.roster = roster
|
||||
self.loop = urwid.MainLoop(
|
||||
None, PALETTE, unhandled_input=self.unhandled_input
|
||||
@@ -57,7 +61,6 @@ class Ui:
|
||||
def switch_to_roster_view(self) -> None:
|
||||
self.loop.widget = RosterView(
|
||||
self.roster,
|
||||
self.loop,
|
||||
on_exit=self.switch_to_exit_view,
|
||||
on_new_game=self.switch_to_new_game_view,
|
||||
on_resume_game=self.switch_to_game_view,
|
||||
@@ -76,7 +79,7 @@ class Ui:
|
||||
)
|
||||
|
||||
def switch_to_game_view(self, player_name: str) -> None:
|
||||
...
|
||||
raise NotImplementedError("not implemented")
|
||||
|
||||
def exit(self) -> None:
|
||||
raise urwid.ExitMainLoop()
|
||||
|
||||
@@ -2,7 +2,6 @@ import typing as T
|
||||
|
||||
import urwid
|
||||
|
||||
from pqcli.mechanic import Roster
|
||||
from pqcli.ui.button import MenuButton
|
||||
|
||||
|
||||
|
||||
@@ -15,4 +15,4 @@ class LineBox(urwid.AttrWrap):
|
||||
),
|
||||
"linebox",
|
||||
"linebox-focus",
|
||||
),
|
||||
)
|
||||
|
||||
@@ -5,7 +5,7 @@ import urwid
|
||||
import urwid_readline
|
||||
|
||||
from pqcli.config import CLASSES, PRIME_STATS, RACES
|
||||
from pqcli.mechanic import Stats, StatsBuilder, generate_name
|
||||
from pqcli.mechanic import StatsBuilder, generate_name
|
||||
from pqcli.ui.button import MenuButton
|
||||
from pqcli.ui.line_box import LineBox
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ class RosterView(urwid.Filler):
|
||||
def __init__(
|
||||
self,
|
||||
roster: Roster,
|
||||
loop: urwid.MainLoop,
|
||||
on_new_game: T.Callable,
|
||||
on_resume_game: T.Callable,
|
||||
on_exit: T.Callable,
|
||||
|
||||
Reference in New Issue
Block a user