mirror of
https://github.com/rr-/pq-cli.git
synced 2026-09-28 22:33:59 -06:00
ui/curses: implement game view widget focusing
This commit is contained in:
@@ -4,16 +4,18 @@ from pqcli.lingo import act_name
|
||||
from pqcli.mechanic import Player
|
||||
from pqcli.ui.curses.widgets import ListBox, WindowWrapper
|
||||
|
||||
from .focusable import Focusable
|
||||
from .progress_bar_window import ListBoxProgressBarWindow
|
||||
|
||||
|
||||
class PlotWindow(ListBoxProgressBarWindow):
|
||||
class PlotWindow(Focusable, ListBoxProgressBarWindow):
|
||||
cutoff = 100
|
||||
|
||||
def __init__(
|
||||
self, player: Player, parent: T.Any, h: int, w: int, y: int, x: int
|
||||
) -> None:
|
||||
super().__init__(parent, h, w, y, x, " Plot Development ")
|
||||
self._on_focus_change += self._render
|
||||
|
||||
self._player = player
|
||||
self._player.quest_book.connect("start_act", self._sync_act_add)
|
||||
@@ -51,8 +53,6 @@ class PlotWindow(ListBoxProgressBarWindow):
|
||||
self._list_box.add("[ ] " + act_name(act_number))
|
||||
|
||||
def _sync_position(self) -> None:
|
||||
self._render_progress_bar(
|
||||
self._player.quest_book.plot_bar.position,
|
||||
self._player.quest_book.plot_bar.max_,
|
||||
"",
|
||||
)
|
||||
self._cur_pos = self._player.quest_book.plot_bar.position
|
||||
self._max_pos = self._player.quest_book.plot_bar.max_
|
||||
self._render_progress_bar()
|
||||
|
||||
Reference in New Issue
Block a user