Example #1
0
    def __init__(self,
                 id: Any = 1,
                 line_end: Union[str, LineEnd] = None,
                 end_length: Real = None,
                 text: Union[str, TextAnnotation] = None,
                 placement: Union[str, StaffPlacement] = "above",
                 voice: int = 1,
                 staff: int = None):
        """
        End of a bracket spanner.

        :param id: this should correspond to the id of the associated :class:`StartBracket`
        :param line_end: Type of hook/arrow at the end of this bracket
        :param end_length: Length of the hock at the end of this bracket
        :param text: Any text to attach to the end of this bracket
        :param placement: Where to place the direction in relation to the staff ("above" or "below")
        :param voice: Which voice to attach to
        :param staff: Which staff to attach to if the part has multiple staves
        """
        StopNumberedSpanner.__init__(self, id)
        Direction.__init__(self, placement, voice, staff)
        self.line_end = LineEnd(line_end) if isinstance(line_end,
                                                        str) else line_end
        self.end_length = end_length
        self.text = TextAnnotation(text) if isinstance(text, str) else text
        if self.line_end is None:
            if self.text is None:
                # default to a downward hook if there's no text
                self.line_end = LineEnd("down")
            else:
                # and no end cap if there is
                self.line_end = LineEnd("none")
Example #2
0
 def __init__(self,
              id: Any = 1,
              spread: Real = None,
              placement: Union[str, StaffPlacement] = "below",
              voice: int = 1,
              staff: int = None):
     StopNumberedSpanner.__init__(self, id)
     Direction.__init__(self, placement, voice, staff)
     self.spread = spread
Example #3
0
    def __init__(self,
                 id: Any = 1,
                 text: Union[str, TextAnnotation] = None,
                 placement: Union[str, StaffPlacement] = "above",
                 voice: int = 1,
                 staff: int = None):

        StopNumberedSpanner.__init__(self, id)
        Direction.__init__(self, placement, voice, staff)
        self.text = TextAnnotation(text) if isinstance(text, str) else text
Example #4
0
 def __init__(self,
              id: Any = 1,
              sign: bool = True,
              line: bool = True,
              placement: Union[str, StaffPlacement] = "below",
              voice: int = 1,
              staff: int = None):
     StartNumberedSpanner.__init__(self, id)
     Direction.__init__(self, placement, voice, staff)
     self.sign = sign
     self.line = line
Example #5
0
 def __init__(self,
              hairpin_type: Union[str, HairpinType],
              id: Any = 1,
              spread: Real = None,
              placement: Union[str, StaffPlacement] = "below",
              voice: int = 1,
              staff: int = None):
     StopNumberedSpanner.__init__(self, id)
     Direction.__init__(self, placement, voice, staff)
     self.hairpin_type = HairpinType(hairpin_type) if isinstance(
         hairpin_type, str) else hairpin_type
     self.spread = spread
Example #6
0
 def __init__(self,
              id: Any = 1,
              dash_length: Real = None,
              space_length: Real = None,
              text: Union[str, TextAnnotation] = None,
              placement: Union[str, StaffPlacement] = "above",
              voice: int = 1,
              staff: int = None):
     StartNumberedSpanner.__init__(self, id)
     Direction.__init__(self, placement, voice, staff)
     self.text = TextAnnotation(text) if isinstance(text, str) else text
     self.dash_length = dash_length
     self.space_length = space_length
Example #7
0
 def __init__(self,
              id: Any = 1,
              line_type: Union[str, LineType] = "dashed",
              line_end: Union[str, LineEnd] = None,
              end_length: Real = None,
              text: Union[str, TextAnnotation] = None,
              placement: Union[str, StaffPlacement] = "above",
              voice: int = 1,
              staff: int = None):
     StartNumberedSpanner.__init__(self, id)
     Direction.__init__(self, placement, voice, staff)
     self.line_type = LineType(line_type) if isinstance(line_type,
                                                        str) else line_type
     self.line_end = LineEnd(line_end) if isinstance(line_end,
                                                     str) else line_end
     self.end_length = end_length
     self.text = TextAnnotation(text) if isinstance(text, str) else text
     if self.line_end is None:
         if self.text is None:
             # default to a downward hook if there's no text
             self.line_end = LineEnd("down")
         else:
             # and no end cap if there is
             self.line_end = LineEnd("none")