ContextBlock

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.lilypondfile" { graph [label="abjad.lilypondfile"]; node [color=1]; "abjad.lilypondfile.Block.Block" [URL="../api/abjad/lilypondfile/Block.html#abjad.lilypondfile.Block.Block", label=Block, target=_top]; "abjad.lilypondfile.ContextBlock.ContextBlock" [URL="../api/abjad/lilypondfile/ContextBlock.html#abjad.lilypondfile.ContextBlock.ContextBlock", color=black, fontcolor=white, label="Context\nBlock", target=_top]; "abjad.lilypondfile.Block.Block" -> "abjad.lilypondfile.ContextBlock.ContextBlock"; } subgraph "cluster_abjad.system" { graph [label="abjad.system"]; node [color=2]; "abjad.system.AbjadObject.AbjadObject" [URL="../api/abjad/lilypondfile/../system/AbjadObject.html#abjad.system.AbjadObject.AbjadObject", label="Abjad\nObject", target=_top]; } subgraph cluster_builtins { graph [label=builtins]; node [color=3]; "builtins.object" [URL="https://docs.python.org/3.6/library/functions.html#object", label=object, target=_top]; } "abjad.system.AbjadObject.AbjadObject" -> "abjad.lilypondfile.Block.Block"; "builtins.object" -> "abjad.system.AbjadObject.AbjadObject"; }

class abjad.lilypondfile.ContextBlock.ContextBlock(source_lilypond_type=None, name=None, type_=None, alias=None)

A LilyPond file \context block.

>>> block = abjad.ContextBlock(
...     source_lilypond_type='Staff',
...     name='FluteStaff',
...     type_='Engraver_group',
...     alias='Staff',
...     )
>>> block.remove_commands.append('Forbid_line_break_engraver')
>>> block.consists_commands.append('Horizontal_bracket_engraver')
>>> block.accepts_commands.append('FluteUpperVoice')
>>> block.accepts_commands.append('FluteLowerVoice')
>>> block.items.append(r'\accidentalStyle dodecaphonic')
>>> abjad.override(block).beam.positions = (-4, -4)
>>> abjad.override(block).stem.stem_end_position = -6
>>> abjad.setting(block).auto_beaming = False
>>> abjad.setting(block).tuplet_full_length = True
>>> block
<ContextBlock(source_lilypond_type='Staff', name='FluteStaff', type_='Engraver_group', alias='Staff')>
>>> print(format(block))
\context {
    \Staff
    \name FluteStaff
    \type Engraver_group
    \alias Staff
    \remove Forbid_line_break_engraver
    \consists Horizontal_bracket_engraver
    \accepts FluteUpperVoice
    \accepts FluteLowerVoice
    \override Beam.positions = #'(-4 . -4)
    \override Stem.stem-end-position = #-6
    autoBeaming = ##f
    tupletFullLength = ##t
    \accidentalStyle dodecaphonic
}

Attributes Summary

accepts_commands Gets arguments of LilyPond \accepts commands.
alias Gets and sets argument of LilyPond \alias command.
consists_commands Gets arguments of LilyPond \consists commands.
items Gets items in context block.
name Gets and sets argument of LilyPond \name command.
remove_commands Gets arguments of LilyPond \remove commands.
source_lilypond_type Gets and sets source context name.
type_ Gets and sets argument of LilyPond \type command.

Special methods

(Block).__delattr__(name)

Deletes block attribute with name.

>>> header_block = abjad.Block(name='header')
>>> header_block.tagline = False
>>> header_block.tagline
False
>>> delattr(header_block, 'tagline')
>>> hasattr(header_block, 'tagline')
False
Return type:None
(Block).__format__(format_specification='')

Formats block.

Returns string.

(Block).__getitem__(name)

Gets item with name.

Gets score with name 'Red Example Score' in score block:

>>> block = abjad.Block(name='score')
>>> score = abjad.Score(name='Red Example Score')
>>> block.items.append(score)
>>> block['Red Example Score']
Score(is_simultaneous=True, name='Red Example Score')

Returns item.

Raises key error when no item with name is found.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.

(Block).__setattr__(name, value)

Sets block name to value.

Returns none.


Methods

(Block).empty()

Is true when block contains no items and has no user attributes.

Returns true or false.


Read-only properties

accepts_commands

Gets arguments of LilyPond \accepts commands.

>>> block = abjad.ContextBlock(
...     source_lilypond_type='Staff',
...     name='FluteStaff',
...     type_='Engraver_group',
...     alias='Staff',
...     )
>>> block.remove_commands.append('Forbid_line_break_engraver')
>>> block.consists_commands.append('Horizontal_bracket_engraver')
>>> block.accepts_commands.append('FluteUpperVoice')
>>> block.accepts_commands.append('FluteLowerVoice')
>>> block.items.append(r'\accidentalStyle dodecaphonic')
>>> abjad.override(block).beam.positions = (-4, -4)
>>> abjad.override(block).stem.stem_end_position = -6
>>> abjad.setting(block).auto_beaming = False
>>> abjad.setting(block).tuplet_full_length = True
>>> block.accepts_commands
['FluteUpperVoice', 'FluteLowerVoice']

Returns list.

alias

Gets and sets argument of LilyPond \alias command.

>>> block = abjad.ContextBlock(
...     source_lilypond_type='Staff',
...     name='FluteStaff',
...     type_='Engraver_group',
...     alias='Staff',
...     )
>>> block.remove_commands.append('Forbid_line_break_engraver')
>>> block.consists_commands.append('Horizontal_bracket_engraver')
>>> block.accepts_commands.append('FluteUpperVoice')
>>> block.accepts_commands.append('FluteLowerVoice')
>>> block.items.append(r'\accidentalStyle dodecaphonic')
>>> abjad.override(block).beam.positions = (-4, -4)
>>> abjad.override(block).stem.stem_end_position = -6
>>> abjad.setting(block).auto_beaming = False
>>> abjad.setting(block).tuplet_full_length = True
>>> block.alias
'Staff'

Returns string or none.

consists_commands

Gets arguments of LilyPond \consists commands.

>>> block = abjad.ContextBlock(
...     source_lilypond_type='Staff',
...     name='FluteStaff',
...     type_='Engraver_group',
...     alias='Staff',
...     )
>>> block.remove_commands.append('Forbid_line_break_engraver')
>>> block.consists_commands.append('Horizontal_bracket_engraver')
>>> block.accepts_commands.append('FluteUpperVoice')
>>> block.accepts_commands.append('FluteLowerVoice')
>>> block.items.append(r'\accidentalStyle dodecaphonic')
>>> abjad.override(block).beam.positions = (-4, -4)
>>> abjad.override(block).stem.stem_end_position = -6
>>> abjad.setting(block).auto_beaming = False
>>> abjad.setting(block).tuplet_full_length = True
>>> block.consists_commands
['Horizontal_bracket_engraver']

Returns list.

items

Gets items in context block.

>>> block = abjad.ContextBlock(
...     source_lilypond_type='Staff',
...     name='FluteStaff',
...     type_='Engraver_group',
...     alias='Staff',
...     )
>>> block.remove_commands.append('Forbid_line_break_engraver')
>>> block.consists_commands.append('Horizontal_bracket_engraver')
>>> block.accepts_commands.append('FluteUpperVoice')
>>> block.accepts_commands.append('FluteLowerVoice')
>>> block.items.append(r'\accidentalStyle dodecaphonic')
>>> abjad.override(block).beam.positions = (-4, -4)
>>> abjad.override(block).stem.stem_end_position = -6
>>> abjad.setting(block).auto_beaming = False
>>> abjad.setting(block).tuplet_full_length = True
>>> block.items
['\\accidentalStyle dodecaphonic']

Returns list.

name

Gets and sets argument of LilyPond \name command.

>>> block = abjad.ContextBlock(
...     source_lilypond_type='Staff',
...     name='FluteStaff',
...     type_='Engraver_group',
...     alias='Staff',
...     )
>>> block.remove_commands.append('Forbid_line_break_engraver')
>>> block.consists_commands.append('Horizontal_bracket_engraver')
>>> block.accepts_commands.append('FluteUpperVoice')
>>> block.accepts_commands.append('FluteLowerVoice')
>>> block.items.append(r'\accidentalStyle dodecaphonic')
>>> abjad.override(block).beam.positions = (-4, -4)
>>> abjad.override(block).stem.stem_end_position = -6
>>> abjad.setting(block).auto_beaming = False
>>> abjad.setting(block).tuplet_full_length = True
>>> block.name
'FluteStaff'

Returns string or none.

remove_commands

Gets arguments of LilyPond \remove commands.

>>> block = abjad.ContextBlock(
...     source_lilypond_type='Staff',
...     name='FluteStaff',
...     type_='Engraver_group',
...     alias='Staff',
...     )
>>> block.remove_commands.append('Forbid_line_break_engraver')
>>> block.consists_commands.append('Horizontal_bracket_engraver')
>>> block.accepts_commands.append('FluteUpperVoice')
>>> block.accepts_commands.append('FluteLowerVoice')
>>> block.items.append(r'\accidentalStyle dodecaphonic')
>>> abjad.override(block).beam.positions = (-4, -4)
>>> abjad.override(block).stem.stem_end_position = -6
>>> abjad.setting(block).auto_beaming = False
>>> abjad.setting(block).tuplet_full_length = True
>>> block.remove_commands
['Forbid_line_break_engraver']

Returns list.

source_lilypond_type

Gets and sets source context name.

>>> block = abjad.ContextBlock(
...     source_lilypond_type='Staff',
...     name='FluteStaff',
...     type_='Engraver_group',
...     alias='Staff',
...     )
>>> block.remove_commands.append('Forbid_line_break_engraver')
>>> block.consists_commands.append('Horizontal_bracket_engraver')
>>> block.accepts_commands.append('FluteUpperVoice')
>>> block.accepts_commands.append('FluteLowerVoice')
>>> block.items.append(r'\accidentalStyle dodecaphonic')
>>> abjad.override(block).beam.positions = (-4, -4)
>>> abjad.override(block).stem.stem_end_position = -6
>>> abjad.setting(block).auto_beaming = False
>>> abjad.setting(block).tuplet_full_length = True
>>> block.source_lilypond_type
'Staff'

Returns string or none.

type_

Gets and sets argument of LilyPond \type command.

>>> block = abjad.ContextBlock(
...     source_lilypond_type='Staff',
...     name='FluteStaff',
...     type_='Engraver_group',
...     alias='Staff',
...     )
>>> block.remove_commands.append('Forbid_line_break_engraver')
>>> block.consists_commands.append('Horizontal_bracket_engraver')
>>> block.accepts_commands.append('FluteUpperVoice')
>>> block.accepts_commands.append('FluteLowerVoice')
>>> block.items.append(r'\accidentalStyle dodecaphonic')
>>> abjad.override(block).beam.positions = (-4, -4)
>>> abjad.override(block).stem.stem_end_position = -6
>>> abjad.setting(block).auto_beaming = False
>>> abjad.setting(block).tuplet_full_length = True
>>> block.type_
'Engraver_group'

Returns string or none.