overrides

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.overrides" { graph [label="abjad.overrides"]; node [color=1]; "abjad.overrides.Interface" [URL="../api/abjad/overrides.html#abjad.overrides.Interface", color=black, fontcolor=white, label=Interface, target=_top]; "abjad.overrides.OverrideInterface" [URL="../api/abjad/overrides.html#abjad.overrides.OverrideInterface", color=black, fontcolor=white, label="Override\nInterface", target=_top]; "abjad.overrides.Interface" -> "abjad.overrides.OverrideInterface" [minlen=1]; "abjad.overrides.SettingInterface" [URL="../api/abjad/overrides.html#abjad.overrides.SettingInterface", color=black, fontcolor=white, label="Setting\nInterface", target=_top]; "abjad.overrides.Interface" -> "abjad.overrides.SettingInterface" [minlen=2]; "abjad.overrides.LilyPondOverride" [URL="../api/abjad/overrides.html#abjad.overrides.LilyPondOverride", color=black, fontcolor=white, label="Lily\nPond\nOverride", target=_top]; "abjad.overrides.LilyPondSetting" [URL="../api/abjad/overrides.html#abjad.overrides.LilyPondSetting", color=black, fontcolor=white, label="Lily\nPond\nSetting", target=_top]; } subgraph cluster_builtins { graph [label=builtins]; node [color=2]; "builtins.object" [URL="https://docs.python.org/3.10/library/functions.html#object", label=object, target=_top]; } "builtins.object" -> "abjad.overrides.Interface"; "builtins.object" -> "abjad.overrides.LilyPondOverride" [minlen=1]; "builtins.object" -> "abjad.overrides.LilyPondSetting" [minlen=2]; }


Classes

Interface

Base class from which grob, setting and tweak interfaces inherit.

LilyPondOverride

LilyPond grob override.

LilyPondSetting

LilyPond context setting.

OverrideInterface

Override interface.

SettingInterface

LilyPond setting interface.

class abjad.overrides.Interface[source]

Base class from which grob, setting and tweak interfaces inherit.


Attributes Summary

__eq__

Is true when argument is an interface with attribute pairs equal to those of this interface.

__hash__

Hashes interface.

__repr__

Gets repr.


Special methods

overridden __eq__(argument)[source]

Is true when argument is an interface with attribute pairs equal to those of this interface.

>>> note_1 = abjad.Note("c'4")
>>> abjad.setting(note_1).Voice.auto_beaming = False
>>> abjad.setting(note_1).Staff.tupletFullLength = True
>>> note_2 = abjad.Note("c'4")
>>> abjad.setting(note_2).Voice.auto_beaming = False
>>> abjad.setting(note_2).Staff.tupletFullLength = True
>>> note_3 = abjad.Note("c'4")
>>> abjad.setting(note_3).Voice.auto_beaming = True
>>> setting_1 = abjad.setting(note_1)
>>> setting_2 = abjad.setting(note_2)
>>> setting_3 = abjad.setting(note_3)
>>> setting_1 == setting_1
True
>>> setting_1 == setting_2
True
>>> setting_1 == setting_3
False
>>> setting_2 == setting_1
True
>>> setting_2 == setting_2
True
>>> setting_2 == setting_3
False
>>> setting_3 == setting_1
False
>>> setting_3 == setting_2
False
>>> setting_3 == setting_3
True
>>> note_1 = abjad.Note("c'4")
>>> abjad.override(note_1).NoteHead.color = "#red"
>>> abjad.override(note_1).Stem.color = "#red"
>>> note_2 = abjad.Note("c'4")
>>> abjad.override(note_2).NoteHead.color = "#red"
>>> abjad.override(note_2).Stem.color = "#red"
>>> note_3 = abjad.Note("c'4")
>>> abjad.override(note_3).NoteHead.color = "#red"
>>> override_1 = abjad.override(note_1)
>>> override_2 = abjad.override(note_2)
>>> override_3 = abjad.override(note_3)
>>> override_1 == override_1
True
>>> override_1 == override_2
True
>>> override_1 == override_3
False
>>> override_2 == override_1
True
>>> override_2 == override_2
True
>>> override_2 == override_3
False
>>> override_3 == override_1
False
>>> override_3 == override_2
False
>>> override_3 == override_3
True
Return type:

bool

overridden __hash__()[source]

Hashes interface.

Return type:

int

overridden __repr__()[source]

Gets repr.

Return type:

str

class abjad.overrides.LilyPondOverride(lilypond_type=None, grob_name='NoteHead', once=False, is_revert=False, property_path='color', value='#red')[source]

LilyPond grob override.

>>> override = abjad.LilyPondOverride(
...     lilypond_type="Staff",
...     grob_name="TextSpanner",
...     once=True,
...     property_path=(
...         "bound-details",
...         "left",
...         "text",
...     ),
...     value=r"\markup \bold { over pressure }",
... )
>>> print(override.override_string)
\once \override Staff.TextSpanner.bound-details.left.text = \markup \bold { over pressure }
>>> override = abjad.LilyPondOverride(
...     lilypond_type="Staff",
...     grob_name="TextSpanner",
...     once=True,
...     property_path="bound_details__left__text",
...     value=r"\markup \bold { over pressure }",
... )
>>> print(override.override_string)
\once \override Staff.TextSpanner.bound-details.left.text = \markup \bold { over pressure }

Attributes Summary

__eq__

Return self==value.

__ge__

Return self>=value.

__gt__

Return self>value.

__hash__

Return hash(self).

__le__

Return self<=value.

__lt__

Return self<value.

__post_init__

__repr__

Return repr(self).

format_leaf_children

override_format_pieces

Gets LilyPond grob override override format pieces.

override_string

Gets LilyPond grob override override string.

revert_format_pieces

Gets LilyPond grob override revert format pieces.

revert_string

Gets LilyPond grob override revert string.

tweak_string

Gets LilyPond grob override tweak string.


Special methods

overridden __eq__(other)

Return self==value.

overridden __ge__(other)

Return self>=value.

overridden __gt__(other)

Return self>value.

overridden __hash__()

Return hash(self).

overridden __le__(other)

Return self<=value.

overridden __lt__(other)

Return self<value.

__post_init__()[source]
overridden __repr__()

Return repr(self).


Methods

tweak_string(directed=True, grob=False)[source]

Gets LilyPond grob override tweak string.

>>> override = abjad.LilyPondOverride(
...     grob_name="Glissando",
...     property_path="style",
...     value="#'zigzag",
... )
>>> override.tweak_string()
"- \\tweak style #'zigzag"
>>> override = abjad.LilyPondOverride(
...     grob_name="RehearsalMark",
...     property_path="color",
...     value="#red",
... )
>>> override.tweak_string(directed=False)
'\\tweak color #red'
Return type:

str


Read-only properties

override_format_pieces

Gets LilyPond grob override override format pieces.

>>> override = abjad.LilyPondOverride(
...     lilypond_type="Staff",
...     grob_name="TextSpanner",
...     once=True,
...     property_path=(
...         "bound-details",
...         "left",
...         "text",
...     ),
...     value=r"\markup \bold { over pressure }",
... )
>>> for line in override.override_format_pieces:
...     line
... 
'\\once \\override Staff.TextSpanner.bound-details.left.text = \\markup \\bold { over pressure }'
override_string

Gets LilyPond grob override override string.

>>> override = abjad.LilyPondOverride(
...     grob_name="Glissando",
...     property_path="style",
...     value="#'zigzag",
... )
>>> override.override_string
"\\override Glissando.style = #'zigzag"
revert_format_pieces

Gets LilyPond grob override revert format pieces.

>>> override = abjad.LilyPondOverride(
...     grob_name="Glissando",
...     property_path="style",
...     value="#'zigzag",
... )
>>> override.revert_format_pieces
('\\revert Glissando.style',)
revert_string

Gets LilyPond grob override revert string.

>>> override = abjad.LilyPondOverride(
...     grob_name="Glissando",
...     property_path="style",
...     value="#'zigzag",
... )
>>> override.revert_string
'\\revert Glissando.style'
class abjad.overrides.LilyPondSetting(lilypond_type=None, context_property='autoBeaming', is_unset=False, value=False)[source]

LilyPond context setting.

>>> context_setting = abjad.LilyPondSetting(
...     lilypond_type="Score",
...     context_property="autoBeaming",
...     value="##f",
... )
>>> print("\n".join(context_setting.format_pieces))
\set Score.autoBeaming = ##f

Attributes Summary

__eq__

Return self==value.

__ge__

Return self>=value.

__gt__

Return self>value.

__hash__

Return hash(self).

__le__

Return self<=value.

__lt__

Return self<value.

__post_init__

__repr__

Return repr(self).

format_leaf_children

format_pieces

Gets LilyPond context setting \set or \unset format pieces.


Special methods

overridden __eq__(other)

Return self==value.

overridden __ge__(other)

Return self>=value.

overridden __gt__(other)

Return self>value.

overridden __hash__()

Return hash(self).

overridden __le__(other)

Return self<=value.

overridden __lt__(other)

Return self<value.

__post_init__()[source]
overridden __repr__()

Return repr(self).


Read-only properties

format_pieces

Gets LilyPond context setting \set or \unset format pieces.

class abjad.overrides.OverrideInterface[source]

Override interface.

Override interfaces are created by the abjad.override() factory function:

>>> note = abjad.Note("c'4")
>>> abjad.override(note)
OverrideInterface()

Attributes Summary

__getattr__

Gets Interface (or OverrideInterface) keyed to name.

__setattr__

Sets attribute attribute of override interface to value.


Special methods

(Interface).__eq__(argument)

Is true when argument is an interface with attribute pairs equal to those of this interface.

>>> note_1 = abjad.Note("c'4")
>>> abjad.setting(note_1).Voice.auto_beaming = False
>>> abjad.setting(note_1).Staff.tupletFullLength = True
>>> note_2 = abjad.Note("c'4")
>>> abjad.setting(note_2).Voice.auto_beaming = False
>>> abjad.setting(note_2).Staff.tupletFullLength = True
>>> note_3 = abjad.Note("c'4")
>>> abjad.setting(note_3).Voice.auto_beaming = True
>>> setting_1 = abjad.setting(note_1)
>>> setting_2 = abjad.setting(note_2)
>>> setting_3 = abjad.setting(note_3)
>>> setting_1 == setting_1
True
>>> setting_1 == setting_2
True
>>> setting_1 == setting_3
False
>>> setting_2 == setting_1
True
>>> setting_2 == setting_2
True
>>> setting_2 == setting_3
False
>>> setting_3 == setting_1
False
>>> setting_3 == setting_2
False
>>> setting_3 == setting_3
True
>>> note_1 = abjad.Note("c'4")
>>> abjad.override(note_1).NoteHead.color = "#red"
>>> abjad.override(note_1).Stem.color = "#red"
>>> note_2 = abjad.Note("c'4")
>>> abjad.override(note_2).NoteHead.color = "#red"
>>> abjad.override(note_2).Stem.color = "#red"
>>> note_3 = abjad.Note("c'4")
>>> abjad.override(note_3).NoteHead.color = "#red"
>>> override_1 = abjad.override(note_1)
>>> override_2 = abjad.override(note_2)
>>> override_3 = abjad.override(note_3)
>>> override_1 == override_1
True
>>> override_1 == override_2
True
>>> override_1 == override_3
False
>>> override_2 == override_1
True
>>> override_2 == override_2
True
>>> override_2 == override_3
False
>>> override_3 == override_1
False
>>> override_3 == override_2
False
>>> override_3 == override_3
True
Return type:

bool

__getattr__(name)[source]

Gets Interface (or OverrideInterface) keyed to name.

Somewhat confusingly, getting a grob name returns an interface:

>>> staff = abjad.Staff("c'4 d' e' f'")
>>> abjad.override(staff[0]).NoteHead
Interface()

While getting a context name returns an override interface:

>>> staff = abjad.Staff("c'4 d' e' f'")
>>> abjad.override(staff[0]).Staff
OverrideInterface()

Which can then be deferenced to get an interface:

>>> staff = abjad.Staff("c'4 d' e' f'")
>>> abjad.override(staff[0]).Staff.NoteHead
Interface()

Note that the dot-chained user syntax is unproblematic. But the class of each interface returned in the chain is likely to be surprising at first encounter.

(Interface).__hash__()

Hashes interface.

Return type:

int

(Interface).__repr__()

Gets repr.

Return type:

str

overridden __setattr__(attribute, value)[source]

Sets attribute attribute of override interface to value.

class abjad.overrides.SettingInterface[source]

LilyPond setting interface.

>>> note = abjad.Note("c'4")
>>> abjad.setting(note)
SettingInterface()

Attributes Summary

__getattr__

Gets arbitrary object keyed to name.


Special methods

(Interface).__eq__(argument)

Is true when argument is an interface with attribute pairs equal to those of this interface.

>>> note_1 = abjad.Note("c'4")
>>> abjad.setting(note_1).Voice.auto_beaming = False
>>> abjad.setting(note_1).Staff.tupletFullLength = True
>>> note_2 = abjad.Note("c'4")
>>> abjad.setting(note_2).Voice.auto_beaming = False
>>> abjad.setting(note_2).Staff.tupletFullLength = True
>>> note_3 = abjad.Note("c'4")
>>> abjad.setting(note_3).Voice.auto_beaming = True
>>> setting_1 = abjad.setting(note_1)
>>> setting_2 = abjad.setting(note_2)
>>> setting_3 = abjad.setting(note_3)
>>> setting_1 == setting_1
True
>>> setting_1 == setting_2
True
>>> setting_1 == setting_3
False
>>> setting_2 == setting_1
True
>>> setting_2 == setting_2
True
>>> setting_2 == setting_3
False
>>> setting_3 == setting_1
False
>>> setting_3 == setting_2
False
>>> setting_3 == setting_3
True
>>> note_1 = abjad.Note("c'4")
>>> abjad.override(note_1).NoteHead.color = "#red"
>>> abjad.override(note_1).Stem.color = "#red"
>>> note_2 = abjad.Note("c'4")
>>> abjad.override(note_2).NoteHead.color = "#red"
>>> abjad.override(note_2).Stem.color = "#red"
>>> note_3 = abjad.Note("c'4")
>>> abjad.override(note_3).NoteHead.color = "#red"
>>> override_1 = abjad.override(note_1)
>>> override_2 = abjad.override(note_2)
>>> override_3 = abjad.override(note_3)
>>> override_1 == override_1
True
>>> override_1 == override_2
True
>>> override_1 == override_3
False
>>> override_2 == override_1
True
>>> override_2 == override_2
True
>>> override_2 == override_3
False
>>> override_3 == override_1
False
>>> override_3 == override_2
False
>>> override_3 == override_3
True
Return type:

bool

__getattr__(name)[source]

Gets arbitrary object keyed to name.

>>> staff = abjad.Staff("c'4 d' e' f'")
>>> string = r'\markup "Vn. I"'
>>> abjad.setting(staff).instrumentName = string
>>> abjad.show(staff)  

Returns arbitrary object keyed to name:

>>> abjad.setting(staff).instrumentName
'\\markup "Vn. I"'
(Interface).__hash__()

Hashes interface.

Return type:

int

(Interface).__repr__()

Gets repr.

Return type:

str


Functions

override

Makes LilyPond grob override interface.

setting

Makes LilyPond setting name interface.

abjad.overrides.override(argument)[source]

Makes LilyPond grob override interface.

Overrides staff symbol color:

>>> staff = abjad.Staff("c'4 e'4 d'4 f'4")
>>> abjad.override(staff).StaffSymbol.color = "#red"
>>> abjad.show(staff)  

Specify grob context like this:

>>> staff = abjad.Staff("c'4 e'4 d'4 f'4")
>>> abjad.override(staff[0]).Staff.StaffSymbol.color = "#blue"
>>> abjad.show(staff)  

Returns LilyPond grob override interface.

>>> staff = abjad.Staff("c'4 e' d' f'")
>>> abjad.override(staff)
OverrideInterface()
abjad.overrides.setting(argument)[source]

Makes LilyPond setting name interface.

Sets instrument name:

>>> staff = abjad.Staff("c'4 e'4 d'4 f'4")
>>> string = r'\markup "Vn. I"'
>>> abjad.setting(staff).instrumentName = string
>>> abjad.show(staff)  

Returns LilyPond setting name interface:

>>> abjad.setting(staff)
SettingInterface(('instrumentName', '\\markup "Vn. I"'))