Improve log+refactoring

This commit is contained in:
Loic Guegan 2019-10-07 09:29:21 -04:00
parent 1bb0ed2eb9
commit 8159cebf20
4 changed files with 10 additions and 8 deletions

View file

@ -1,9 +1,8 @@
#+TITLE: "i3-colors Project Todo List" #+TITLE: "i3-colors Project Todo List"
#+AUTHOR: "Loic Guegan" #+AUTHOR: "Loic Guegan"
- Refactoring [0/3]: - Refactoring [1/3]:
- [ ] Change src/parser.py name - [X] Change src/parser.py name => now config.py
- [ ] Change src/theme.py name
- [ ] Improve function/variables names - [ ] Improve function/variables names
- YAML Theme Parser [0/2]: - YAML Theme Parser [0/2]:

View file

@ -1,9 +1,13 @@
#!/usr/bin/python #!/usr/bin/python
import parser, theme, os, argparse, subprocess import config, theme, os, argparse, subprocess
##### Utils Functions ##### ##### Utils Functions #####
def log(title, content): print("\033[92m{}\033[00m: {}" .format(title,content)) def log(msg,title=""):
if len(title)>0:
print("\033[92m{}\033[00m: {}" .format(title,msg))
else:
print(msg)
########################### ###########################
@ -18,8 +22,8 @@ args = args_parser.parse_args()
##### Apply Theme ##### ##### Apply Theme #####
loaded_theme=theme.load(args.theme_path) loaded_theme=theme.load(args.theme_path)
for meta_key,meta_value in loaded_theme["meta"].items(): for meta_key,meta_value in loaded_theme["meta"].items():
log(meta_key.title(),meta_value) log(meta_value,title=meta_key.title())
parser.apply_theme(os.environ["HOME"]+"/.config/i3/config",loaded_theme) config.apply_theme(os.environ["HOME"]+"/.config/i3/config",loaded_theme)
if args.restart: if args.restart:
subprocess.Popen("i3-msg restart".split()) subprocess.Popen("i3-msg restart".split())
####################### #######################

View file

@ -1,6 +1,5 @@
import yaml,re import yaml,re
def configure(theme): def configure(theme):
if "colors" in theme: if "colors" in theme:
colors=theme["colors"] colors=theme["colors"]