Add a GetIM() method to Colour, Point, Size, Rect and other ‘value’ types.

GetIM() returns a replicant of the original object that is immutable, so it can be used as a dictionary key, or etc., but still gives access to the properties by name, which using the Get() method to get a tuple of the values does not do.
This commit is contained in:
Robin Dunn
2017-04-14 19:19:26 -07:00
parent a79cd3254c
commit 52facb4d7f
15 changed files with 194 additions and 0 deletions

View File

@@ -171,6 +171,8 @@ def run():
pyArgsString="() -> (start, end)",
briefDoc="Return the start and end properties as a tuple.")
tools.addGetIMMethodTemplate(module, c, ['Start', 'End'])
# Add sequence protocol methods and other goodies
c.addPyMethod('__str__', '(self)', 'return str(self.Get())')
c.addPyMethod('__repr__', '(self)', 'return "RichTextRange"+str(self.Get())')