diff --git a/base.py b/base.py index 0e33ccd..22708cf 100644 --- a/base.py +++ b/base.py @@ -406,7 +406,7 @@ class rStringList(rObject): rName = "rStringList" rType = 0x8007 - def __init__(self, strings, **kwargs): + def __init__(self, *strings, **kwargs): super().__init__(**kwargs) self.children = [str_to_bytes(x) for x in strings] @@ -419,7 +419,7 @@ class rStringList(rObject): def _rez_string(self): rv = "\t{\n" - rv += ",\n".join([format_string_multi(x) for x in self.children]) + rv += ",\n".join([multi_format_string(x, "\t\t") for x in self.children]) if self.children: rv += "\n" rv += "\t}" return rv diff --git a/examples/string.prez b/examples/string.prez new file mode 100644 index 0000000..3957516 --- /dev/null +++ b/examples/string.prez @@ -0,0 +1,28 @@ +# +# text can be a python string or a bytes object. +# strings are assumed to be utf-8 encoded and will be converted to macroman +# bytes are left as-is +# +# n.b. - in Rez, \r and \n are reversed. +# In prez, they have their standard (python) meaning. +# + +rText("rText") +rTextBlock(b"rTextBlock") # bytes +rTextForLETextBox2("rTextForLETextBox2") +rAlertString("rAlertString") +rErrorString("rErrorString") + + +from textwrap import dedent +rComment(dedent(""" + rComment + + multi-line python string. +""")) # remove leading space from the mult-line string. +rPString("rPString") +rCString("rCString") +rWString("rWString") +rC1InputString("rC1InputString") + +rStringList('rStringList', b"rStringList", r"rStringList")