neoscore.core.layout_controllers
Objects which control flowable layouts
- class neoscore.core.layout_controllers.LayoutController[source]
Bases:
object
An abstract layout controller for working with Flowable layouts.
- class neoscore.core.layout_controllers.NewLine[source]
Bases:
LayoutController
,PositionedObject
A line break controller.
These are currently used only for automatically generated line breaks and should generally not be constructed directly. Line breaks can be controlled using
BreakOpportunity
objects instead.- __init__(pos: Union[Point, Tuple[Unit, Unit]], page: Page, flowable_x: Unit, length: Unit, height: Unit)[source]
- Parameters
pos – The position of the top left corner of this line relative to the page.
page – The page this line appears on. This is used as the object’s parent.
flowable_x – The x position in the flowable’s local space where this line begins.
length – The line length
height – The line height
- class neoscore.core.layout_controllers.MarginController[source]
Bases:
LayoutController
A controller defining flowable line margins.
A flowable can have any number of different margin layers identified by a given
layer_key
. A margin controller overrides the active margin values only for the specified layer. When a flowable generates its layout, it sums the margin values from all layers at the point of each new line to determine its margins.This layered margin system is useful for situations like staves, where different object states will change the required margins. For example, instrument names call for a margin size that will often be longer on the first system than later ones, while clefs and key signatures contribute their own margin amounts which can vary between systems. In this case, one might create separate margin controllers for each of these layers.
These can be manually created and added to a flowable via
Flowable.add_margin_controller
to control margins.- __init__(flowable_x: Unit, margin_left: Unit, layer_key: str = '')[source]
- Parameters
flowable_x – The position of this controller within the owning flowable’s local space.
margin_left – The margin value contributed by this controller in the specified layer
layer_key – The layer this controller applies to. Layer keys starting with
_neoscore
are reserved for internal purposes.
- property layer_key: str