def __init__( self, start: PointDef, start_parent: GraphicObject, stop: PointDef, stop_parent: GraphicObject, ): """ Args: start: The starting (left) position of the beam start_parent: The parent for the starting position. Must be a staff or in one. stop: The ending (right) position of the beam stop_parent: The parent for the ending position. Must be a staff or in one. """ Path.__init__(self, start, parent=start_parent) StaffObject.__init__(self, start_parent) self.beam_thickness = self.staff.music_font.engraving_defaults[ "beamThickness"] # Draw beam stop = Point.from_def(stop) self.line_to(stop.x, stop.y, stop_parent) self.line_to(stop.x, stop.y + self.beam_thickness, stop_parent) self.line_to(ZERO, self.beam_thickness, self) self.close_subpath()
def __init__( self, start: PointDef, start_parent: GraphicObject, stop: PointDef, stop_parent: Optional[GraphicObject], direction: int, width: Optional[Unit] = None, ): """ Args: start: The starting point. start_parent: The parent for the starting position. Must be a staff or in one. stop: The stopping point. stop_parent: The parent for the ending position. If `None`, defaults to `self`. direction: The direction of the hairpin, where `-1` means diminuendo (>) and `1` means crescendo (<). width: The width of the wide hairpin. Defaults to 1 staff unit. """ Path.__init__(self, start, parent=start_parent) StaffObject.__init__(self, start_parent) stop = Point.from_def(stop) Spanner2D.__init__(self, stop, stop_parent or self) self.direction = direction self.width = width if width is not None else self.staff.unit(1) self.thickness = self.staff.music_font.engraving_defaults[ "hairpinThickness"] self._draw_path()
def __init__( self, start: PointDef, start_parent: GraphicObject, stop: PointDef, stop_parent: Optional[GraphicObject], direction: int = -1, ): """ Args: start: The starting point. start_parent: The parent for the starting position. Must be a staff or in one. stop: The stopping point. stop_parent: The parent for the ending position. If `None`, defaults to `self`. direction: The direction of the slur, where `-1` indicates curving upward, and `1` vice versa. """ Path.__init__(self, start, parent=start_parent, brush=Brush((0, 0, 0, 255))) StaffObject.__init__(self, self.parent) stop = Point.from_def(stop) Spanner2D.__init__(self, stop, stop_parent or self) self.direction = direction # Load relevant engraving defaults from music font engraving_defaults = self.staff.music_font.engraving_defaults self.midpoint_thickness = self.staff.unit( engraving_defaults["slurMidpointThickness"]) self.endpoint_thickness = self.staff.unit( engraving_defaults["slurEndpointThickness"]) self._draw_path()
def __init__( self, pos: PointDef, parent: Union[StaffObject, Staff], duration: BeatDef, ): pos = Point.from_def(pos) self._duration = Beat.from_def(duration) MusicText.__init__(self, pos, [self._glyphnames[self.duration.base_division]], parent) StaffObject.__init__(self, parent)
def pos(self, value: PointDef): self._pos = Point.from_def(value)