Linting
This commit is contained in:
parent
f33d8b8170
commit
53077aacb0
|
@ -37,7 +37,7 @@ class DisplayManager:
|
||||||
if self.game.state == GameMode.MAINMENU:
|
if self.game.state == GameMode.MAINMENU:
|
||||||
self.mainmenudisplay.refresh(0, 0, self.rows, self.cols)
|
self.mainmenudisplay.refresh(0, 0, self.rows, self.cols)
|
||||||
if self.game.state == GameMode.SETTINGS:
|
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()
|
self.resize_window()
|
||||||
|
|
||||||
def resize_window(self) -> bool:
|
def resize_window(self) -> bool:
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
from typing import List
|
||||||
|
|
||||||
from dungeonbattle.menus import Menu, MainMenu
|
from dungeonbattle.menus import Menu, MainMenu
|
||||||
from .display import Display
|
from .display import Display
|
||||||
|
|
||||||
|
@ -54,7 +56,7 @@ class MenuDisplay(Display):
|
||||||
return self.trueheight + 2
|
return self.trueheight + 2
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def values(self):
|
def values(self) -> List[str]:
|
||||||
return [str(a) for a in self.menu.values]
|
return [str(a) for a in self.menu.values]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ class Game:
|
||||||
elif key == ' ':
|
elif key == ' ':
|
||||||
return KeyValues.SPACE
|
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,
|
Indicates what should be done when the given key is pressed,
|
||||||
according to the current game state.
|
according to the current game state.
|
||||||
|
@ -103,7 +103,7 @@ class Game:
|
||||||
elif self.state == GameMode.MAINMENU:
|
elif self.state == GameMode.MAINMENU:
|
||||||
self.handle_key_pressed_main_menu(key)
|
self.handle_key_pressed_main_menu(key)
|
||||||
elif self.state == GameMode.SETTINGS:
|
elif self.state == GameMode.SETTINGS:
|
||||||
self.handle_key_pressed_settings(key,screen)
|
self.handle_key_pressed_settings(key, screen)
|
||||||
self.display_refresh()
|
self.display_refresh()
|
||||||
|
|
||||||
def handle_key_pressed_play(self, key: KeyValues) -> None:
|
def handle_key_pressed_play(self, key: KeyValues) -> None:
|
||||||
|
@ -142,7 +142,7 @@ class Game:
|
||||||
elif option == menus.MainMenuValues.EXIT:
|
elif option == menus.MainMenuValues.EXIT:
|
||||||
sys.exit(0)
|
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.
|
For now, in the settings mode, we can only go backwards.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -31,12 +31,15 @@ class MainMenuValues(Enum):
|
||||||
class MainMenu(Menu):
|
class MainMenu(Menu):
|
||||||
values = [e for e in MainMenuValues]
|
values = [e for e in MainMenuValues]
|
||||||
|
|
||||||
class SettingsMenu(Menu) :
|
|
||||||
|
class SettingsMenu(Menu):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
def update_values(self, settings : Settings):
|
|
||||||
|
def update_values(self, settings: Settings) -> None:
|
||||||
s = settings.dumps_to_string()
|
s = settings.dumps_to_string()
|
||||||
self.values = s[6:-2].replace("\"","").split(",\n ")
|
self.values = s[6:-2].replace("\"", "").split(",\n ")
|
||||||
|
|
||||||
|
|
||||||
class ArbitraryMenu(Menu):
|
class ArbitraryMenu(Menu):
|
||||||
def __init__(self, values: list):
|
def __init__(self, values: list):
|
||||||
|
|
Loading…
Reference in New Issue