Display full inventory
This commit is contained in:
@ -21,8 +21,6 @@ class MenuDisplay(Display):
|
||||
|
||||
# Menu values are printed in pad
|
||||
self.pad = self.newpad(self.trueheight, self.truewidth + 2)
|
||||
for i in range(self.trueheight):
|
||||
self.addstr(self.pad, i, 0, " " + self.values[i])
|
||||
|
||||
def update_pad(self) -> None:
|
||||
for i in range(self.trueheight):
|
||||
@ -107,3 +105,16 @@ class InventoryDisplay(MenuDisplay):
|
||||
message = _("== INVENTORY ==")
|
||||
self.addstr(self.pad, 0, (self.width - len(message)) // 2, message,
|
||||
curses.A_BOLD | curses.A_ITALIC)
|
||||
for i, item in enumerate(self.menu.values):
|
||||
rep = self.pack[item.name.upper()]
|
||||
selection = f"[{rep}]" if i == self.menu.position else f" {rep} "
|
||||
self.addstr(self.pad, 2 + i, 0, selection
|
||||
+ " " + _(item.name).capitalize())
|
||||
|
||||
@property
|
||||
def truewidth(self) -> int:
|
||||
return max(1, self.height if hasattr(self, "height") else 10)
|
||||
|
||||
@property
|
||||
def trueheight(self) -> int:
|
||||
return 2 + super().trueheight
|
||||
|
Reference in New Issue
Block a user