LilyPondTweakManager

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.lilypondnames" { graph [label="abjad.lilypondnames"]; node [color=1]; "abjad.lilypondnames.LilyPondNameManager.LilyPondNameManager" [URL="../api/abjad/lilypondnames/LilyPondNameManager.html#abjad.lilypondnames.LilyPondNameManager.LilyPondNameManager", label="Lily\nPond\nName\nManager", target=_top]; "abjad.lilypondnames.LilyPondTweakManager.LilyPondTweakManager" [URL="../api/abjad/lilypondnames/LilyPondTweakManager.html#abjad.lilypondnames.LilyPondTweakManager.LilyPondTweakManager", color=black, fontcolor=white, label="Lily\nPond\nTweak\nManager", target=_top]; "abjad.lilypondnames.LilyPondNameManager.LilyPondNameManager" -> "abjad.lilypondnames.LilyPondTweakManager.LilyPondTweakManager"; } 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.lilypondnames.LilyPondNameManager.LilyPondNameManager"; }

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 on argument.

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 on argument.

Return type:None