See #4497. Show invisible newlines and allow newline editing in attributes.

This commit is contained in:
Dion Moult
2024-04-09 15:25:10 +10:00
parent c50810a24a
commit bcc67ecb31
2 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -121,7 +121,7 @@ def import_attribute(attribute, props, data, callback=None):
elif is_handled_by_callback is False:
props.remove(len(props) - 1)
elif data_type == "string":
new.string_value = "" if new.is_null else str(data[attribute.name()])
new.string_value = "" if new.is_null else str(data[attribute.name()]).replace("\n", "\\n")
if attribute.type_of_attribute().declared_type().name() == "IfcURIReference":
new.is_uri = True
elif data_type == "boolean":
+2
View File
@@ -273,6 +273,8 @@ class Attribute(PropertyGroup):
def get_value(self):
if self.is_optional and self.is_null:
return None
if self.data_type == "string":
return self.string_value.replace("\\n", "\n")
return getattr(self, str(self.get_value_name()), None)
def get_value_default(self):