Beispiel #1
0
 def __delitem__(self, i):
     r'''Container item deletion with optional time signature adjustment.
     '''
     old_time_signature = self.time_signature
     old_denominator = getattr(old_time_signature, 'denominator', None)
     FixedDurationContainer.__delitem__(self, i)
     self._conditionally_adjust_time_signature(old_denominator)
Beispiel #2
0
    def __setitem__(self, i, expr):
        r'''Container setitem logic with optional time signature adjustment.

        Measure setitem logic now adjusts time signatue automatically
        when ``adjust_time_signature_automatically`` is true.
        '''
        old_time_signature = self.time_signature
        old_denominator = getattr(old_time_signature, 'denominator', None)
        FixedDurationContainer.__setitem__(self, i, expr)
        self._conditionally_adjust_time_signature(old_denominator)
Beispiel #3
0
 def __init__(self, time_signature, music=None, **kwargs):
     from abjad.tools.scoretools import attach
     # set time signature adjustment indicator before 
     # contents initialization
     self._automatically_adjust_time_signature = False
     FixedDurationContainer.__init__(self, time_signature, music)
     self._always_format_time_signature = False
     self._measure_number = None
     time_signature = contexttools.TimeSignatureMark(time_signature)
     attach(time_signature, self)
     self._initialize_keyword_values(**kwargs)
Beispiel #4
0
 def _format_content_pieces(self):
     result = []
     # the class name test here functions to exclude scaleDurations 
     # from anonymous and dynamic measures
     # TODO: subclass this prooperly on anonymous and dynamic measures
     if self.has_non_power_of_two_denominator and type(self) is Measure:
         result.append("\t\\scaleDurations #'(%s . %s) {" % (
             self.implied_prolation.numerator,
             self.implied_prolation.denominator))
         result.extend( ['\t' + x 
             for x in FixedDurationContainer._format_content_pieces(self)])
         result.append('\t}')
     else:
         result.extend(FixedDurationContainer._format_content_pieces(self))
     return result