-
Notifications
You must be signed in to change notification settings - Fork 1
/
simpleconfig.py
42 lines (30 loc) · 1.11 KB
/
simpleconfig.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
33
34
35
36
37
38
39
40
41
42
import yaml
class SimpleConfig:
def __init__(self):
self.__config = []
def load(self, filePath):
self.__config = []
with open(filePath, 'r') as stream:
try:
self.__config = yaml.load(stream)
except yaml.YAMLError as exc:
print(exc)
return self
def getServerHost(self):
return self.__config['server']['host']
def getServerPort(self):
return self.__config['server']['port']
def getImageFilePath(self):
return self.__config['image']['filepath']
def useColorBasedImageTransparency(self):
return self.__config['image']['color_transparency']['enabled']
def getImageTransparencyColor(self):
return self.__config['image']['color_transparency']['color']
def getStrategy(self):
return self.__config['draw']['strategy']
def getDrawWidth(self):
return self.__config['draw']['width']
def getDrawPositionX(self):
return self.__config['draw']['position']['x']
def getDrawPositionY(self):
return self.__config['draw']['position']['y']