Wrapper

digraph InheritanceGraph { graph [bgcolor=transparent, color=lightsteelblue2, fontname=Arial, fontsize=10, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, splines=spline, style="dashed, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=10, height=0, penwidth=2, shape=box, style="filled, rounded", width=0]; edge [color=lightslategrey, penwidth=1]; subgraph "cluster_abjad.system" { graph [label="abjad.system"]; node [color=1]; "abjad.system.AbjadObject.AbjadObject" [URL="../api/abjad/system/AbjadObject.html#abjad.system.AbjadObject.AbjadObject", label="Abjad\nObject", target=_top]; "abjad.system.AbjadValueObject.AbjadValueObject" [URL="../api/abjad/system/AbjadValueObject.html#abjad.system.AbjadValueObject.AbjadValueObject", label="Abjad\nValue\nObject", target=_top]; "abjad.system.Wrapper.Wrapper" [URL="../api/abjad/system/Wrapper.html#abjad.system.Wrapper.Wrapper", color=black, fontcolor=white, label=Wrapper, target=_top]; "abjad.system.AbjadObject.AbjadObject" -> "abjad.system.AbjadValueObject.AbjadValueObject"; "abjad.system.AbjadValueObject.AbjadValueObject" -> "abjad.system.Wrapper.Wrapper"; } subgraph cluster_builtins { graph [label=builtins]; node [color=2]; "builtins.object" [URL="https://docs.python.org/3.6/library/functions.html#object", label=object, target=_top]; } "builtins.object" -> "abjad.system.AbjadObject.AbjadObject"; }

class abjad.system.Wrapper.Wrapper(alternate=None, annotation=None, component=None, context=None, deactivate=None, indicator=None, synthetic_offset=None, tag=None)

Wrapper.

>>> component = abjad.Note("c'4")
>>> articulation = abjad.Articulation('accent', direction=abjad.Up)
>>> abjad.attach(articulation, component)
>>> wrapper = abjad.inspect(component).wrapper()
>>> abjad.f(wrapper)
abjad.Wrapper(
    indicator=abjad.Articulation('accent', Up),
    tag=abjad.Tag(),
    )

Duplicate indicator warnings take two forms.

>>> voice_1 = abjad.Voice("c''4 d'' e'' f''", name='VoiceI')
>>> voice_2 = abjad.Voice("c'4 d' e' f'", name='VoiceII')
>>> abjad.attach(abjad.Clef('alto'), voice_2[0])
>>> staff = abjad.Staff([voice_1, voice_2], is_simultaneous=True)
>>> abjad.show(staff) 

First form when attempting to attach a contexted indicator to a leaf that already carries a contexted indicator of the same type:

>>> abjad.attach(abjad.Clef('treble'), voice_2[0])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/josiah/Source/github.com/Abjad/abjad/abjad/top/attach.py", line 308, in attach
    wrapper_._bind_to_component(component)
  File "/Users/josiah/Source/github.com/Abjad/abjad/abjad/system/Wrapper.py", line 327, in _bind_to_component
    self._warn_duplicate_indicator(component)
  File "/Users/josiah/Source/github.com/Abjad/abjad/abjad/system/Wrapper.py", line 505, in _warn_duplicate_indicator
    raise abjad.PersistentIndicatorError(message)
abjad.exceptions.PersistentIndicatorError: 

Can not attach ...

abjad.Clef('treble')

... to Note("c'4") in VoiceII because ...

abjad.Wrapper(
    context='Staff',
    indicator=abjad.Clef('alto'),
    tag=abjad.Tag(),
    )

... is already attached to the same leaf.

Second form when attempting to attach a contexted indicator to a leaf governed by some other component carrying a contexted indicator of the same type.

>>> abjad.attach(abjad.Clef('treble'), voice_1[0])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/josiah/Source/github.com/Abjad/abjad/abjad/top/attach.py", line 308, in attach
    wrapper_._bind_to_component(component)
  File "/Users/josiah/Source/github.com/Abjad/abjad/abjad/system/Wrapper.py", line 327, in _bind_to_component
    self._warn_duplicate_indicator(component)
  File "/Users/josiah/Source/github.com/Abjad/abjad/abjad/system/Wrapper.py", line 505, in _warn_duplicate_indicator
    raise abjad.PersistentIndicatorError(message)
abjad.exceptions.PersistentIndicatorError: 

Can not attach ...

abjad.Clef('treble')

... to Note("c''4") in VoiceI because ...

abjad.Wrapper(
    context='Staff',
    indicator=abjad.Clef('alto'),
    tag=abjad.Tag(),
    )

... is already attached to Note("c'4") in VoiceII.

Attributes Summary

__copy__ Copies indicator wrapper.
alternate Gets alternate tagging information.
annotation Gets indicator wrapper annotation.
component Gets start component of indicator wrapper.
context Gets context of indicator wrapper.
deactivate Is true when wrapper deactivates tag.
indicator Gets indicator of indicator wrapper.
start_offset Gets start offset of indicator wrapper.
synthetic_offset Gets synthetic offset of indicator wrapper.
tag Gets and sets tag.

Special methods

__copy__(*arguments)

Copies indicator wrapper.

Preserves annotation flag:

>>> old_staff = abjad.Staff("c'4 d'4 e'4 f'4")
>>> abjad.annotate(old_staff[0], 'bow_direction', abjad.Down)
>>> abjad.f(old_staff)
\new Staff
{
    c'4
    d'4
    e'4
    f'4
}
>>> leaf = old_staff[0]
>>> abjad.inspect(leaf).annotation('bow_direction')
Down
>>> new_staff = abjad.mutate(old_staff).copy()
>>> abjad.f(new_staff)
\new Staff
{
    c'4
    d'4
    e'4
    f'4
}
>>> leaf = new_staff[0]
>>> abjad.inspect(leaf).annotation('bow_direction')
Down

Preserves tag:

>>> old_staff = abjad.Staff("c'4 d'4 e'4 f'4")
>>> clef = abjad.Clef('alto')
>>> abjad.attach(clef, old_staff[0], tag='RED:M1')
>>> abjad.f(old_staff)
\new Staff
{
    \clef "alto" %! RED:M1
    c'4
    d'4
    e'4
    f'4
}
>>> leaf = old_staff[0]
>>> wrapper = abjad.inspect(leaf).wrapper()
>>> abjad.f(wrapper)
abjad.Wrapper(
    context='Staff',
    indicator=abjad.Clef('alto'),
    tag=abjad.Tag('RED:M1'),
    )
>>> new_staff = abjad.mutate(old_staff).copy()
>>> abjad.f(new_staff)
\new Staff
{
    \clef "alto" %! RED:M1
    c'4
    d'4
    e'4
    f'4
}
>>> leaf = new_staff[0]
>>> wrapper = abjad.inspect(leaf).wrapper()
>>> abjad.f(wrapper)
abjad.Wrapper(
    context='Staff',
    indicator=abjad.Clef('alto'),
    tag=abjad.Tag('RED:M1'),
    )

Preserves deactivate flag:

>>> old_staff = abjad.Staff("c'4 d'4 e'4 f'4")
>>> abjad.attach(
...     abjad.Clef('alto'),
...     old_staff[0],
...     deactivate=True,
...     tag='RED:M1',
...     )
>>> abjad.f(old_staff)
\new Staff
{
%@% \clef "alto"     %! RED:M1
    c'4
    d'4
    e'4
    f'4
}
>>> leaf = old_staff[0]
>>> wrapper = abjad.inspect(leaf).wrapper()
>>> abjad.f(wrapper)
abjad.Wrapper(
    context='Staff',
    deactivate=True,
    indicator=abjad.Clef('alto'),
    tag=abjad.Tag('RED:M1'),
    )
>>> new_staff = abjad.mutate(old_staff).copy()
>>> abjad.f(new_staff)
\new Staff
{
%@% \clef "alto"     %! RED:M1
    c'4
    d'4
    e'4
    f'4
}
>>> leaf = new_staff[0]
>>> wrapper = abjad.inspect(leaf).wrapper()
>>> abjad.f(wrapper)
abjad.Wrapper(
    context='Staff',
    deactivate=True,
    indicator=abjad.Clef('alto'),
    tag=abjad.Tag('RED:M1'),
    )

Copies all properties except component.

Copy operations must supply component after wrapper copy.

Returns new indicator wrapper.

Return type:Wrapper
(AbjadValueObject).__eq__(argument)

Is true when all initialization values of Abjad value object equal the initialization values of argument.

Returns true or false.

(AbjadObject).__format__(format_specification='')

Formats Abjad object.

Set format_specification to '' or 'storage'. Interprets '' equal to 'storage'.

Returns string.

(AbjadValueObject).__hash__()

Hashes Abjad value object.

Returns integer.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.


Read/write properties

deactivate

Is true when wrapper deactivates tag.

Return type:Optional[bool]
tag

Gets and sets tag.

Return type:Tag

Read-only properties

alternate

Gets alternate tagging information.

Set only by MetronomeMarkSpanner.attach(..., alternate=None) keyword.

Returns (color, tag) pair, or none.

Return type:Optional[Tuple[str, str]]
annotation

Gets indicator wrapper annotation.

>>> note = abjad.Note("c'4")
>>> articulation = abjad.Articulation('accent', direction=abjad.Up)
>>> abjad.attach(articulation, note)
>>> wrapper = abjad.inspect(note).wrapper()
>>> wrapper.annotation is None
True
>>> note = abjad.Note("c'4")
>>> articulation = abjad.Articulation('accent', direction=abjad.Up)
>>> abjad.annotate(note, 'foo', articulation)
>>> abjad.inspect(note).annotation('foo')
Articulation('accent', Up)
Return type:Optional[str]
component

Gets start component of indicator wrapper.

Returns component.

context

Gets context of indicator wrapper.

Return type:Optional[str]
indicator

Gets indicator of indicator wrapper.

Return type:Any
start_offset

Gets start offset of indicator wrapper.

This is either the wrapper’s synthetic offset or the start offset of the wrapper’s component.

Returns offset.

synthetic_offset

Gets synthetic offset of indicator wrapper.

Returns offset or none.