feat(params): implement class Parameter
This commit is contained in:
parent
7c344e5117
commit
170676df06
1 changed files with 27 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue