neoscore.core.page

class neoscore.core.page.Page[source]

Bases: PositionedObject

A document page.

All PositionedObjects will have a Page as their ancestor. All Pages are direct children of the global document.

Page objects are automatically created by Document and should not be manually created or manipulated.

__init__(pos: PointDef, document: Document, index: int, page_side: DirectionX, paper: Paper)[source]
Parameters
  • pos – The position of the top left corner of this page’s live area in canvas space. Note that this refers to the corner of the live area bounded by margins, not the actual paper corner.

  • document – The global document. This is used as the Page object’s parent.

  • index – The index of this page. This should be the same index this page can be found at in Document.pages.

  • page_side – The left/right side the page lies on when printed.

  • paper – The paper geometry for this page.

property index

The index of this page in its managing PageSupplier.

property page_side

The left/right side the page lies on when printed.

This determines which side the gutter should be placed on.

bounding_rect

The page bounding rect, positioned relative to the pos.

document_space_bounding_rect

The page bounding rect relative to the document.

full_margin_left

The left margin, including any gutter if the gutter is on the left.

full_margin_right

The right margin, including any gutter if the gutter is on the right.

property left_margin_x: Unit

The X position of the edge of the left margin.

This is always ZERO, given here as a convenience synonym.

property right_margin_x: Unit

The X position of the edge of the right margin.

This is always page.paper.live_width, given here as a convenience synonym.

property top_margin_y: Unit

The Y position of the edge of the top margin.

This is always ZERO, given here as a convenience synonym.

property bottom_margin_y: Unit

The Y position of the edge of the top margin.

This is always page.paper.live_height, given here as a convenience synonym.

property center_x: Unit

The X position of the center of the live page area.

This is a convenience method for page.paper.live_width / 2.

create_geometry_preview(background_brush: Brush)[source]

Create and render child objects which show the page geometry.

This shouldn’t be called directly; use the setting in neoscore.score instead.

This is useful for interactive views, but should typically not be called in PDF and image export contexts.