diff --git a/frappy/modulebase.py b/frappy/modulebase.py index b9487df5..b1bd473c 100644 --- a/frappy/modulebase.py +++ b/frappy/modulebase.py @@ -37,10 +37,6 @@ from frappy.params import Accessible, Command, Parameter, Limit, PREDEFINED_ACCE from frappy.properties import HasProperties, Property from frappy.logging import RemoteLogHandler -# TODO: resolve cirular import -# from .interfaces import SECoP_BASE_CLASSES -# WORKAROUND: -SECoP_BASE_CLASSES = ['Readable', 'Writable', 'Drivable', 'Communicator'] PREDEF_ORDER = list(PREDEFINED_ACCESSIBLES) Done = UniqueObject('Done') @@ -310,8 +306,8 @@ class Module(HasAccessibles): default='user', extname='visibility') implementation = Property('internal name of the implementation class of the module', StringType(), extname='implementation') - interface_classes = Property('offical highest interface-class of the module', ArrayOf(StringType()), - extname='interface_classes') + interface_classes = Property('offical interface-classes of the module', ArrayOf(StringType()), + extname='interface_classes', default=[]) features = Property('list of features', ArrayOf(StringType()), extname='features') pollinterval = Property('poll interval for parameters handled by doPoll', FloatRange(0.1, 120), default=5) slowinterval = Property('poll interval for other parameters', FloatRange(0.1, 120), default=15) @@ -375,10 +371,6 @@ class Module(HasAccessibles): myclassname = f'{mycls.__module__}.{mycls.__name__}' self.implementation = myclassname - # list of only the 'highest' secop module class - self.interface_classes = [ - b.__name__ for b in mycls.__mro__ if b.__name__ in SECoP_BASE_CLASSES][:1] - # handle Features self.features = [b.__name__ for b in mycls.__mro__ if Feature in b.__bases__] diff --git a/frappy/modules.py b/frappy/modules.py index 241a9bc2..425e63d8 100644 --- a/frappy/modules.py +++ b/frappy/modules.py @@ -36,6 +36,7 @@ from .modulebase import Module class Readable(Module): """basic readable module""" + interface_classes = ['Readable'] # pylint: disable=invalid-name Status = Enum('Status', IDLE=StatusType.IDLE, @@ -55,6 +56,7 @@ class Readable(Module): class Writable(Readable): """basic writable module""" + interface_classes = ['Writable'] target = Parameter('target value of the module', default=0, readonly=False, datatype=FloatRange(unit='$')) @@ -74,7 +76,7 @@ class Writable(Readable): class Drivable(Writable): """basic drivable module""" - + interface_classes = ['Drivable'] status = Parameter(datatype=StatusType(Readable, 'BUSY')) # extend Readable.status def isBusy(self, status=None): @@ -98,6 +100,7 @@ class Drivable(Writable): class Communicator(HasComlog, Module): """basic abstract communication module""" + interface_classes = ['Communicator'] @Command(StringType(), result=StringType()) def communicate(self, command): @@ -109,9 +112,6 @@ class Communicator(HasComlog, Module): raise NotImplementedError() -SECoP_BASE_CLASSES = {Readable, Writable, Drivable, Communicator} - - class Attached(Property): """a special property, defining an attached module