From d0b93f18c92a3b71b091a498acbba2e8419ef94c Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Mon, 7 Oct 2019 21:15:06 -0400 Subject: Debug --- src/theme.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/theme.py') diff --git a/src/theme.py b/src/theme.py index ad59ca4..50a7ee0 100644 --- a/src/theme.py +++ b/src/theme.py @@ -1,6 +1,9 @@ import yaml,re, sys def configure(theme): + """ + Apply user define colors and apply some correction factors. + """ if "colors" in theme: colors=theme["colors"] window_colors=theme["window_colors"] @@ -36,6 +39,9 @@ def configure(theme): return(theme) def validate(theme): + """ + Abort if theme is in a wrong format. + """ abort=lambda msg: sys.exit("Error while loading theme: "+msg) inv_key=lambda key: abort("invalid key \""+key+"\"") for key,value in theme.items(): @@ -51,8 +57,14 @@ def validate(theme): if not(key in ["focused","focused_inactive","unfocused","urgent","child_border"]): inv_key(key) - def load(theme_file): + """ + Load a theme as a dict(): + - Open YAML file + - Parse it as a dict + - Configure the parsed dict + - Validate the configured dict + """ f=open(theme_file,mode="r") theme=yaml.load(f,Loader=yaml.FullLoader) f.close() -- cgit v1.2.3