mirror of
https://github.com/ksherlock/prez.git
synced 2024-06-02 03:41:33 +00:00
string examples.
This commit is contained in:
parent
feeb5f260e
commit
c4c833c898
4
base.py
4
base.py
|
@ -406,7 +406,7 @@ class rStringList(rObject):
|
||||||
rName = "rStringList"
|
rName = "rStringList"
|
||||||
rType = 0x8007
|
rType = 0x8007
|
||||||
|
|
||||||
def __init__(self, strings, **kwargs):
|
def __init__(self, *strings, **kwargs):
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
self.children = [str_to_bytes(x) for x in strings]
|
self.children = [str_to_bytes(x) for x in strings]
|
||||||
|
|
||||||
|
@ -419,7 +419,7 @@ class rStringList(rObject):
|
||||||
|
|
||||||
def _rez_string(self):
|
def _rez_string(self):
|
||||||
rv = "\t{\n"
|
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"
|
if self.children: rv += "\n"
|
||||||
rv += "\t}"
|
rv += "\t}"
|
||||||
return rv
|
return rv
|
||||||
|
|
28
examples/string.prez
Normal file
28
examples/string.prez
Normal file
|
@ -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")
|
Loading…
Reference in New Issue
Block a user