Main menu width must be updated when the language got changed

This commit is contained in:
Yohann D'ANELLO 2020-11-27 21:51:54 +01:00
parent c151e0f656
commit 31b7ece449
2 changed files with 9 additions and 3 deletions

View File

@ -17,8 +17,6 @@ class MenuDisplay(Display):
def update_menu(self, menu: Menu) -> None: def update_menu(self, menu: Menu) -> None:
self.menu = menu self.menu = menu
self.trueheight = len(self.values)
self.truewidth = max([len(str(a)) for a in self.values])
# Menu values are printed in pad # Menu values are printed in pad
self.pad = self.newpad(self.trueheight, self.truewidth + 2) self.pad = self.newpad(self.trueheight, self.truewidth + 2)
@ -44,6 +42,14 @@ class MenuDisplay(Display):
self.height - 2 + self.y, self.height - 2 + self.y,
self.width - 2 + self.x) self.width - 2 + self.x)
@property
def truewidth(self) -> int:
return max([len(str(a)) for a in self.values])
@property
def trueheight(self) -> int:
return len(self.values)
@property @property
def preferred_width(self) -> int: def preferred_width(self) -> int:
return self.truewidth + 6 return self.truewidth + 6

View File

@ -37,8 +37,8 @@ class Game:
self.settings = Settings() self.settings = Settings()
self.settings.load_settings() self.settings.load_settings()
self.settings.write_settings() self.settings.write_settings()
self.settings_menu.update_values(self.settings)
setlocale(self.settings.LOCALE) setlocale(self.settings.LOCALE)
self.settings_menu.update_values(self.settings)
self.logs = Logs() self.logs = Logs()
self.message = None self.message = None