mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 23:19:57 +00:00
i_set_the_prop_property_to_value - don't fail silently on incorrect bool values
This commit is contained in:
@@ -549,6 +549,8 @@ def i_set_the_prop_property_to_value(prop: str, value: str):
|
|||||||
"""
|
"""
|
||||||
:param prop: Could be either property name, property text, property icon
|
:param prop: Could be either property name, property text, property icon
|
||||||
or property index (e.g. "1st", "2nd", "5th").
|
or property index (e.g. "1st", "2nd", "5th").
|
||||||
|
:param value:
|
||||||
|
For boolean propeties - 'TRUE' or 'FALSE'.
|
||||||
"""
|
"""
|
||||||
value = value.strip()
|
value = value.strip()
|
||||||
assert panel_spy
|
assert panel_spy
|
||||||
@@ -566,6 +568,8 @@ def i_set_the_prop_property_to_value(prop: str, value: str):
|
|||||||
setattr(spied_prop["props"], spied_prop["name"], True)
|
setattr(spied_prop["props"], spied_prop["name"], True)
|
||||||
elif value == "FALSE":
|
elif value == "FALSE":
|
||||||
setattr(spied_prop["props"], spied_prop["name"], False)
|
setattr(spied_prop["props"], spied_prop["name"], False)
|
||||||
|
else:
|
||||||
|
assert False, f"Unexpected value for BOOLEAN property: '{value}'. Allowed values: TRUE, FALSE."
|
||||||
elif spied_prop["prop_type"] == "FLOAT":
|
elif spied_prop["prop_type"] == "FLOAT":
|
||||||
setattr(spied_prop["props"], spied_prop["name"], float(value))
|
setattr(spied_prop["props"], spied_prop["name"], float(value))
|
||||||
elif spied_prop["prop_type"] == "INT":
|
elif spied_prop["prop_type"] == "INT":
|
||||||
|
|||||||
Reference in New Issue
Block a user