Attribute decorators
Created by: stanislaw55
Hi, according to docs, it's currently possible to have syntax like this
class PowerSupply(Device):
def init_device(self):
Device.init_device(self)
self._current = -1
@attribute(label="Current", unit="mA", dtype=int)
def current(self):
return self._current
@current.write
def current(self, current):
self._current = current
what about extending attribute class to have syntax like this
class DecoratorTest(Device):
def init_device(self):
Device.init_device(self)
self._current = -1
current = attribute(label="Current", unit="mA", dtype=int)
@current.getter
def cur_read(self):
return self._current
@current.write
def cur_write(self, current):
self._current = current
@current.is_allowed
def cur_allo(self, req_type):
return True
Edited by Anton Joubert