Commit 7b682df2 authored by augustin_s's avatar augustin_s 🐍
Browse files

use limit-check mix-in

parent 3b05fb40
......@@ -3,13 +3,14 @@ from slic.core.task import TaskProducer
from .baseadjustable import BaseAdjustable
from .error import AdjustableError
from .convenience import SpecConvenience
from .limited import Limited
class Adjustable(BaseAdjustable, TaskProducer, SpecConvenience):
class Adjustable(BaseAdjustable, TaskProducer, SpecConvenience, Limited):
stop = None #TODO: might be better to make this callable
def __init__(self, ID, name=None, units=None, internal=False):
def __init__(self, ID, name=None, units=None, internal=False, limit_low=None, limit_high=None):
self.ID = ID
self.name = name or ID
self.units = units
......@@ -18,6 +19,9 @@ class Adjustable(BaseAdjustable, TaskProducer, SpecConvenience):
self.set_target_value, _start, self.stop, self.wait =\
self._task_producer(self.set_target_value, stopper=self.stop)
self.set_limits(limit_low, limit_high)
self.set_target_value = self._with_check_limits(self.set_target_value)
def tweak(self, delta, *args, **kwargs):
value = self.get_current_value()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment