2020-10-06 13:59:06 +02:00
|
|
|
from abc import ABCMeta, abstractmethod
|
|
|
|
class formatHandlerBase(object, metaclass=ABCMeta):
|
2020-07-03 14:51:12 +02:00
|
|
|
def __init__(self,TexOps, commands=[]):
|
|
|
|
self.TexOps=TexOps
|
2020-10-08 18:41:13 +02:00
|
|
|
self.Commands=commands
|
2020-07-03 14:51:12 +02:00
|
|
|
@abstractmethod
|
2021-11-09 10:34:48 +01:00
|
|
|
def _readFromTableCore(self,table):
|
|
|
|
raise NotImplementedError()
|
|
|
|
|
2020-07-03 14:51:12 +02:00
|
|
|
def readFromTable(self,table):
|
2021-11-09 10:34:48 +01:00
|
|
|
dataFiles=self._readFromTableCore(table)
|
|
|
|
for file in dataFiles:
|
|
|
|
self.__applyMetadataFromOptions(file)
|
|
|
|
return dataFiles
|
|
|
|
def __applyMetadataFromOptions(self,file):
|
|
|
|
if hasattr(file, "geometry"):
|
|
|
|
file.geometry = self.TexOps.geometries[file.molecule]
|
|
|
|
file.set = self.TexOps.set
|