Example #1
0
 def _report_format_contributors(self):
     format_contributions = formattools.get_all_format_contributions(self)
     report = ''
     report += 'slot 1:\n'
     report += self._process_contribution_packet(
         self._format_before_slot(format_contributions))
     report += 'slot 3:\n'
     report += self._process_contribution_packet(
         self._format_opening_slot(format_contributions))
     report += 'slot 4:\n'
     report += '\tleaf body:\n'
     report += '\t\t' + self._format_contents_slot(
         format_contributions)[0][1][0] + '\n'
     report += 'slot 5:\n'
     report += self._process_contribution_packet(
         self._format_closing_slot(format_contributions))
     report += 'slot 7:\n'
     report += self._process_contribution_packet(
         self._format_after_slot(format_contributions))
     return report
    def report_modifications(self):
        r'''Reports modifications of component.

        ..  container:: example

            **Example.** Report modifications of container in selection:

            ::

                >>> container = Container("c'8 d'8 e'8 f'8")
                >>> container.override.note_head.color = 'red'
                >>> container.override.note_head.style = 'harmonic'
                >>> show(container) # doctest: +SKIP

            ..  doctest::

                >>> f(container)
                {
                    \override NoteHead #'color = #red
                    \override NoteHead #'style = #'harmonic
                    c'8
                    d'8
                    e'8
                    f'8
                    \revert NoteHead #'color
                    \revert NoteHead #'style
                }

            ::

                >>> report = inspect(container).report_modifications()

            ::

                >>> print report
                {
                    \override NoteHead #'color = #red
                    \override NoteHead #'style = #'harmonic
                    %%% 4 components omitted %%%
                    \revert NoteHead #'color
                    \revert NoteHead #'style
                }

        Returns string.
        '''
        from abjad.tools import containertools
        from abjad.tools import formattools
        component = self._component
        format_contributions = formattools.get_all_format_contributions(
            component)
        result = []
        result.extend(component._get_format_contributions_for_slot(
            'before', format_contributions))
        result.extend(component._get_format_contributions_for_slot(
            'open brackets', format_contributions))
        result.extend(component._get_format_contributions_for_slot(
            'opening', format_contributions))
        result.append('\t%%%%%% %s components omitted %%%%%%' % len(component))
        result.extend(component._get_format_contributions_for_slot(
            'closing', format_contributions))
        result.extend(component._get_format_contributions_for_slot(
            'close brackets', format_contributions))
        result.extend(component._get_format_contributions_for_slot(
            'after', format_contributions))
        result = '\n'.join(result)
        return result