Finish type checking.

On incomplete for lack of testing.
This commit is contained in:
Emma Nora Ada Theuer 2025-03-10 18:53:39 +01:00
parent b2268f31bd
commit 305a4e5882

View file

@ -24,7 +24,17 @@ class _Config:
logger.critical("The general dictionary was not found or contains errors")
print("CRITICAL: The general dictionary was not found or contains errors")
raise ConfigError("The general dictionary was not found or contains errors")
# Changing times
if not self._validate_fallback_wallpaper():
print("ERROR: Cannot use a fallback wallpaper: Incorrect type.")
logger.error("Cannot use a fallback wallpaper: Incorrect type.")
else:
logger.debug("Will use a fallback wallpaper")
if not self._validate_types():
logger.critical("Wallman encountered incompatible types in critical variables. exiting.")
print("CRITICAL: Wallman encountered incompatible types in critical variables. exiting.")
raise ConfigError("Wallman encountered incompatible types in critical variables.")
else:
logger.debug("All critical types match the required type.")
self.use_fallback_wallpaper: bool = self._validate_fallback_wallpaper():
if not self.use_fallback_wallpaper:
logger.warning("No fallback wallpaper will be used.")
@ -354,7 +364,22 @@ class _Config:
logger.debug("used_sets is a list of strings.")
# systray
if not isinstance(self.config_systray, bool):
logger.error("")
logger.error("The type of systray in the config is not a bool. Defaulting to true.")
print("ERROR: The type of systray in the config is not a bool. Defaulting to true.")
else:
print("The type of systray in the config is correct.")
# Wallpaper behavior
if not isinstance(self.config_behavior, str):
print("ERROR: The type of behavior in the config file is not str. Defaulting to fill.")
logger.error("The type of behavior in the config file is not str. Defaulting to fill.")
else:
logger.debug("The type of behavior in the config file is str.")
# notifications
if not isinstance(self.config_notify, bool):
logger.error("The type of notify in the config is not bool, defaulting to False")
print("ERROR: The type of notify in the config is not bool, defaulting to False")
else:
logger.debug("The type of notify in the config is bool.")