diff --git a/dungeonbattle/display/display_manager.py b/dungeonbattle/display/display_manager.py index ea5c8ca..18b61c3 100644 --- a/dungeonbattle/display/display_manager.py +++ b/dungeonbattle/display/display_manager.py @@ -37,7 +37,7 @@ class DisplayManager: if self.game.state == GameMode.MAINMENU: self.mainmenudisplay.refresh(0, 0, self.rows, self.cols) if self.game.state == GameMode.SETTINGS: - self.settingsmenudisplay.refresh(0, 0, self.rows, self.cols-1) + self.settingsmenudisplay.refresh(0, 0, self.rows, self.cols - 1) self.resize_window() def resize_window(self) -> bool: diff --git a/dungeonbattle/display/menudisplay.py b/dungeonbattle/display/menudisplay.py index d25fe61..973dd31 100644 --- a/dungeonbattle/display/menudisplay.py +++ b/dungeonbattle/display/menudisplay.py @@ -1,3 +1,5 @@ +from typing import List + from dungeonbattle.menus import Menu, MainMenu from .display import Display @@ -54,7 +56,7 @@ class MenuDisplay(Display): return self.trueheight + 2 @property - def values(self): + def values(self) -> List[str]: return [str(a) for a in self.menu.values] diff --git a/dungeonbattle/game.py b/dungeonbattle/game.py index 4bbe9b8..ff1c91e 100644 --- a/dungeonbattle/game.py +++ b/dungeonbattle/game.py @@ -93,7 +93,7 @@ class Game: elif key == ' ': return KeyValues.SPACE - def handle_key_pressed(self, key: KeyValues, screen) -> None: + def handle_key_pressed(self, key: KeyValues, screen: Any) -> None: """ Indicates what should be done when the given key is pressed, according to the current game state. @@ -103,7 +103,7 @@ class Game: elif self.state == GameMode.MAINMENU: self.handle_key_pressed_main_menu(key) elif self.state == GameMode.SETTINGS: - self.handle_key_pressed_settings(key,screen) + self.handle_key_pressed_settings(key, screen) self.display_refresh() def handle_key_pressed_play(self, key: KeyValues) -> None: @@ -142,7 +142,7 @@ class Game: elif option == menus.MainMenuValues.EXIT: sys.exit(0) - def handle_key_pressed_settings(self, key: KeyValues, screen : Any) -> None: + def handle_key_pressed_settings(self, key: KeyValues, screen: Any) -> None: """ For now, in the settings mode, we can only go backwards. """ diff --git a/dungeonbattle/menus.py b/dungeonbattle/menus.py index 06ef556..20a103e 100644 --- a/dungeonbattle/menus.py +++ b/dungeonbattle/menus.py @@ -31,12 +31,15 @@ class MainMenuValues(Enum): class MainMenu(Menu): values = [e for e in MainMenuValues] -class SettingsMenu(Menu) : + +class SettingsMenu(Menu): def __init__(self): super().__init__() - def update_values(self, settings : Settings): + + def update_values(self, settings: Settings) -> None: s = settings.dumps_to_string() - self.values = s[6:-2].replace("\"","").split(",\n ") + self.values = s[6:-2].replace("\"", "").split(",\n ") + class ArbitraryMenu(Menu): def __init__(self, values: list):