LilyPondTweakManager¶
-
class
abjad.lilypondnames.LilyPondTweakManager.
LilyPondTweakManager
¶ LilyPond tweak manager.
Tweak managers are created by the
abjad.tweak()
factory function:>>> beam = abjad.Beam() >>> abjad.tweak(beam) LilyPondTweakManager()
Set an attribute like this:
>>> abjad.tweak(beam).color = 'red'
The state of the tweak manager has changed:
>>> abjad.tweak(beam) LilyPondTweakManager(('color', 'red'))
And the value of the attribute just set is available like this:
>>> abjad.tweak(beam).color 'red'
Trying to get an attribute that has not yet been set raises an attribute error:
>>> abjad.tweak(beam).foo Traceback (most recent call last): File "/Users/josiah/Source/github.com/Abjad/abjad/abjad/lilypondnames/LilyPondTweakManager.py", line 138, in __getattr__ return vars(self)[name] KeyError: 'foo' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/josiah/Source/github.com/Abjad/abjad/abjad/lilypondnames/LilyPondTweakManager.py", line 142, in __getattr__ raise AttributeError(message) AttributeError: LilyPondTweakManager object has no attribute 'foo'.
Attributes Summary
__getattr__
Gets LilyPondNameManager (or LilyPondGrobNameManager) keyed to name
.set_tweaks
Sets tweaks
onargument
.Special methods
-
(
LilyPondNameManager
).__eq__
(argument)¶ Is true when
argument
is a LilyPond name manager with attribute pairs equal to those of this LilyPond name manager.Return type: bool
-
__getattr__
(name)¶ Gets LilyPondNameManager (or LilyPondGrobNameManager) keyed to
name
.Getting a grob name returns a LilyPondNameManager:
>>> hairpin = abjad.Hairpin('p < f') >>> abjad.tweak(hairpin).dynamic_line_spanner LilyPondNameManager()
Set a tweak with explicit grob like this:
>>> abjad.tweak(hairpin).dynamic_line_spanner.staff_padding = 5
This changes tweak manager state:
>>> abjad.tweak(hairpin) LilyPondTweakManager(('dynamic_line_spanner', LilyPondNameManager(('staff_padding', 5))))
Grob is available like this:
>>> abjad.tweak(hairpin).dynamic_line_spanner LilyPondNameManager(('staff_padding', 5))
Attribute is available like this:
>>> abjad.tweak(hairpin).dynamic_line_spanner.staff_padding 5
Grob-explicit tweak appears like this:
>>> staff = abjad.Staff("c'4 d' e' f'") >>> abjad.attach(hairpin, staff[:]) >>> abjad.show(staff)
Tweak expressions work like this:
>>> abjad.tweak('red').color LilyPondTweakManager(('color', 'red'))
>>> abjad.tweak(6).Y_offset LilyPondTweakManager(('Y_offset', 6))
>>> abjad.tweak(False).bound_details__left_broken__text LilyPondTweakManager(('bound_details__left_broken__text', False))
Return type: Union
[LilyPondNameManager
,Any
]
-
(
LilyPondNameManager
).__hash__
()¶ Hashes LilyPond name manager.
Redefined in tandem with __eq__.
Return type: int
-
(
LilyPondNameManager
).__repr__
()¶ Gets interpreter representation of LilyPond name manager.
Return type: str
Class & static methods
-
static
set_tweaks
(argument, tweaks)¶ Sets
tweaks
onargument
.Return type: None
-