fix inheritance problem with mixin

- a mixin should not inherit from module then it has Parameters
- Parameters in mixins must be complete, not just overrides
- check precedence of read_<param> or handler

Change-Id: I72d9355a1982770d1a99d9552a20330103c97edb
This commit is contained in:
2021-03-18 13:32:54 +01:00
parent 6538500881
commit 48230334af
9 changed files with 55 additions and 24 deletions

View File

@ -128,8 +128,9 @@ class Main(Communicator):
return data # return data as string
class PpmsBase(HasIodev, Readable):
class PpmsMixin:
"""common base for all ppms modules"""
iodev = Attached()
pollerClass = Poller
@ -139,7 +140,7 @@ class PpmsBase(HasIodev, Readable):
# as this pollinterval affects only the polling of settings
# it would be confusing to export it.
pollinterval = Parameter(export=False)
pollinterval = Parameter('', FloatRange(), needscfg=False, export=False)
def initModule(self):
self._iodev.register(self)
@ -172,7 +173,7 @@ class PpmsBase(HasIodev, Readable):
self.status = (self.Status.IDLE, '')
class Channel(PpmsBase):
class Channel(PpmsMixin, HasIodev, Readable):
"""channel base class"""
value = Parameter('main value of channels', poll=True)
@ -270,7 +271,7 @@ class BridgeChannel(Channel):
return self.no, 0, 0, change.dcflag, change.readingmode, 0
class Level(PpmsBase):
class Level(PpmsMixin, HasIodev, Readable):
"""helium level"""
level = IOHandler('level', 'LEVEL?', '%g,%d')
@ -293,7 +294,7 @@ class Level(PpmsBase):
return dict(value=level, status=(self.Status.IDLE, ''))
class Chamber(PpmsBase, Drivable):
class Chamber(PpmsMixin, HasIodev, Drivable):
"""sample chamber handling
value is an Enum, which is redundant with the status text
@ -368,7 +369,7 @@ class Chamber(PpmsBase, Drivable):
return (change.target,)
class Temp(PpmsBase, Drivable):
class Temp(PpmsMixin, HasIodev, Drivable):
"""temperature"""
temp = IOHandler('temp', 'TEMP?', '%g,%g,%d')
@ -553,7 +554,7 @@ class Temp(PpmsBase, Drivable):
self._stopped = True
class Field(PpmsBase, Drivable):
class Field(PpmsMixin, HasIodev, Drivable):
"""magnetic field"""
field = IOHandler('field', 'FIELD?', '%g,%g,%d,%d')
@ -562,6 +563,7 @@ class Field(PpmsBase, Drivable):
PREPARED=150,
PREPARING=340,
RAMPING=370,
STABILIZING=380,
FINALIZING=390,
)
# pylint: disable=invalid-name
@ -584,7 +586,7 @@ class Field(PpmsBase, Drivable):
2: (Status.PREPARING, 'switch warming'),
3: (Status.FINALIZING, 'switch cooling'),
4: (Status.IDLE, 'driven stable'),
5: (Status.FINALIZING, 'driven final'),
5: (Status.STABILIZING, 'driven final'),
6: (Status.RAMPING, 'charging'),
7: (Status.RAMPING, 'discharging'),
8: (Status.ERROR, 'current error'),
@ -690,7 +692,7 @@ class Field(PpmsBase, Drivable):
self._stopped = True
class Position(PpmsBase, Drivable):
class Position(PpmsMixin, HasIodev, Drivable):
"""rotator position"""
move = IOHandler('move', 'MOVE?', '%g,%g,%g')