Added scrollbar to GUI, added warning checkboxes to config window, and cleaned up GUI formatting.
This commit is contained in:
parent
86f6cc2659
commit
7d0e3a20c2
2 changed files with 80 additions and 28 deletions
|
@ -75,15 +75,20 @@ class Config:
|
|||
else:
|
||||
raise AttributeError(f"Config has no attribute named '{name}'.")
|
||||
|
||||
def set_val(self, name: str, val: str):
|
||||
def set_val(self, name: str, val):
|
||||
if name in ("warn_load", "warn_save", "warn_delete"):
|
||||
# boolean
|
||||
if val.casefold() in ("on", "true", "yes", "y"):
|
||||
self.settings[name] = True
|
||||
elif val.casefold() in ("off", "false", "no", "n"):
|
||||
self.settings[name] = False
|
||||
if isinstance(val, bool):
|
||||
self.settings[name] = val
|
||||
elif isinstance(val, str):
|
||||
if val.casefold() in ("on", "true", "yes", "y"):
|
||||
self.settings[name] = True
|
||||
elif val.casefold() in ("off", "false", "no", "n"):
|
||||
self.settings[name] = False
|
||||
else:
|
||||
raise ValueError(f"Input cannot be interpreted as boolean: '{val}'")
|
||||
else:
|
||||
raise ValueError(f"Input cannot be interpreted as boolean: '{val}'")
|
||||
raise TypeError(f"Input must be a bool or string.")
|
||||
elif name in Config.defaults:
|
||||
# siletly remove newlines, replace with spaces
|
||||
# This is to prevent weird things.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue