mirror of
https://github.com/rr-/pq-cli.git
synced 2026-09-28 22:33:59 -06:00
ui/curses: remove redundant code
This commit is contained in:
@@ -13,7 +13,7 @@ class PlotWindow(ListBoxProgressBarWindow):
|
|||||||
def __init__(
|
def __init__(
|
||||||
self, player: Player, parent: T.Any, h: int, w: int, y: int, x: int
|
self, player: Player, parent: T.Any, h: int, w: int, y: int, x: int
|
||||||
) -> None:
|
) -> None:
|
||||||
super().__init__(parent, h, w, y, x, " Plot ")
|
super().__init__(parent, h, w, y, x, " Plot Development ")
|
||||||
|
|
||||||
self._player = player
|
self._player = player
|
||||||
self._player.quest_book.connect("start_act", self._sync_act_add)
|
self._player.quest_book.connect("start_act", self._sync_act_add)
|
||||||
@@ -41,7 +41,7 @@ class PlotWindow(ListBoxProgressBarWindow):
|
|||||||
self._player.quest_book.act + 1,
|
self._player.quest_book.act + 1,
|
||||||
):
|
):
|
||||||
self._sync_act_add(act_number)
|
self._sync_act_add(act_number)
|
||||||
self._render()
|
self._render_list_box()
|
||||||
|
|
||||||
def _sync_act_add(self, act_number: int) -> None:
|
def _sync_act_add(self, act_number: int) -> None:
|
||||||
self._list_box.delete(0, max(0, len(self._list_box) - self.cutoff))
|
self._list_box.delete(0, max(0, len(self._list_box) - self.cutoff))
|
||||||
@@ -56,14 +56,3 @@ class PlotWindow(ListBoxProgressBarWindow):
|
|||||||
self._player.quest_book.plot_bar.max_,
|
self._player.quest_book.plot_bar.max_,
|
||||||
"",
|
"",
|
||||||
)
|
)
|
||||||
|
|
||||||
def _render(self) -> None:
|
|
||||||
if not self._win:
|
|
||||||
return
|
|
||||||
|
|
||||||
self._win.box()
|
|
||||||
text = " Plot Development "
|
|
||||||
x = max(0, (self.getmaxyx()[1] - len(text)) // 2)
|
|
||||||
self._win.addnstr(0, x, text, min(len(text), self.getmaxyx()[1]))
|
|
||||||
self._win.refresh()
|
|
||||||
self._list_box.render()
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class QuestBookWindow(ListBoxProgressBarWindow):
|
|||||||
self._list_box.clear()
|
self._list_box.clear()
|
||||||
for quest_name in self._player.quest_book.quests[-self.cutoff :]:
|
for quest_name in self._player.quest_book.quests[-self.cutoff :]:
|
||||||
self._sync_quest_add(quest_name)
|
self._sync_quest_add(quest_name)
|
||||||
self._render()
|
self._render_list_box()
|
||||||
|
|
||||||
def _sync_quest_add(self, quest_name: str) -> None:
|
def _sync_quest_add(self, quest_name: str) -> None:
|
||||||
self._list_box.delete(0, max(0, len(self._list_box) - self.cutoff))
|
self._list_box.delete(0, max(0, len(self._list_box) - self.cutoff))
|
||||||
@@ -54,14 +54,3 @@ class QuestBookWindow(ListBoxProgressBarWindow):
|
|||||||
self._player.quest_book.quest_bar.max_,
|
self._player.quest_book.quest_bar.max_,
|
||||||
"",
|
"",
|
||||||
)
|
)
|
||||||
|
|
||||||
def _render(self) -> None:
|
|
||||||
if not self._win:
|
|
||||||
return
|
|
||||||
|
|
||||||
self._win.box()
|
|
||||||
text = " Plot Development "
|
|
||||||
x = max(0, (self.getmaxyx()[1] - len(text)) // 2)
|
|
||||||
self._win.addnstr(0, x, text, min(len(text), self.getmaxyx()[1]))
|
|
||||||
self._win.refresh()
|
|
||||||
self._list_box.render()
|
|
||||||
|
|||||||
Reference in New Issue
Block a user