-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigUtils.py
32 lines (26 loc) · 881 Bytes
/
configUtils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import configparser
def load(path):
config = configparser.ConfigParser()
read = None
try:
read = config.read(path)
except configparser.ParsingError as e:
print(f"Couldn't parse config file: {e.message}")
return None
if len(read) == 0:
print(f"Couldn't load config: {path}\n")
return None
if 'window' in config and \
'color' in config['window'] and \
'bcolor' in config['window'] and \
'width' in config['window'] and \
'selection' in config and \
'height' in config['selection'] and \
'width' in config['selection'] and \
'font' in config and \
'selected' in config['font'] and \
'unselected' in config['font']:
return config
else:
print(f"Config is missing settings.\n")
return None