Add setters for archetypes and constructions catalogues
This commit is contained in:
parent
d41ce5371e
commit
6854b35647
|
@ -14,26 +14,31 @@ class AccessNrcanCatalog:
|
|||
"""
|
||||
AccessNrcanCatalog class
|
||||
"""
|
||||
def __init__(self, path):
|
||||
def __init__(
|
||||
self, path,
|
||||
archetypes='nrcan_archetypes.json',
|
||||
constructions='nrcan_constructions.json'):
|
||||
self._path = Path(path)
|
||||
self._archetypes = self._load_archetypes()
|
||||
self._constructions = self._load_constructions()
|
||||
self.archetypes = archetypes
|
||||
self.constructions = constructions
|
||||
|
||||
@property
|
||||
def archetypes(self):
|
||||
return self._archetypes
|
||||
|
||||
@archetypes.setter
|
||||
def archetypes(self, archetypes):
|
||||
archetypes_path = (self._path / archetypes).resolve()
|
||||
self._archetypes = json.loads(archetypes_path.read_text())
|
||||
|
||||
@property
|
||||
def constructions(self):
|
||||
return self._constructions
|
||||
|
||||
def _load_archetypes(self):
|
||||
archetypes_path = (self._path / 'nrcan_archetypes.json').resolve()
|
||||
return json.loads(archetypes_path.read_text())
|
||||
|
||||
def _load_constructions(self):
|
||||
constructions_path = (self._path / 'nrcan_constructions.json').resolve()
|
||||
return json.loads(constructions_path.read_text())
|
||||
@constructions.setter
|
||||
def constructions(self, constructions):
|
||||
constructions_path = (self._path / constructions).resolve()
|
||||
self._constructions = json.loads(constructions_path.read_text())
|
||||
|
||||
def layers(self, opaque_surface_code, component_type):
|
||||
for opaque_surface in self.constructions['opaque_surfaces']:
|
||||
|
|
Loading…
Reference in New Issue
Block a user