Integration of feature into PCell framework

This commit is contained in:
Matthias Koefferlein 2024-03-09 16:24:29 +01:00
parent ce13991542
commit b1cc8ccbdf
3 changed files with 21 additions and 1 deletions

View File

@ -118,6 +118,12 @@ Optional, named parameters are
@li
@b:unit@/b: the unit string
@/li
@li
@b:min_value@/b: the minimum value (effective for numerical types and if no choices are present)
@/li
@li
@b:max_value@/b: the maximum value (effective for numerical types and if no choices are present)
@/li
@li
@b:default@/b: the default value
@/li
@ -335,6 +341,8 @@ module RBA
# :hidden -> (boolean) true, if the parameter is not shown in the dialog
# :readonly -> (boolean) true, if the parameter cannot be edited
# :unit -> the unit string
# :min_value -> the minimum value (only effective for numerical types and if no choices are present)
# :max_value -> the maximum value (only effective for numerical types and if no choices are present)
# :default -> the default value
# :choices -> ([ [ d, v ], ...) choice descriptions/value for choice type
# this method defines accessor methods for the parameters
@ -373,6 +381,8 @@ module RBA
args[:hidden] && pdecl.hidden = args[:hidden]
args[:readonly] && pdecl.readonly = args[:readonly]
args[:unit] && pdecl.unit = args[:unit]
args[:min_value] && pdecl.min_value = args[:min_value]
args[:max_value] && pdecl.max_value = args[:max_value]
if args[:choices]
if !args[:choices].is_a?(Array)
raise ":choices value must be an array of two-element arrays (description, value)"

View File

@ -127,6 +127,12 @@ Optional, named parameters are
@li
@bunit@/b: the unit string
@/li
@li
@bmin_value@/b: the minimum value (effective for numerical types and if no choices are present)
@/li
@li
@bmax_value@/b: the maximum value (effective for numerical types and if no choices are present)
@/li
@li
@bdefault@/b: the default value
@/li

View File

@ -66,7 +66,7 @@ class _PCellDeclarationHelperMixin:
self.layer = None
self.cell = None
def param(self, name, value_type, description, hidden = False, readonly = False, unit = None, default = None, choices = None):
def param(self, name, value_type, description, hidden = False, readonly = False, unit = None, default = None, choices = None, min_value = None, max_value = None):
"""
Defines a parameter
name -> the short name of the parameter
@ -76,6 +76,8 @@ class _PCellDeclarationHelperMixin:
hidden -> (boolean) true, if the parameter is not shown in the dialog
readonly -> (boolean) true, if the parameter cannot be edited
unit -> the unit string
min_value -> the minimum value (only effective for numerical types and if no choices are present)
max_value -> the maximum value (only effective for numerical types and if no choices are present)
default -> the default value
choices -> ([ [ d, v ], ...) choice descriptions/value for choice type
this method defines accessor methods for the parameters
@ -102,6 +104,8 @@ class _PCellDeclarationHelperMixin:
pdecl.readonly = readonly
if not (default is None):
pdecl.default = default
pdecl.min_value = min_value
pdecl.max_value = max_value
if not (unit is None):
pdecl.unit = unit
if not (choices is None):