Pcell limits (#1654)

* Klayout PyCell integration
-added tl::optional as derivate of std::optional for c++17 and above, reduced
 implementation otherwise
-fixed missing include for c++17 and above
-added range constraints for PCell parameter

Signed-off-by: ThomasZecha <[email protected]>

* tl::optional now based on internal implementation, added tests and tl::to_string binding

* Refactoring the range into min_value and max_value attributes without action and resolution.

* Integration of feature into PCell framework

* Cleanup and fixed some compile issues

* Cleanup, added tests

* [consider merging] Added pymod distutil_src files to dependencies.

* Updated Python stubs

* User feedback: upon entering an invalid value string into an edit box, do not reset the field

---------

Signed-off-by: ThomasZecha <[email protected]>
Co-authored-by: ThomasZecha <[email protected]>
Co-authored-by: Matthias Koefferlein <[email protected]>
This commit is contained in:
Matthias Köfferlein
2024-03-13 21:50:48 +01:00
committed by GitHub
co-authored by ThomasZecha Matthias Koefferlein
parent 230bacf725
commit fa14afbbf3
17 changed files with 1330 additions and 454 deletions
+72
View File
@@ -190,6 +190,78 @@ def norm_hash(hash)
end
class DBPCellAPI_TestClass < TestBase
def test_1
# PCellParameterDeclaration
decl = RBA::PCellParameterDeclaration::new("name", RBA::PCellParameterDeclaration::TypeString, "description")
assert_equal(decl.name, "name")
assert_equal(decl.description, "description")
assert_equal(decl.default.inspect, "nil")
assert_equal(decl.unit, "")
assert_equal(decl.type, RBA::PCellParameterDeclaration::TypeString)
decl = RBA::PCellParameterDeclaration::new("name", RBA::PCellParameterDeclaration::TypeString, "description", "17")
assert_equal(decl.name, "name")
assert_equal(decl.description, "description")
assert_equal(decl.type, RBA::PCellParameterDeclaration::TypeString)
assert_equal(decl.default.to_s, "17")
assert_equal(decl.unit, "")
decl = RBA::PCellParameterDeclaration::new("name", RBA::PCellParameterDeclaration::TypeString, "description", "17", "unit")
assert_equal(decl.name, "name")
assert_equal(decl.description, "description")
assert_equal(decl.type, RBA::PCellParameterDeclaration::TypeString)
assert_equal(decl.default.to_s, "17")
assert_equal(decl.unit, "unit")
decl.name = "n"
assert_equal(decl.name, "n")
decl.description = "d"
assert_equal(decl.description, "d")
decl.unit = "u"
assert_equal(decl.unit, "u")
decl.type = RBA::PCellParameterDeclaration::TypeBoolean
assert_equal(decl.type, RBA::PCellParameterDeclaration::TypeBoolean)
decl.default = true
assert_equal(decl.default.to_s, "true")
decl.type = RBA::PCellParameterDeclaration::TypeInt
assert_equal(decl.min_value.inspect, "nil")
assert_equal(decl.max_value.inspect, "nil")
decl.min_value = "-1"
assert_equal(decl.min_value.to_s, "-1")
decl.max_value = "42"
assert_equal(decl.max_value.to_s, "42")
decl.min_value = nil
decl.max_value = nil
assert_equal(decl.min_value.inspect, "nil")
assert_equal(decl.max_value.inspect, "nil")
assert_equal(decl.hidden?, false)
decl.hidden = true
assert_equal(decl.hidden?, true)
assert_equal(decl.readonly?, false)
decl.readonly = true
assert_equal(decl.readonly?, true)
decl.add_choice("first", 42)
assert_equal(decl.choice_values, [42])
assert_equal(decl.choice_descriptions, ["first"])
decl.clear_choices
assert_equal(decl.choice_values, [])
assert_equal(decl.choice_descriptions, [])
end
end
class DBPCell_TestClass < TestBase
def test_1