tuikit/core/coords.py
changeset 115 b4ff7392003a
parent 108 11dac45bfba4
child 119 dd91747504dd
equal deleted inserted replaced
114:26c02bd94bd9 115:b4ff7392003a
    81             return False
    81             return False
    82 
    82 
    83     # string representation
    83     # string representation
    84 
    84 
    85     def __repr__(self):
    85     def __repr__(self):
    86         return '{0.__class__.__name__}(x={0.x},y={0.y})'.format(self)
    86         return '{0.__class__.__name__}(x={0.x}, y={0.y})'.format(self)
    87 
    87 
    88     def immutable(self):
    88     def immutable(self):
    89         return ImmutablePoint(*self)
    89         return ImmutablePoint(*self)
    90 
    90 
    91 
    91 
   134 
   134 
   135     def __getitem__(self, key):
   135     def __getitem__(self, key):
   136         return (self.w, self.h)[key]
   136         return (self.w, self.h)[key]
   137 
   137 
   138     def __repr__(self):
   138     def __repr__(self):
   139         return '{0.__class__.__name__}(w={0.w},h={0.h})'.format(self)
   139         return '{0.__class__.__name__}(w={0.w}, h={0.h})'.format(self)
   140 
   140 
   141     def update(self, *args, **kwargs):
   141     def update(self, *args, **kwargs):
   142         """Update size.
   142         """Update size.
   143 
   143 
   144         Accepts positional or keyword arguments:
   144         Accepts positional or keyword arguments:
   217         x, y = origin
   217         x, y = origin
   218         w, h = size
   218         w, h = size
   219         return Rect(x, y, w, h)
   219         return Rect(x, y, w, h)
   220 
   220 
   221     def __repr__(self):
   221     def __repr__(self):
   222         return '{0.__class__.__name__}(x={0.x},y={0.y},w={0.w},h={0.h})'.format(self)
   222         return '{0.__class__.__name__}(x={0.x}, y={0.y}, w={0.w}, h={0.h})'.format(self)
   223 
   223 
   224     def __contains__(self, point):
   224     def __contains__(self, point):
   225         """Test if point is positioned inside rectangle.
   225         """Test if point is positioned inside rectangle.
   226 
   226 
   227         `point` should be either Point or pair of int values.
   227         `point` should be either Point or pair of int values.