Display comments on settings menu
This commit is contained in:
parent
1eee45a0fd
commit
13ac2ba13a
@ -56,8 +56,15 @@ class SettingsMenu(Menu):
|
||||
waiting_for_key: bool = False
|
||||
|
||||
def update_values(self, settings: Settings) -> None:
|
||||
s = settings.dumps_to_string()
|
||||
self.values = s[6:-2].replace("\"", "").split(",\n ")
|
||||
self.values = []
|
||||
for i, key in enumerate(settings.settings_keys):
|
||||
s = settings.get_comment(key)
|
||||
s += " : "
|
||||
if self.waiting_for_key and i == self.position:
|
||||
s += "? "
|
||||
else:
|
||||
s += getattr(settings, key).replace("\n", "\\n")
|
||||
self.values.append(s)
|
||||
|
||||
def handle_key_pressed(self, key: Optional[KeyValues], raw_key: str,
|
||||
game: Any) -> None:
|
||||
@ -72,15 +79,16 @@ class SettingsMenu(Menu):
|
||||
if key == KeyValues.UP:
|
||||
self.go_up()
|
||||
if key == KeyValues.ENTER:
|
||||
option = self.validate().split(": ")[0]
|
||||
option = list(game.settings.settings_keys)[self.position]
|
||||
if option != "TEXTURE_PACK":
|
||||
self.waiting_for_key = True
|
||||
self.update_values(game.settings)
|
||||
else:
|
||||
option = self.validate().split(": ")[0]
|
||||
option = list(game.settings.settings_keys)[self.position]
|
||||
setattr(game.settings, option, raw_key)
|
||||
game.settings.write_settings()
|
||||
self.update_values(game.settings)
|
||||
self.waiting_for_key = False
|
||||
self.update_values(game.settings)
|
||||
|
||||
|
||||
class ArbitraryMenu(Menu):
|
||||
|
Loading…
Reference in New Issue
Block a user