Example #1
0
    def __str__(self) -> str:
        r"""
        Gets string representation of staff change.

        ..  container:: example

            Default staff change:

            >>> staff_change = abjad.StaffChange()
            >>> print(str(staff_change))
            \change Staff = ##f

        ..  container:: example

            Explicit staff change:

            >>> lh_staff = abjad.Staff("s2", name='LHStaff')
            >>> staff_change = abjad.StaffChange(staff=lh_staff)
            >>> print(str(staff_change))
            \change Staff = LHStaff

        """
        if self.staff is None:
            return r"\change Staff = ##f"
        value = Scheme.format_scheme_value(self.staff.name)
        return rf"\change Staff = {value}"
Example #2
0
    def __str__(self) -> str:
        r"""
        Gets string representation of staff change.

        ..  container:: example

            Default staff change:

            >>> staff_change = abjad.StaffChange()
            >>> print(str(staff_change))
            \change Staff = ##f

        ..  container:: example

            Explicit staff change:

            >>> lh_staff = abjad.Staff("s2", name='LHStaff')
            >>> staff_change = abjad.StaffChange(staff=lh_staff)
            >>> print(str(staff_change))
            \change Staff = LHStaff

        """
        if self.staff is None:
            return r"\change Staff = ##f"
        value = Scheme.format_scheme_value(self.staff.name)
        return rf"\change Staff = {value}"
Example #3
0
 def _get_lilypond_format(self):
     text, equation = None, None
     if self.textual_indication is not None:
         text = self.textual_indication
         text = Scheme.format_scheme_value(text)
     if self.reference_duration is not None and self.units_per_minute is not None:
         equation = self._equation
     if self.custom_markup is not None:
         return rf"\tempo {self.custom_markup}"
     elif text and equation:
         return rf"\tempo {text} {equation}"
     elif equation:
         return rf"\tempo {equation}"
     elif text:
         return rf"\tempo {text}"
     else:
         return r"\tempo \default"