QGridContainer

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.rhythmtrees" { graph [label="abjad.rhythmtrees"]; node [color=1]; "abjad.rhythmtrees.RhythmTreeContainer" [URL="../api/abjadext/nauert/../../abjad/rhythmtrees.html#abjad.rhythmtrees.RhythmTreeContainer", label="Rhythm\nTree\nContainer", target=_top]; "abjad.rhythmtrees.RhythmTreeMixin" [URL="../api/abjadext/nauert/../../abjad/rhythmtrees.html#abjad.rhythmtrees.RhythmTreeMixin", label="Rhythm\nTree\nMixin", shape=oval, style=bold, target=_top]; "abjad.rhythmtrees.RhythmTreeMixin" -> "abjad.rhythmtrees.RhythmTreeContainer"; } subgraph "cluster_abjad.system" { graph [label="abjad.system"]; node [color=2]; "abjad.system.AbjadObject.AbjadObject" [URL="../api/abjadext/nauert/../../abjad/system/AbjadObject.html#abjad.system.AbjadObject.AbjadObject", label="Abjad\nObject", target=_top]; } subgraph "cluster_abjadext.nauert" { graph [label="abjadext.nauert"]; node [color=3]; "abjadext.nauert.QGridContainer.QGridContainer" [URL="../api/abjadext/nauert/QGridContainer.html#abjadext.nauert.QGridContainer.QGridContainer", color=black, fontcolor=white, label="QGrid\nContainer", target=_top]; } subgraph cluster_builtins { graph [label=builtins]; node [color=4]; "builtins.object" [URL="https://docs.python.org/3.6/library/functions.html#object", label=object, target=_top]; } subgraph "cluster_uqbar.containers" { graph [label="uqbar.containers"]; node [color=5]; "uqbar.containers.UniqueTreeContainer.UniqueTreeContainer" [label="Unique\nTree\nContainer"]; "uqbar.containers.UniqueTreeNode.UniqueTreeNode" [label="Unique\nTree\nNode"]; "uqbar.containers.UniqueTreeNode.UniqueTreeNode" -> "uqbar.containers.UniqueTreeContainer.UniqueTreeContainer"; } "abjad.rhythmtrees.RhythmTreeContainer" -> "abjadext.nauert.QGridContainer.QGridContainer"; "abjad.system.AbjadObject.AbjadObject" -> "abjad.rhythmtrees.RhythmTreeMixin"; "builtins.object" -> "abjad.system.AbjadObject.AbjadObject"; "builtins.object" -> "uqbar.containers.UniqueTreeNode.UniqueTreeNode"; "uqbar.containers.UniqueTreeContainer.UniqueTreeContainer" -> "abjad.rhythmtrees.RhythmTreeContainer"; }

class abjadext.nauert.QGridContainer.QGridContainer(children=None, preprolated_duration=1, name=None)

Q-grid container.

>>> container = abjadext.nauert.QGridContainer()
>>> abjad.f(container)
abjadext.nauert.QGridContainer(
    children=(),
    preprolated_duration=abjad.Duration(1, 1),
    )

Used internally by QGrid.


Attributes Summary

leaves Get leaves.

Special methods

(RhythmTreeContainer).__add__(argument)

Concatenate containers self and argument. The operation c = a + b returns a new RhythmTreeContainer c with the content of both a and b, and a preprolated_duration equal to the sum of the durations of a and b. The operation is non-commutative: the content of the first operand will be placed before the content of the second operand:

>>> a = abjad.rhythmtrees.RhythmTreeParser()('(1 (1 1 1))')[0]
>>> b = abjad.rhythmtrees.RhythmTreeParser()('(2 (3 4))')[0]
>>> c = a + b
>>> c.preprolated_duration
Duration(3, 1)
>>> abjad.f(c)
abjad.rhythmtrees.RhythmTreeContainer(
    children=(
        abjad.rhythmtrees.RhythmTreeLeaf(
            preprolated_duration=abjad.Duration(1, 1),
            is_pitched=True,
            ),
        abjad.rhythmtrees.RhythmTreeLeaf(
            preprolated_duration=abjad.Duration(1, 1),
            is_pitched=True,
            ),
        abjad.rhythmtrees.RhythmTreeLeaf(
            preprolated_duration=abjad.Duration(1, 1),
            is_pitched=True,
            ),
        abjad.rhythmtrees.RhythmTreeLeaf(
            preprolated_duration=abjad.Duration(3, 1),
            is_pitched=True,
            ),
        abjad.rhythmtrees.RhythmTreeLeaf(
            preprolated_duration=abjad.Duration(4, 1),
            is_pitched=True,
            ),
        ),
    preprolated_duration=abjad.Duration(3, 1),
    )

Returns new RhythmTreeContainer.

(RhythmTreeContainer).__call__(pulse_duration)

Generates Abjad score components.

>>> rtm = '(1 (1 (2 (1 1 1)) 2))'
>>> tree = abjad.rhythmtrees.RhythmTreeParser()(rtm)[0]
>>> tree((1, 4))
[Tuplet(Multiplier(4, 5), "c'16 { 2/3 c'16 c'16 c'16 } c'8")]
>>> staff = abjad.Staff(tree((1, 4)))
>>> abjad.show(staff) 

Returns list of components.

(UniqueTreeContainer).__contains__(expr)
(UniqueTreeContainer).__delitem__(i)
(AbjadObject).__format__(format_specification='')

Formats Abjad object.

Set format_specification to '' or 'storage'. Interprets '' equal to 'storage'.

Returns string.

(UniqueTreeContainer).__getitem__(expr)
(RhythmTreeContainer).__graph__(**keywords)

The Graph representation of the RhythmTreeContainer:

>>> rtm = '(1 (1 (2 (1 1 1)) 2))'
>>> tree = abjad.rhythmtrees.RhythmTreeParser()(rtm)[0]
>>> graph = tree.__graph__()
>>> print(format(graph, 'graphviz'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported format string passed to method.__format__
>>> abjad.graph(graph) 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/josiah/Source/github.com/Abjad/abjad-ext-book/abjadext/book/CodeBlock.py", line 442, in graph
    raise TypeError('Cannot graph {!r}'.format(type(argument)))
TypeError: Cannot graph <class 'method'>

Return Graph instance.

(UniqueTreeContainer).__iter__()
(UniqueTreeContainer).__len__()
(RhythmTreeContainer).__radd__(argument)

Concatenates containers argument and self.

Returns new RhythmTreeContainer.

(RhythmTreeContainer).__repr__()

Gets interpreter representation of rhythm tree container.

Returns string.

(UniqueTreeContainer).__setitem__(i, expr)

Methods

(UniqueTreeContainer).append(expr)
(UniqueTreeContainer).depth_first(top_down=True)
(UniqueTreeContainer).extend(expr)
(UniqueTreeContainer).index(expr)
(UniqueTreeContainer).insert(i, expr)
(UniqueTreeContainer).pop(i=-1)
(UniqueTreeNode).precede_by(expr)
(UniqueTreeContainer).recurse()
(UniqueTreeContainer).remove(node)
(UniqueTreeNode).replace_with(expr)
(UniqueTreeNode).succeed_by(expr)

Read/write properties

(UniqueTreeNode).name
(RhythmTreeMixin).preprolated_duration

The node’s preprolated_duration in pulses:

>>> node = abjad.rhythmtrees.RhythmTreeLeaf(
...     preprolated_duration=1)
>>> node.preprolated_duration
Duration(1, 1)
>>> node.preprolated_duration = 2
>>> node.preprolated_duration
Duration(2, 1)

Returns int.


Read-only properties

(UniqueTreeContainer).children
(UniqueTreeNode).depth
(RhythmTreeMixin).duration

The preprolated_duration of the node:

>>> rtm = '(1 ((1 (1 1)) (1 (1 1))))'
>>> tree = abjad.rhythmtrees.RhythmTreeParser()(rtm)[0]
>>> tree.duration
Duration(1, 1)
>>> tree[1].duration
Duration(1, 2)
>>> tree[1][1].duration
Duration(1, 4)

Return Duration instance.

(UniqueTreeNode).graph_order
leaves

Get leaves.

(UniqueTreeNode).parent
(UniqueTreeNode).parentage
(RhythmTreeMixin).parentage_ratios

A sequence describing the relative durations of the nodes in a node’s improper parentage.

The first item in the sequence is the preprolated_duration of the root node, and subsequent items are pairs of the preprolated duration of the next node in the parentage and the total preprolated_duration of that node and its siblings:

>>> a = abjad.rhythmtrees.RhythmTreeContainer(preprolated_duration=1)
>>> b = abjad.rhythmtrees.RhythmTreeContainer(preprolated_duration=2)
>>> c = abjad.rhythmtrees.RhythmTreeLeaf(preprolated_duration=3)
>>> d = abjad.rhythmtrees.RhythmTreeLeaf(preprolated_duration=4)
>>> e = abjad.rhythmtrees.RhythmTreeLeaf(preprolated_duration=5)
>>> a.extend([b, c])
>>> b.extend([d, e])
>>> a.parentage_ratios
(Duration(1, 1),)
>>> b.parentage_ratios
(Duration(1, 1), (Duration(2, 1), Duration(5, 1)))
>>> c.parentage_ratios
(Duration(1, 1), (Duration(3, 1), Duration(5, 1)))
>>> d.parentage_ratios
(Duration(1, 1), (Duration(2, 1), Duration(5, 1)), (Duration(4, 1), Duration(9, 1)))
>>> e.parentage_ratios
(Duration(1, 1), (Duration(2, 1), Duration(5, 1)), (Duration(5, 1), Duration(9, 1)))

Returns tuple.

(RhythmTreeMixin).pretty_rtm_format

The node’s pretty-printed RTM format:

>>> rtm = '(1 ((1 (1 1)) (1 (1 1))))'
>>> tree = abjad.rhythmtrees.RhythmTreeParser()(rtm)[0]
>>> print(tree.pretty_rtm_format)
(1 (
    (1 (
        1
        1))
    (1 (
        1
        1))))

Returns string.

(RhythmTreeMixin).prolation

Prolation of rhythm tree node.

Returns multiplier.

(RhythmTreeMixin).prolations

Prolations of rhythm tree node.

Returns tuple.

(UniqueTreeNode).root
(RhythmTreeContainer).rtm_format

The node’s RTM format:

>>> rtm = '(1 ((1 (1 1)) (1 (1 1))))'
>>> tree = abjad.rhythmtrees.RhythmTreeParser()(rtm)[0]
>>> tree.rtm_format
'(1 ((1 (1 1)) (1 (1 1))))'

Returns string.

(RhythmTreeMixin).start_offset

The starting offset of a node in a rhythm-tree relative the root.

>>> rtm = '(1 ((1 (1 1)) (1 (1 1))))'
>>> tree = abjad.rhythmtrees.RhythmTreeParser()(rtm)[0]
>>> tree.start_offset
Offset(0, 1)
>>> tree[1].start_offset
Offset(1, 2)
>>> tree[0][1].start_offset
Offset(1, 4)

Returns Offset instance.

(RhythmTreeMixin).stop_offset

The stopping offset of a node in a rhythm-tree relative the root.