forked from ITU-MindMapper/MindMapper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
__init__.py
31 lines (24 loc) · 867 Bytes
/
__init__.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
from mind_mapper.models.project import Project
from xml.etree.ElementTree import fromstring
import logging
class Base(object):
def __init__(self):
self.proj = Project()
self.output_xml = "save.xml"
self.input_xml = "load.xml"
self._set_up_logger()
logging.info("Base loaded!")
def _set_up_logger(self):
logging.basicConfig(
level=logging.DEBUG,
format='[%(asctime)s] {%(pathname)s:%(lineno)d} '
'%(levelname)s - %(message)s',
handlers=[logging.StreamHandler()], datefmt='%H:%M:%S')
def save(self):
with open(self.output_xml, 'w') as out:
out.write(str(self.proj))
def load(self):
with open(self.input_xml, 'r') as inp:
self.proj.deserialize(fromstring(inp.read()))
def run(self):
return 0