def __init__(self, center, radius, start_angle, end_angle, st=None, lt=None, col=None, th=None, **kw): """Initialize a Arc. Arc(center, radius, start_angle, end_angle) The center should be a Point, or a two-entry tuple of floats, and the radius should be a float greater than 0. """ _cp = center if not isinstance(_cp, point.Point): _cp = point.Point(center) _r = util.get_float(radius) if not _r > 0.0: raise ValueError, "Invalid radius: %g" % _r _st = st _sa = util.make_c_angle(start_angle) _ea = util.make_c_angle(end_angle) if _st is None: _st = self.getDefaultStyle() super(Arc, self).__init__(_st, lt, col, th, **kw) self.__radius = _r self.__sa = _sa self.__ea = _ea self.__center = _cp _cp.connect('moved', self.__movePoint) _cp.connect('change_pending', self.__pointChangePending) _cp.connect('change_complete', self.__pointChangeComplete) _cp.storeUser(self)
def setEndAngle(self, angle): """Set the end_angle for the Arc. setEndAngle(angle) The argument angle should be a float. """ if self.isLocked(): raise RuntimeError, "Setting end angle not allowed - object locked." _ea = self.__ea _angle = util.make_c_angle(angle) if abs(_ea - _angle) > 1e-10: self.startChange('end_angle_changed') self.__ea = _angle self.endChange('end_angle_changed') self.sendMessage('end_angle_changed', _ea) _cx, _cy = self.__center.getCoords() self.sendMessage('moved', _cx, _cy, self.__radius, self.__sa, _ea) self.modified()