Example #1
0
 def set_mirror_y(self, enabled):
     """
     If enabled, the graphic is mirrored about the y axis. If false, the
     graphic will return to the original orentation. Returns None.
     """
     assert type(enabled) == bool, "enabled must be a bool"
     if enabled != self._properties['mirror_y']:
         x, y = self.get_position()
         simplepath.scalePath(self._data, -1, 1)  # flip it
         self.set_position(x, y)
         self._properties['changed'] = True
         self._update()
Example #2
0
 def set_mirror_y(self, enabled):
     """
     If enabled, the graphic is mirrored about the y axis. If false, the
     graphic will return to the original orentation. Returns None.
     """
     assert type(enabled) == bool, "enabled must be a bool"
     if enabled != self._properties['mirror_y']:
         x,y = self.get_position()
         simplepath.scalePath(self._data,-1,1) # flip it
         self.set_position(x,y)
         self._properties['changed'] = True
         self._update()
Example #3
0
 def set_scale(self,scale_x,scale_y=None):
     """Scales the graphic relative to the original. Returns None."""
     if scale_y is None:
         scale_y = scale_x
     assert type(scale_x) in [int,float], "scale_x must be an int or float"
     assert type(scale_y) in [int,float], "scale_y must be an int or float"
     assert scale_x > 0, "scale_x must be a postive value!"
     assert scale_y > 0, "scale must be a postive value!"
     last = self.get_scale()
     simplepath.scalePath(self._data,float(scale_x)/last[0],float(scale_y)/last[1])
     self._properties['scale_x'] = scale_x
     self._properties['scale_y'] = scale_y
     self._properties['changed'] = last != self.get_scale()
     self._update()
Example #4
0
 def set_scale(self, scale_x, scale_y=None):
     """Scales the graphic relative to the original. Returns None."""
     if scale_y is None:
         scale_y = scale_x
     assert type(scale_x) in [int, float], "scale_x must be an int or float"
     assert type(scale_y) in [int, float], "scale_y must be an int or float"
     assert scale_x > 0, "scale_x must be a postive value!"
     assert scale_y > 0, "scale must be a postive value!"
     last = self.get_scale()
     simplepath.scalePath(self._data,
                          float(scale_x) / last[0],
                          float(scale_y) / last[1])
     self._properties['scale_x'] = scale_x
     self._properties['scale_y'] = scale_y
     self._properties['changed'] = last != self.get_scale()
     self._update()
Example #5
0
 def set_scale(self,scale_x,scale_y=None):
     """Scales the graphic relative to the original. Returns False."""
     if scale_y is None:
         scale_y = scale_x
     assert type(scale_x) in [int,float], "scale_x must be an int or float"
     assert type(scale_y) in [int,float], "scale_y must be an int or float"
     assert scale_x > 0, "scale_x must be a postive value!"
     assert scale_y > 0, "scale must be a postive value!"
     sx,sy = self.get_scale()
     if sx != scale_x or sy != scale_y:
         simplepath.scalePath(self._data,float(scale_x)/sx,float(scale_y)/sy)
         self._update_bounding_box()
         self._properties['scale_x'] = scale_x
         self._properties['scale_y'] = scale_y
         self._properties['changed'] = True
         self._update()
     return False
Example #6
0
 def set_scale(self, scale_x, scale_y=None):
     """Scales the graphic relative to the original. Returns False."""
     if scale_y is None:
         scale_y = scale_x
     assert type(scale_x) in [int, float], "scale_x must be an int or float"
     assert type(scale_y) in [int, float], "scale_y must be an int or float"
     assert scale_x > 0, "scale_x must be a postive value!"
     assert scale_y > 0, "scale must be a postive value!"
     sx, sy = self.get_scale()
     if sx != scale_x or sy != scale_y:
         simplepath.scalePath(self._data,
                              float(scale_x) / sx,
                              float(scale_y) / sy)
         self._update_bounding_box()
         self._properties['scale_x'] = scale_x
         self._properties['scale_y'] = scale_y
         self._properties['changed'] = True
         self._update()
     return False