-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdashboard.py
30 lines (24 loc) · 888 Bytes
/
dashboard.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
import yaml
from graphs import TYPES
from cache import RenderCache
class Dashboard(object):
def __init__(self, config_file, mc):
self.graphs = []
f = open(config_file, 'r')
conf = yaml.load(f)
for graph_conf in conf:
graph_type = graph_conf['type']
# Now, below, we use a RenderCache instead of a genuine
# Minecraft object. setBlock should work the same but the
# other functions... are not there ! Current implem does
# not use them anyway.
graph = TYPES[graph_type](graph_conf, RenderCache(mc))
self.graphs.append(graph)
def update(self):
for graph in self.graphs:
graph.update()
def cleanup(self):
for graph in self.graphs:
graph.cleanup()
if __name__ == '__main__':
d = Dashboard("config/dashboard.yaml")