overrides¶
Classes
Base class from which grob, setting and tweak interfaces inherit. |
|
LilyPond grob override. |
|
LilyPond context setting. |
|
Override interface. |
|
LilyPond setting interface. |
- class abjad.overrides.Interface[source]¶
Base class from which grob, setting and tweak interfaces inherit.
Attributes Summary
Is true when
argument
is an interface with attribute pairs equal to those of this interface.Hashes interface.
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:
- 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
Return self==value.
Return self>=value.
Return self>value.
Return hash(self).
Return self<=value.
Return self<value.
Return repr(self).
format_leaf_children
Gets LilyPond grob override override format pieces.
Gets LilyPond grob override override string.
Gets LilyPond grob override revert format pieces.
Gets LilyPond grob override revert 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.
- 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:
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
Return self==value.
Return self>=value.
Return self>value.
Return hash(self).
Return self<=value.
Return self<value.
Return repr(self).
format_leaf_children
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.
- 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
Gets Interface (or OverrideInterface) keyed to
name
.Sets attribute
attribute
of override interface tovalue
.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:
- __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.
-
(
- class abjad.overrides.SettingInterface[source]¶
LilyPond setting interface.
>>> note = abjad.Note("c'4") >>> abjad.setting(note) SettingInterface()
Attributes Summary
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:
- __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"'
-
(
Functions
Makes LilyPond grob override interface. |
|
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"'))