mirror of
https://github.com/rr-/pq-cli.git
synced 2026-09-29 14:54:00 -06:00
ui: simplify quest book
This commit is contained in:
+2
-2
@@ -93,7 +93,7 @@ class Stats(SignalMixin):
|
|||||||
|
|
||||||
|
|
||||||
class QuestBook(SignalMixin):
|
class QuestBook(SignalMixin):
|
||||||
signals = ["complete_act", "complete_quest"]
|
signals = ["complete_act", "start_quest"]
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
self._quests: T.List[str] = []
|
self._quests: T.List[str] = []
|
||||||
@@ -610,7 +610,7 @@ class Simulation:
|
|||||||
raise AssertionError
|
raise AssertionError
|
||||||
|
|
||||||
self.player.quest_book.add_quest(caption)
|
self.player.quest_book.add_quest(caption)
|
||||||
self.player.quest_book.emit("complete_quest")
|
self.player.quest_book.emit("start_quest", caption)
|
||||||
|
|
||||||
def interplot_cinematic(self) -> None:
|
def interplot_cinematic(self) -> None:
|
||||||
def enqueue(task: BaseTask) -> None:
|
def enqueue(task: BaseTask) -> None:
|
||||||
|
|||||||
@@ -289,7 +289,7 @@ class QuestBookView(DoubleLineBox):
|
|||||||
self.list_box = CustomListBox([])
|
self.list_box = CustomListBox([])
|
||||||
self.quest_bar = CustomProgressBar()
|
self.quest_bar = CustomProgressBar()
|
||||||
|
|
||||||
self.player.quest_book.connect("complete_quest", self.sync_quest_add)
|
self.player.quest_book.connect("start_quest", self.sync_quest_add)
|
||||||
self.player.quest_book.quest_bar.connect("change", self.sync_position)
|
self.player.quest_book.quest_bar.connect("change", self.sync_position)
|
||||||
|
|
||||||
super().__init__(
|
super().__init__(
|
||||||
@@ -306,17 +306,13 @@ class QuestBookView(DoubleLineBox):
|
|||||||
def sync_quests(self) -> None:
|
def sync_quests(self) -> None:
|
||||||
del self.list_box.body[:]
|
del self.list_box.body[:]
|
||||||
for quest_name in self.player.quest_book.quests[-self.cutoff :]:
|
for quest_name in self.player.quest_book.quests[-self.cutoff :]:
|
||||||
self.list_box.body.append(ReadOnlyCheckBox(quest_name, state=True))
|
self.sync_quest_add(quest_name)
|
||||||
if self.list_box.body:
|
|
||||||
self.list_box.body[-1].set_state(False)
|
|
||||||
|
|
||||||
def sync_quest_add(self) -> None:
|
def sync_quest_add(self, quest_name: str) -> 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)
|
||||||
self.list_box.body.append(
|
self.list_box.body.append(ReadOnlyCheckBox(quest_name, state=False))
|
||||||
ReadOnlyCheckBox(self.player.quest_book.quests[-1], state=False)
|
|
||||||
)
|
|
||||||
|
|
||||||
def sync_position(self) -> None:
|
def sync_position(self) -> None:
|
||||||
self.quest_bar.set_completion(
|
self.quest_bar.set_completion(
|
||||||
|
|||||||
Reference in New Issue
Block a user