Add title to boxes to have pretty boxes, fixes #28
This commit is contained in:
parent
158338637a
commit
73e1fac89a
|
@ -222,6 +222,10 @@ class HorizontalSplit(Display):
|
|||
|
||||
|
||||
class Box(Display):
|
||||
title: str = ""
|
||||
|
||||
def update_title(self, title: str) -> None:
|
||||
self.title = title
|
||||
|
||||
def __init__(self, *args, fg_border_color: Optional[int] = None, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
@ -236,5 +240,11 @@ class Box(Display):
|
|||
self.addstr(self.pad, i, self.width - 1, "┃", self.fg_border_color)
|
||||
self.addstr(self.pad, self.height - 1, 0,
|
||||
"┗" + "━" * (self.width - 2) + "┛", self.fg_border_color)
|
||||
|
||||
if self.title:
|
||||
self.addstr(self.pad, 0, (self.width - len(self.title) - 8) // 2,
|
||||
f" == {self.title} == ", curses.COLOR_GREEN,
|
||||
italic=True, bold=True)
|
||||
|
||||
self.refresh_pad(self.pad, 0, 0, self.y, self.x,
|
||||
self.y + self.height - 1, self.x + self.width - 1)
|
||||
|
|
|
@ -6,7 +6,7 @@ from random import randint
|
|||
from typing import List
|
||||
|
||||
from squirrelbattle.menus import Menu, MainMenu
|
||||
from .display import Display, Box
|
||||
from .display import Box, Display
|
||||
from ..enums import KeyValues
|
||||
from ..game import Game
|
||||
from ..resources import ResourceManager
|
||||
|
@ -135,15 +135,12 @@ class MainMenuDisplay(Display):
|
|||
|
||||
|
||||
class PlayerInventoryDisplay(MenuDisplay):
|
||||
message = _("== INVENTORY ==")
|
||||
|
||||
def update_pad(self) -> None:
|
||||
self.addstr(self.pad, 0, (self.width - len(self.message)) // 2,
|
||||
self.message, bold=True, italic=True)
|
||||
self.menubox.update_title(_("INVENTORY"))
|
||||
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
|
||||
self.addstr(self.pad, i + 1, 0, selection
|
||||
+ " " + item.translated_name.capitalize())
|
||||
|
||||
@property
|
||||
|
@ -163,15 +160,12 @@ class PlayerInventoryDisplay(MenuDisplay):
|
|||
|
||||
|
||||
class StoreInventoryDisplay(MenuDisplay):
|
||||
message = _("== STALL ==")
|
||||
|
||||
def update_pad(self) -> None:
|
||||
self.addstr(self.pad, 0, (self.width - len(self.message)) // 2,
|
||||
self.message, bold=True, italic=True)
|
||||
self.menubox.update_title(_("STALL"))
|
||||
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
|
||||
self.addstr(self.pad, i + 1, 0, selection
|
||||
+ " " + item.translated_name.capitalize()
|
||||
+ ": " + str(item.price) + " Hazels")
|
||||
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
# German translation of Squirrel Battle
|
||||
# Copyright (C) YEAR ÿnérant, eichhornchen, nicomarg, charlse
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR ÿnérant, eichhornchen, nicomarg, charlse, ifugao
|
||||
# This file is distributed under the same license as the squirrelbattle package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: squirrelbattle 3.14.1\n"
|
||||
"Report-Msgid-Bugs-To: squirrel-battle@crans.org\n"
|
||||
"POT-Creation-Date: 2020-12-11 18:06+0100\n"
|
||||
"POT-Creation-Date: 2020-12-12 17:07+0100\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -15,19 +17,19 @@ msgstr ""
|
|||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: squirrelbattle/display/menudisplay.py:113
|
||||
msgid "== INVENTORY =="
|
||||
msgstr "== BESTAND =="
|
||||
#: squirrelbattle/display/menudisplay.py:139
|
||||
msgid "INVENTORY"
|
||||
msgstr "BESTAND"
|
||||
|
||||
#: squirrelbattle/display/menudisplay.py:134
|
||||
msgid "== STALL =="
|
||||
msgstr "== STAND =="
|
||||
#: squirrelbattle/display/menudisplay.py:164
|
||||
msgid "STALL"
|
||||
msgstr "STAND"
|
||||
|
||||
#: squirrelbattle/display/statsdisplay.py:34
|
||||
#: squirrelbattle/display/statsdisplay.py:33
|
||||
msgid "Inventory:"
|
||||
msgstr "Bestand:"
|
||||
|
||||
#: squirrelbattle/display/statsdisplay.py:53
|
||||
#: squirrelbattle/display/statsdisplay.py:52
|
||||
msgid "YOU ARE DEAD"
|
||||
msgstr "SIE WURDEN GESTORBEN"
|
||||
|
||||
|
@ -51,16 +53,16 @@ msgstr "Die Sonne ist warm heute"
|
|||
msgid "Bomb is exploding."
|
||||
msgstr "Die Bombe explodiert."
|
||||
|
||||
#: squirrelbattle/entities/items.py:224
|
||||
#: squirrelbattle/entities/items.py:248
|
||||
#, python-brace-format
|
||||
msgid "{player} exchanged its body with {entity}."
|
||||
msgstr "{player} täuscht seinem Körper mit {entity} aus."
|
||||
|
||||
#: squirrelbattle/game.py:199 squirrelbattle/tests/game_test.py:537
|
||||
#: squirrelbattle/game.py:203 squirrelbattle/tests/game_test.py:573
|
||||
msgid "You do not have enough money"
|
||||
msgstr ""
|
||||
msgstr "Sie haben nicht genug Geld"
|
||||
|
||||
#: squirrelbattle/game.py:243
|
||||
#: squirrelbattle/game.py:247
|
||||
msgid ""
|
||||
"Some keys are missing in your save file.\n"
|
||||
"Your save seems to be corrupt. It got deleted."
|
||||
|
@ -68,7 +70,7 @@ msgstr ""
|
|||
"In Ihrer Speicherdatei fehlen einige Schlüssel.\n"
|
||||
"Ihre Speicherung scheint korrupt zu sein. Es wird gelöscht."
|
||||
|
||||
#: squirrelbattle/game.py:251
|
||||
#: squirrelbattle/game.py:255
|
||||
msgid ""
|
||||
"No player was found on this map!\n"
|
||||
"Maybe you died?"
|
||||
|
@ -76,7 +78,7 @@ msgstr ""
|
|||
"Auf dieser Karte wurde kein Spieler gefunden!\n"
|
||||
"Vielleicht sind Sie gestorben?"
|
||||
|
||||
#: squirrelbattle/game.py:271
|
||||
#: squirrelbattle/game.py:275
|
||||
msgid ""
|
||||
"The JSON file is not correct.\n"
|
||||
"Your save seems corrupted. It got deleted."
|
||||
|
@ -103,8 +105,8 @@ msgstr "{name} stirbt."
|
|||
msgid "Back"
|
||||
msgstr "Zurück"
|
||||
|
||||
#: squirrelbattle/tests/game_test.py:314 squirrelbattle/tests/game_test.py:317
|
||||
#: squirrelbattle/tests/game_test.py:320
|
||||
#: squirrelbattle/tests/game_test.py:344 squirrelbattle/tests/game_test.py:347
|
||||
#: squirrelbattle/tests/game_test.py:350 squirrelbattle/tests/game_test.py:353
|
||||
#: squirrelbattle/tests/translations_test.py:16
|
||||
msgid "New game"
|
||||
msgstr "Neu Spiel"
|
||||
|
|
|
@ -1,49 +1,67 @@
|
|||
# Spanish translation of Squirrel Battle
|
||||
# Copyright (C) YEAR ÿnérant, eichhornchen, nicomarg, charlse
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR ÿnérant, eichhornchen, nicomarg, charlse, ifugao
|
||||
# This file is distributed under the same license as the squirrelbattle package.
|
||||
# Translation by ifugaao
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: squirrelbattle 3.14.1\n"
|
||||
"Report-Msgid-Bugs-To: squirrel-battle@crans.org\n"
|
||||
"POT-Creation-Date: 2020-12-05 14:46+0100\n"
|
||||
"POT-Creation-Date: 2020-12-12 17:07+0100\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: ifugao\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
# Suggested in Weblate: == INVENTORIO ==
|
||||
#: squirrelbattle/display/menudisplay.py:105
|
||||
msgid "== INVENTORY =="
|
||||
msgstr "== INVENTORIO =="
|
||||
#: squirrelbattle/display/menudisplay.py:139
|
||||
msgid "INVENTORY"
|
||||
msgstr "INVENTORIO"
|
||||
|
||||
# Suggested in Weblate: Inventorio :
|
||||
#: squirrelbattle/display/statsdisplay.py:34
|
||||
#: squirrelbattle/display/menudisplay.py:164
|
||||
msgid "STALL"
|
||||
msgstr "PUESTO"
|
||||
|
||||
#: squirrelbattle/display/statsdisplay.py:33
|
||||
msgid "Inventory:"
|
||||
msgstr "Inventorio :"
|
||||
|
||||
# Suggested in Weblate: ERES MUERTO
|
||||
#: squirrelbattle/display/statsdisplay.py:50
|
||||
#: squirrelbattle/display/statsdisplay.py:52
|
||||
msgid "YOU ARE DEAD"
|
||||
msgstr "ERES MUERTO"
|
||||
|
||||
#: squirrelbattle/entities/friendly.py:33
|
||||
msgid "I don't sell any squirrel"
|
||||
msgstr "No vendo ninguna ardilla"
|
||||
|
||||
#: squirrelbattle/entities/friendly.py:46
|
||||
msgid "Flower power!!"
|
||||
msgstr "Poder de las flores!!"
|
||||
|
||||
#: squirrelbattle/entities/friendly.py:46
|
||||
msgid "The sun is warm today"
|
||||
msgstr "El sol está caliente hoy"
|
||||
|
||||
#. The bomb is exploding.
|
||||
#. Each entity that is close to the bomb takes damages.
|
||||
#. The player earn XP if the entity was killed.
|
||||
#: squirrelbattle/entities/items.py:128
|
||||
#: squirrelbattle/entities/items.py:151
|
||||
msgid "Bomb is exploding."
|
||||
msgstr "La bomba está explotando."
|
||||
|
||||
#: squirrelbattle/entities/items.py:172
|
||||
#: squirrelbattle/entities/items.py:248
|
||||
#, python-brace-format
|
||||
msgid "{player} exchanged its body with {entity}."
|
||||
msgstr "{player} intercambió su cuerpo con {entity}."
|
||||
|
||||
#: squirrelbattle/game.py:177
|
||||
#: squirrelbattle/game.py:203 squirrelbattle/tests/game_test.py:573
|
||||
msgid "You do not have enough money"
|
||||
msgstr "No tienes suficiente dinero"
|
||||
|
||||
#: squirrelbattle/game.py:247
|
||||
msgid ""
|
||||
"Some keys are missing in your save file.\n"
|
||||
"Your save seems to be corrupt. It got deleted."
|
||||
|
@ -51,7 +69,7 @@ msgstr ""
|
|||
"Algunas claves faltan en su archivo de guarda.\n"
|
||||
"Su guarda parece a ser corruptido. Fue eliminado."
|
||||
|
||||
#: squirrelbattle/game.py:185
|
||||
#: squirrelbattle/game.py:255
|
||||
msgid ""
|
||||
"No player was found on this map!\n"
|
||||
"Maybe you died?"
|
||||
|
@ -59,7 +77,7 @@ msgstr ""
|
|||
"No jugador encontrado sobre la carta !\n"
|
||||
"¿ Quizas murió ?"
|
||||
|
||||
#: squirrelbattle/game.py:205
|
||||
#: squirrelbattle/game.py:275
|
||||
msgid ""
|
||||
"The JSON file is not correct.\n"
|
||||
"Your save seems corrupted. It got deleted."
|
||||
|
@ -67,28 +85,27 @@ msgstr ""
|
|||
"El JSON archivo no es correcto.\n"
|
||||
"Su guarda parece corrupta. Fue eliminada."
|
||||
|
||||
#: squirrelbattle/interfaces.py:400
|
||||
#: squirrelbattle/interfaces.py:429
|
||||
#, python-brace-format
|
||||
msgid "{name} hits {opponent}."
|
||||
msgstr "{name} golpea a {opponent}."
|
||||
|
||||
#: squirrelbattle/interfaces.py:412
|
||||
#: squirrelbattle/interfaces.py:441
|
||||
#, python-brace-format
|
||||
msgid "{name} takes {amount} damage."
|
||||
msgstr "{name} recibe {amount} daño."
|
||||
|
||||
#: squirrelbattle/interfaces.py:414
|
||||
#: squirrelbattle/interfaces.py:443
|
||||
#, python-brace-format
|
||||
msgid "{name} dies."
|
||||
msgstr "{name} se muere."
|
||||
|
||||
#: squirrelbattle/menus.py:72
|
||||
#: squirrelbattle/menus.py:73
|
||||
msgid "Back"
|
||||
msgstr "Volver"
|
||||
|
||||
#: squirrelbattle/tests/game_test.py:300,
|
||||
#: squirrelbattle/tests/game_test.py:303,
|
||||
#: squirrelbattle/tests/game_test.py:306,
|
||||
#: squirrelbattle/tests/game_test.py:344 squirrelbattle/tests/game_test.py:347
|
||||
#: squirrelbattle/tests/game_test.py:350 squirrelbattle/tests/game_test.py:353
|
||||
#: squirrelbattle/tests/translations_test.py:16
|
||||
msgid "New game"
|
||||
msgstr "Nuevo partido"
|
||||
|
@ -166,41 +183,49 @@ msgid "Key used to drop an item in the inventory"
|
|||
msgstr "Tecla para dejar un objeto del inventorio"
|
||||
|
||||
#: squirrelbattle/tests/translations_test.py:53
|
||||
msgid "Key used to talk to a friendly entity"
|
||||
msgstr "Tecla para hablar con una entidad amiga"
|
||||
|
||||
#: squirrelbattle/tests/translations_test.py:55
|
||||
msgid "Texture pack"
|
||||
msgstr "Paquete de texturas"
|
||||
|
||||
#: squirrelbattle/tests/translations_test.py:54
|
||||
#: squirrelbattle/tests/translations_test.py:56
|
||||
msgid "Language"
|
||||
msgstr "Languaje"
|
||||
|
||||
#: squirrelbattle/tests/translations_test.py:57
|
||||
#: squirrelbattle/tests/translations_test.py:59
|
||||
msgid "player"
|
||||
msgstr "jugador"
|
||||
|
||||
#: squirrelbattle/tests/translations_test.py:59
|
||||
#: squirrelbattle/tests/translations_test.py:61
|
||||
msgid "tiger"
|
||||
msgstr "tigre"
|
||||
|
||||
#: squirrelbattle/tests/translations_test.py:60
|
||||
#: squirrelbattle/tests/translations_test.py:62
|
||||
msgid "hedgehog"
|
||||
msgstr "erizo"
|
||||
|
||||
#: squirrelbattle/tests/translations_test.py:61
|
||||
#: squirrelbattle/tests/translations_test.py:63
|
||||
msgid "rabbit"
|
||||
msgstr "conejo"
|
||||
|
||||
#: squirrelbattle/tests/translations_test.py:62
|
||||
#: squirrelbattle/tests/translations_test.py:64
|
||||
msgid "teddy bear"
|
||||
msgstr "osito de peluche"
|
||||
|
||||
#: squirrelbattle/tests/translations_test.py:64
|
||||
#: squirrelbattle/tests/translations_test.py:66
|
||||
msgid "body snatch potion"
|
||||
msgstr "poción de intercambio"
|
||||
|
||||
#: squirrelbattle/tests/translations_test.py:65
|
||||
#: squirrelbattle/tests/translations_test.py:67
|
||||
msgid "bomb"
|
||||
msgstr "bomba"
|
||||
|
||||
#: squirrelbattle/tests/translations_test.py:66
|
||||
#: squirrelbattle/tests/translations_test.py:68
|
||||
msgid "heart"
|
||||
msgstr "corazón"
|
||||
|
||||
#: squirrelbattle/tests/translations_test.py:69
|
||||
msgid "sword"
|
||||
msgstr "espada"
|
||||
|
|
|
@ -1,34 +1,35 @@
|
|||
# French translation of Squirrel Battle
|
||||
# Copyright (C) YEAR ÿnérant, eichhornchen, nicomarg, charlse
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR ÿnérant, eichhornchen, nicomarg, charlse, ifugao
|
||||
# This file is distributed under the same license as the squirrelbattle package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: squirrelbattle 3.14.1\n"
|
||||
"Report-Msgid-Bugs-To: squirrel-battle@crans.org\n"
|
||||
"POT-Creation-Date: 2020-12-11 18:06+0100\n"
|
||||
"POT-Creation-Date: 2020-12-12 17:07+0100\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: fr\n"
|
||||
"Language: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: squirrelbattle/display/menudisplay.py:113
|
||||
msgid "== INVENTORY =="
|
||||
msgstr "== INVENTAIRE =="
|
||||
#: squirrelbattle/display/menudisplay.py:139
|
||||
msgid "INVENTORY"
|
||||
msgstr "INVENTAIRE"
|
||||
|
||||
#: squirrelbattle/display/menudisplay.py:134
|
||||
msgid "== STALL =="
|
||||
msgstr "== STAND =="
|
||||
#: squirrelbattle/display/menudisplay.py:164
|
||||
msgid "STALL"
|
||||
msgstr "STAND"
|
||||
|
||||
#: squirrelbattle/display/statsdisplay.py:34
|
||||
#: squirrelbattle/display/statsdisplay.py:33
|
||||
msgid "Inventory:"
|
||||
msgstr "Inventaire :"
|
||||
|
||||
#: squirrelbattle/display/statsdisplay.py:53
|
||||
#: squirrelbattle/display/statsdisplay.py:52
|
||||
msgid "YOU ARE DEAD"
|
||||
msgstr "VOUS ÊTES MORT"
|
||||
|
||||
|
@ -52,16 +53,16 @@ msgstr "Le soleil est chaud aujourd'hui"
|
|||
msgid "Bomb is exploding."
|
||||
msgstr "La bombe explose."
|
||||
|
||||
#: squirrelbattle/entities/items.py:224
|
||||
#: squirrelbattle/entities/items.py:248
|
||||
#, python-brace-format
|
||||
msgid "{player} exchanged its body with {entity}."
|
||||
msgstr "{player} a échangé son corps avec {entity}."
|
||||
|
||||
#: squirrelbattle/game.py:199 squirrelbattle/tests/game_test.py:537
|
||||
#: squirrelbattle/game.py:203 squirrelbattle/tests/game_test.py:573
|
||||
msgid "You do not have enough money"
|
||||
msgstr ""
|
||||
msgstr "Vous n'avez pas assez d'argent"
|
||||
|
||||
#: squirrelbattle/game.py:243
|
||||
#: squirrelbattle/game.py:247
|
||||
msgid ""
|
||||
"Some keys are missing in your save file.\n"
|
||||
"Your save seems to be corrupt. It got deleted."
|
||||
|
@ -69,7 +70,7 @@ msgstr ""
|
|||
"Certaines clés de votre ficher de sauvegarde sont manquantes.\n"
|
||||
"Votre sauvegarde semble corrompue. Elle a été supprimée."
|
||||
|
||||
#: squirrelbattle/game.py:251
|
||||
#: squirrelbattle/game.py:255
|
||||
msgid ""
|
||||
"No player was found on this map!\n"
|
||||
"Maybe you died?"
|
||||
|
@ -77,7 +78,7 @@ msgstr ""
|
|||
"Aucun joueur n'a été trouvé sur la carte !\n"
|
||||
"Peut-être êtes-vous mort ?"
|
||||
|
||||
#: squirrelbattle/game.py:271
|
||||
#: squirrelbattle/game.py:275
|
||||
msgid ""
|
||||
"The JSON file is not correct.\n"
|
||||
"Your save seems corrupted. It got deleted."
|
||||
|
@ -104,8 +105,8 @@ msgstr "{name} meurt."
|
|||
msgid "Back"
|
||||
msgstr "Retour"
|
||||
|
||||
#: squirrelbattle/tests/game_test.py:314 squirrelbattle/tests/game_test.py:317
|
||||
#: squirrelbattle/tests/game_test.py:320
|
||||
#: squirrelbattle/tests/game_test.py:344 squirrelbattle/tests/game_test.py:347
|
||||
#: squirrelbattle/tests/game_test.py:350 squirrelbattle/tests/game_test.py:353
|
||||
#: squirrelbattle/tests/translations_test.py:16
|
||||
msgid "New game"
|
||||
msgstr "Nouvelle partie"
|
||||
|
|
Loading…
Reference in New Issue