diff --git a/scanslicer/params.py b/scanslicer/params.py index bc058fb..b5bfebd 100644 --- a/scanslicer/params.py +++ b/scanslicer/params.py @@ -3,3 +3,30 @@ import os # Parameter: class definition for ScanSlicer behavior. +class Parameter: + # __init__: function definition for ScanSlicer behavior. + def __init__(self, default, min, max, step, label, label_secondary=""): + self.default = default + self.min = min + self.max = max + self.step = step + self.label = label + self.label_secondary = label_secondary + self.value = default + + # get: function definition for ScanSlicer behavior. + def get(self): + return self.value + + # set: function definition for ScanSlicer behavior. + def set(self, value): + int_value = int(value) + if int_value < self.min: + int_value = self.min + if int_value > self.max: + int_value = self.max + self.value = int_value + + # reset: function definition for ScanSlicer behavior. + def reset(self): + self.value = self.default